mirror of
https://github.com/gristlabs/grist-core.git
synced 2026-03-02 04:09:24 +00:00
(core) Renaming filters for choice columns
Summary: Updating filters when user renames labels in a choice/choice list column. When there are unsaved filters they are reverted to orginal values (only for the affected column). Test Plan: new tests Reviewers: alexmojaki Reviewed By: alexmojaki Differential Revision: https://phab.getgrist.com/D3230
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import json
|
||||
import types
|
||||
import logger
|
||||
import useractions
|
||||
@@ -860,6 +861,38 @@ class TestUserActions(test_engine.EngineTestCase):
|
||||
[12, [[]]],
|
||||
])
|
||||
|
||||
# Test filters rename
|
||||
|
||||
# Create new view section
|
||||
self.apply_user_action(["CreateViewSection", 1, 0, "record", None])
|
||||
|
||||
# Filter it by first column
|
||||
self.apply_user_action(['BulkAddRecord', '_grist_Filters', [None], {
|
||||
"viewSectionRef": [1],
|
||||
"colRef": [1],
|
||||
"filter": [json.dumps({"included": ["b", "c"]})]
|
||||
}])
|
||||
|
||||
# Add the same filter for second column (to make sure it is not renamed)
|
||||
self.apply_user_action(['BulkAddRecord', '_grist_Filters', [None], {
|
||||
"viewSectionRef": [1],
|
||||
"colRef": [2],
|
||||
"filter": [json.dumps({"included": ["b", "c"]})]
|
||||
}])
|
||||
|
||||
# Rename choices
|
||||
renames = {"b": "z", "c": "b"}
|
||||
self.apply_user_action(
|
||||
["RenameChoices", "ChoiceTable", "ChoiceColumn", renames])
|
||||
|
||||
# Test filters
|
||||
self.assertTableData('_grist_Filters', data=[
|
||||
["id", "colRef", "filter", "setAutoRemove", "viewSectionRef"],
|
||||
[1, 1, json.dumps({"included": ["z", "b"]}), None, 1],
|
||||
[2, 2, json.dumps({"included": ["b", "c"]}), None, 1]
|
||||
])
|
||||
|
||||
|
||||
def test_reference_lookup(self):
|
||||
sample = testutil.parse_test_sample({
|
||||
"SCHEMA": [
|
||||
|
||||
Reference in New Issue
Block a user