blob: ae829d080c6f045ddd9b51ace857c773e1787892 (
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
package com.vaadin.tests.components.combobox;
import org.junit.Test;
import org.openqa.selenium.WebElement;
import com.vaadin.testbench.By;
import com.vaadin.testbench.elements.ComboBoxElement;
import com.vaadin.tests.tb3.MultiBrowserTest;
import static org.junit.Assert.assertEquals;
public class ComboBoxClosePopupRetainTextTest extends MultiBrowserTest {
@Override
protected Class<?> getUIClass() {
return ComboBoxes2.class;
}
@Test
public void testClosePopupRetainText() throws Exception {
openTestURL();
ComboBoxElement cb = $(ComboBoxElement.class).first();
WebElement textbox = cb.findElement(By.vaadin("#textbox"));
textbox.sendKeys("I");
// Toggle the popup
// Uses #clickElement instead of ComboBoxElement#openPopup() due to an
// issue with the firefox driver
clickElement(cb.findElement(By.vaadin("#button")));
clickElement(cb.findElement(By.vaadin("#button")));
// The entered value should remain
assertEquals("I", textbox.getAttribute("value"));
}
@Test
public void testClosePopupRetainText_selectingAValue() throws Exception {
openTestURL();
ComboBoxElement cb = $(ComboBoxElement.class).first();
cb.selectByText("Item 3");
WebElement textbox = cb.findElement(By.vaadin("#textbox"));
cb.clear();
textbox.sendKeys("I");
// Close the open suggestions popup
// Uses #clickElement instead of ComboBoxElement#openPopup() due to an
// issue with the firefox driver
clickElement(cb.findElement(By.vaadin("#button")));
// Entered value should remain in the text field even though the popup
// is opened
assertEquals("I", textbox.getAttribute("value"));
}
}
|