fix: discard non-declared field values for grid vue data
This commit is contained in:
parent
2ccfe29553
commit
5b6c686a9d
2 changed files with 15 additions and 0 deletions
|
|
@ -1867,7 +1867,19 @@ class TestGrid(WebTestCase):
|
|||
context = grid.get_vue_context()
|
||||
self.assertEqual(context, {"data": [{"foo": "bar"}], "row_classes": {}})
|
||||
|
||||
# non-declared columns are discarded
|
||||
mydata = [
|
||||
{"foo": "a", "bar": "b", "baz": "c"},
|
||||
]
|
||||
grid = self.make_grid(columns=["bar"], data=mydata)
|
||||
context = grid.get_vue_context()
|
||||
self.assertEqual(context, {"data": [{"bar": "b"}], "row_classes": {}})
|
||||
|
||||
# if grid has actions, that list may be supplemented
|
||||
mydata = [
|
||||
{"foo": "bar"},
|
||||
]
|
||||
grid = self.make_grid(columns=["foo"], data=mydata)
|
||||
grid.actions.append(mod.GridAction(self.request, "view", url="/blarg"))
|
||||
context = grid.get_vue_context()
|
||||
self.assertIsNot(context["data"], mydata)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue