blob: 755a4242edffcde895eecd4cb6caf4c880e5b7cb (
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
|
package com.vaadin.tests.components.window;
import org.junit.Assert;
import org.junit.Test;
import com.vaadin.testbench.elements.ButtonElement;
import com.vaadin.testbench.elements.LabelElement;
import com.vaadin.tests.tb3.MultiBrowserTest;
public class WindowShouldRemoveActionHandlerTest extends MultiBrowserTest {
@Test
public void testRemovingActionHandlers() {
openTestURL();
addActionHandler();
addAnotherActionHandler();
assertState("An UI with 2 action handlers");
addActionHandler();
assertState("An UI with 3 action handlers");
removeActionHandler();
removeActionHandler();
assertState("An UI with 3 action handlers - Removed handler - Removed handler");
addActionHandler();
assertState("An UI with 2 action handlers");
}
private void removeActionHandler() {
$(ButtonElement.class).caption("Remove an action handler").first()
.click();
}
private void addAnotherActionHandler() {
$(ButtonElement.class).caption("Add another action handler").first()
.click();
}
private void addActionHandler() {
$(ButtonElement.class).caption("Add an action handler").first().click();
}
private void assertState(String expected) {
Assert.assertEquals("Unexpected state,", expected,
$(LabelElement.class).id("state").getText());
}
}
|