feat: add per-row css class support for grids
This commit is contained in:
parent
f6fb6957e3
commit
e332975ce9
11 changed files with 253 additions and 75 deletions
|
@ -406,28 +406,34 @@ class TestForm(TestCase):
|
|||
self.assertIn('<script type="text/x-template" id="wutta-form-template">', html)
|
||||
self.assertNotIn('@submit', html)
|
||||
|
||||
def test_add_grid_vue_data(self):
|
||||
def test_add_grid_vue_context(self):
|
||||
form = self.make_form()
|
||||
|
||||
# grid must have key
|
||||
grid = Grid(self.request)
|
||||
self.assertRaises(ValueError, form.add_grid_vue_data, grid)
|
||||
self.assertRaises(ValueError, form.add_grid_vue_context, grid)
|
||||
|
||||
# otherwise it works
|
||||
grid = Grid(self.request, key='foo')
|
||||
self.assertEqual(len(form.grid_vue_data), 0)
|
||||
form.add_grid_vue_data(grid)
|
||||
self.assertEqual(len(form.grid_vue_data), 1)
|
||||
self.assertIn('foo', form.grid_vue_data)
|
||||
self.assertEqual(form.grid_vue_data['foo'], [])
|
||||
self.assertEqual(len(form.grid_vue_context), 0)
|
||||
form.add_grid_vue_context(grid)
|
||||
self.assertEqual(len(form.grid_vue_context), 1)
|
||||
self.assertIn('foo', form.grid_vue_context)
|
||||
self.assertEqual(form.grid_vue_context['foo'], {
|
||||
'data': [],
|
||||
'row_classes': {},
|
||||
})
|
||||
|
||||
# calling again with same key will replace data
|
||||
records = [{'foo': 1}, {'foo': 2}]
|
||||
grid = Grid(self.request, key='foo', columns=['foo'], data=records)
|
||||
form.add_grid_vue_data(grid)
|
||||
self.assertEqual(len(form.grid_vue_data), 1)
|
||||
self.assertIn('foo', form.grid_vue_data)
|
||||
self.assertEqual(form.grid_vue_data['foo'], records)
|
||||
form.add_grid_vue_context(grid)
|
||||
self.assertEqual(len(form.grid_vue_context), 1)
|
||||
self.assertIn('foo', form.grid_vue_context)
|
||||
self.assertEqual(form.grid_vue_context['foo'], {
|
||||
'data': records,
|
||||
'row_classes': {},
|
||||
})
|
||||
|
||||
def test_render_vue_finalize(self):
|
||||
form = self.make_form()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue