assertNull(formView.getComponent());
assertNull(getModelAttribute(elem));
// Wrong element type name
createFormView(FormAttributes.INPUT_TYPE_SUBMIT);
MutableAttributeSet attrs = new SimpleAttributeSet();
attrs.addAttribute(HTML.Attribute.TYPE, "my_type");
doc.setCharacterAttributes(22, 1, attrs, false);
assertEquals("my_type",
elem.getAttributes().getAttribute(HTML.Attribute.TYPE));
assertNull(formView.createComponent());
assertNull(formView.getComponent());
assertNotNull(getModelAttribute(elem));
assertNull(StyleConstants.getComponent(elem.getAttributes()));
formView.setParent(editorPane.getUI().getRootView(editorPane));
assertNull(StyleConstants.getComponent(elem.getAttributes()));
assertNull(formView.createComponent());
assertNull(formView.getComponent());
assertNotNull(getModelAttribute(elem));
// Element type "password"
createFormView(FormAttributes.INPUT_TYPE_PASSWORD);
assertNull(StyleConstants.getComponent(elem.getAttributes()));
assertNull(StyleConstants.getComponent(elem.getAttributes()));
Object modelAttribute = getModelAttribute(elem);
assertNull(formView.getComponent());
assertSame(elem, formView.getElement());
assertSame(elem.getAttributes(), formView.getAttributes());
Component component = formView.createComponent();
assertNotNull(component);
assertNull(formView.getComponent());
assertSame(modelAttribute, getModelAttribute(elem));
assertNotSame(component, formView.createComponent());
component = formView.createComponent();
formView.setParent(editorPane.getUI().getRootView(editorPane));
assertNotNull(component);
Component cashedComponent = formView.getComponent();
assertNotNull(cashedComponent);
assertSame(cashedComponent, formView.getComponent());
assertNotSame(component, cashedComponent);
assertNotSame(component, formView.createComponent());
assertNotSame(formView.getComponent(), formView.createComponent());
assertSame(modelAttribute, getModelAttribute(elem));
assertSame(cashedComponent, formView.getComponent());
// Check component attribute
createFormView(FormAttributes.INPUT_TYPE_TEXT);
assertNull(StyleConstants.getComponent(elem.getAttributes()));
JButton button = new JButton();
attrs = new SimpleAttributeSet();
StyleConstants.setComponent(attrs, button);
doc.setCharacterAttributes(23, 1, attrs, false);
assertNotNull(StyleConstants.getComponent(elem.getAttributes()));
assertNull(formView.getComponent());