Search in sources :

Example 1 with Key

use of com.vaadin.flow.component.Key in project linkki by linkki-framework.

the class UIButtonIntegrationTest method testCreateButtonShortcut.

@Test
void testCreateButtonShortcut() {
    ButtonComponentDefinitionCreator buttonComponentDefinitionCreator = new UIButton.ButtonComponentDefinitionCreator();
    Optional<Key> shortcutKey = buttonComponentDefinitionCreator.createShortcutKey(getAnnotation("value"));
    List<String> keys = shortcutKey.get().getKeys();
    assertThat(keys.size(), is(1));
    assertThat(keys.get(0), is("Enter"));
}
Also used : ButtonComponentDefinitionCreator(org.linkki.core.ui.element.annotation.UIButton.ButtonComponentDefinitionCreator) Key(com.vaadin.flow.component.Key) Test(org.junit.jupiter.api.Test)

Example 2 with Key

use of com.vaadin.flow.component.Key in project linkki by linkki-framework.

the class UIButtonIntegrationTest method testCreateButtonShortcut_MultipleKeys.

@Test
void testCreateButtonShortcut_MultipleKeys() {
    ButtonComponentDefinitionCreator buttonComponentDefinitionCreator = new UIButton.ButtonComponentDefinitionCreator();
    Optional<Key> shortcutKey = buttonComponentDefinitionCreator.createShortcutKey(getAnnotation("staticValue"));
    List<String> keys = shortcutKey.get().getKeys();
    assertThat(keys.size(), is(3));
    assertThat(keys.get(0), is("KeyA"));
    assertThat(keys.get(1), is("KeyB"));
    assertThat(keys.get(2), is("KeyC"));
}
Also used : ButtonComponentDefinitionCreator(org.linkki.core.ui.element.annotation.UIButton.ButtonComponentDefinitionCreator) Key(com.vaadin.flow.component.Key) Test(org.junit.jupiter.api.Test)

Example 3 with Key

use of com.vaadin.flow.component.Key in project linkki by linkki-framework.

the class UIButtonIntegrationTest method testCreateButtonShortcut_NoKeys.

@Test
void testCreateButtonShortcut_NoKeys() {
    ButtonComponentDefinitionCreator buttonComponentDefinitionCreator = new UIButton.ButtonComponentDefinitionCreator();
    Optional<Key> shortcutKey = buttonComponentDefinitionCreator.createShortcutKey(getAnnotation("doFoo"));
    assertThat(shortcutKey.isEmpty(), is(true));
}
Also used : ButtonComponentDefinitionCreator(org.linkki.core.ui.element.annotation.UIButton.ButtonComponentDefinitionCreator) Key(com.vaadin.flow.component.Key) Test(org.junit.jupiter.api.Test)

Aggregations

Key (com.vaadin.flow.component.Key)3 Test (org.junit.jupiter.api.Test)3 ButtonComponentDefinitionCreator (org.linkki.core.ui.element.annotation.UIButton.ButtonComponentDefinitionCreator)3