def test_column_with_rows(self): column = Column(Row()) expected = { 'type': 'doodad.Column', 'children': [{'type': 'doodad.Row', 'children': []}] } self.assertEqual(column.to_dict(), expected)
def test_column_with_doodad(self): column = Column(Doodad()) expected = { 'type': 'doodad.Column', 'children': [{'type': 'doodad.Doodad'}], } self.assertEqual(column.to_dict(), expected)
def test_empty_column(self): column = Column() expected = { 'type': 'doodad.Column', 'children': [] } self.assertEqual(column.to_dict(), expected)
def test_column_with_row_with_empty_column(self): layout = Column(Row(Column())) expected = { 'type': 'doodad.Column', 'children': [{ 'type': 'doodad.Row', 'children': [{'type': 'doodad.Column', 'children': []}] }] } self.assertEqual(layout.to_dict(), expected)
def test_container_attrs(self): doodad = Column(Row(Column(), Column(), fizz='buzz'), foo='bar', bar='baz') expected = { 'type': 'doodad.Column', 'foo': 'bar', 'bar': 'baz', 'children': [{'type': 'doodad.Row', 'fizz': 'buzz', 'children': [ {'type': 'doodad.Column', 'children': []}, {'type': 'doodad.Column', 'children': []}]}]} self.assertEqual(doodad.to_dict(), expected)