Ejemplo n.º 1
0
    def test_create_from_factory(self):
        json = {
            "tag": "input",
            "element": {
                "attrs": {
                    "id": "some_field",
                    "class": [
                        "class1",
                        "class2"
                    ],
                    "type": "text"
                }
            }
        }

        element = FieldFactory.create(json)
        self.assertEqual(element.attrs['id'], json['element']['attrs']['id'])
        self.assertIsInstance(element, InputField)
Ejemplo n.º 2
0
 def build(self):
     html = self._build_form()
     for child in self.children:
         html += FieldFactory.create(child).build()
     html += "</form>"
     return html