use of com.vaadin.testbench.unit.MetaKeys in project testbench by vaadin.
the class ButtonWrapTest method clickWithMeta_metaKeysMarkedAsUsed.
@Test
public void clickWithMeta_metaKeysMarkedAsUsed() {
Button button = new Button();
AtomicReference<ClickEvent> event = new AtomicReference<>(null);
button.addClickListener(clickEvent -> event.set(clickEvent));
getCurrentView().getElement().appendChild(button.getElement());
final ButtonWrap button_ = wrap(ButtonWrap.class, button);
button_.click(new MetaKeys(true, true, true, true));
Assertions.assertNotNull(event.get(), "event should have fired and recorded");
Assertions.assertTrue(event.get().isCtrlKey(), "Ctrl should have been used");
Assertions.assertTrue(event.get().isShiftKey(), "Shift should have been used");
Assertions.assertTrue(event.get().isAltKey(), "Alt should have been used");
Assertions.assertTrue(event.get().isMetaKey(), "Meta should have been used");
button_.click(new MetaKeys(true, true, false, false));
Assertions.assertTrue(event.get().isCtrlKey(), "Ctrl should have been used");
Assertions.assertTrue(event.get().isShiftKey(), "Shift should have been used");
Assertions.assertFalse(event.get().isAltKey(), "Alt should not have been used");
Assertions.assertFalse(event.get().isMetaKey(), "Meta should not have been used");
}
Aggregations