use of com.vaadin.flow.component.grid.editor.EditorEvent in project flow-components by vaadin.
the class EditorImplTest method save_editorIsOpened_editorIsInBufferedMode_beanIsInvalid_editorIsNotClosed.
@Test
public void save_editorIsOpened_editorIsInBufferedMode_beanIsInvalid_editorIsNotClosed() {
editor.getBinder().forField(new TextField()).withValidator(value -> !value.equals("bar"), "").bind(ValueProvider.identity(), (item, value) -> {
});
editor.editItem("bar");
fakeClientResponse();
editor.refreshedItems.clear();
editor.setBuffered(true);
AtomicReference<StatusChangeEvent> statusEventCapture = new AtomicReference<>();
AtomicReference<EditorEvent<String>> saveEventCapture = new AtomicReference<>();
AtomicReference<EditorEvent<String>> closeEventCapture = new AtomicReference<>();
Assert.assertFalse(doSave(statusEventCapture, saveEventCapture, closeEventCapture));
Assert.assertEquals(0, editor.refreshedItems.size());
Assert.assertNotNull(statusEventCapture.get());
Assert.assertNull(saveEventCapture.get());
Assert.assertNull(closeEventCapture.get());
Assert.assertTrue(statusEventCapture.get().hasValidationErrors());
}
Aggregations