blob: 7c67f1e8d9fea295a43cc82d8d2c4369556f54ab (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
package com.vaadin.tests.components.richtextarea;
import static org.hamcrest.Matchers.containsString;
import static org.junit.Assert.assertThat;
import org.junit.Test;
import org.openqa.selenium.Keys;
import org.openqa.selenium.WebElement;
import com.vaadin.testbench.elements.RichTextAreaElement;
import com.vaadin.tests.tb3.MultiBrowserTest;
public class RichTextAreaDelegateToShortcutHandlerTest
extends MultiBrowserTest {
@Test
public void shouldDelegateToShortcutActionHandler() {
openTestURL();
WebElement textAreaEditor = $(RichTextAreaElement.class).first()
.getEditorIframe();
textAreaEditor.sendKeys("Test");
textAreaEditor.sendKeys(Keys.ENTER);
assertThat("Shortcut handler has not been invoked", getLogRow(0),
containsString("ShortcutHandler invoked Test"));
textAreaEditor.sendKeys(Keys.chord(Keys.SHIFT, Keys.ENTER));
textAreaEditor.sendKeys("another row");
textAreaEditor.sendKeys(Keys.ENTER);
assertThat("Shortcut handler has not been invoked", getLogRow(0),
containsString("ShortcutHandler invoked Test\nanother row"));
}
}
|