tester.assertLabel(serialNumPath + ":l", "Serial Number");
tester.assertComponent(serialNumFieldPath, InputField.class);
Component serialNumField = tester.getComponentFromLastRenderedPage(serialNumFieldPath);
// Check attaching/detaching component's model (BeanPropertyModel).
BeanPropertyModel nameFieldModel = (BeanPropertyModel) nameField.getDefaultModel();
assertFalse(nestedModel.isAttached());
// Should attach the nested model's object.
nameFieldModel.getObject();
assertTrue(nestedModel.isAttached());
NonSerializableBean firstBean = (NonSerializableBean)nestedModel.getObject();
// Make the first bean detach. This also tests that the model is attached somewhere below the page.
//page.detachModels(); // TODO 1.3 doesn't work
detachModels(page);
assertFalse(nestedModel.isAttached());
NonSerializableBean secondBean = (NonSerializableBean)nestedModel.getObject();
// Should be different and attached now.
assertNotSame(firstBean, secondBean);
assertTrue(nestedModel.isAttached());
// Assert PropertyChangeListener on BeanForm is called.
assertFalse( form.isComponentRefreshNeeded() );
nameFieldModel.setObject("test");
assertTrue( form.isComponentRefreshNeeded() );
// Clear the refresh components.
form.clearRefreshComponents();
// Assert PropertyChangeListener on BeanForm is called after detach()/attach().
//page.detachModels(); // TODO 1.3 doesn't work
detachModels(page);
assertFalse(nestedModel.isAttached());
assertFalse( form.isComponentRefreshNeeded() );
nameFieldModel.setObject("test");
assertTrue( form.isComponentRefreshNeeded() );
// Clear the refresh components.
form.clearRefreshComponents();
}