]> source.dussan.org Git - vaadin-framework.git/blob
3e8e7d65a3a030b9665a15b2e1c1383033eb3571
[vaadin-framework.git] /
1 package com.vaadin.tests.components.grid.basicfeatures.escalator;
2
3 import static org.junit.Assert.assertEquals;
4 import static org.junit.Assert.assertFalse;
5 import static org.junit.Assert.assertNull;
6
7 import java.io.IOException;
8
9 import org.junit.Before;
10 import org.junit.Test;
11
12 import com.vaadin.testbench.elements.NotificationElement;
13 import com.vaadin.tests.components.grid.basicfeatures.EscalatorBasicClientFeaturesTest;
14
15 public class EscalatorBasicsTest extends EscalatorBasicClientFeaturesTest {
16
17     @Before
18     public void setUp() {
19         setDebug(true);
20         openTestURL();
21     }
22
23     @Test
24     public void testDetachingAnEmptyEscalator() {
25         selectMenuPath(GENERAL, DETACH_ESCALATOR);
26         assertEscalatorIsRemovedCorrectly();
27     }
28
29     @Test
30     public void testDetachingASemiPopulatedEscalator() throws IOException {
31         selectMenuPath(COLUMNS_AND_ROWS, ADD_ONE_OF_EACH_ROW);
32         selectMenuPath(COLUMNS_AND_ROWS, COLUMNS, ADD_ONE_COLUMN_TO_BEGINNING);
33         selectMenuPath(GENERAL, DETACH_ESCALATOR);
34         assertEscalatorIsRemovedCorrectly();
35     }
36
37     @Test
38     public void testDetachingAPopulatedEscalator() {
39         selectMenuPath(GENERAL, POPULATE_COLUMN_ROW);
40         selectMenuPath(GENERAL, DETACH_ESCALATOR);
41         assertEscalatorIsRemovedCorrectly();
42     }
43
44     @Test
45     public void testDetachingAndReattachingAnEscalator() {
46         selectMenuPath(GENERAL, POPULATE_COLUMN_ROW);
47
48         scrollVerticallyTo(50);
49         scrollHorizontallyTo(50);
50
51         selectMenuPath(GENERAL, DETACH_ESCALATOR);
52         selectMenuPath(GENERAL, ATTACH_ESCALATOR);
53
54         assertEquals("Vertical scroll position", 50, getScrollTop());
55         assertEquals("Horizontal scroll position", 50, getScrollLeft());
56
57         assertEquals("First cell of first visible row", "Row 2: 0,2",
58                 getBodyCell(0, 0).getText());
59     }
60
61     private void assertEscalatorIsRemovedCorrectly() {
62         assertFalse($(NotificationElement.class).exists());
63         assertNull(getEscalator());
64     }
65 }