1 package com.vaadin.tests.components.grid.basicfeatures.escalator;
3 import static org.junit.Assert.assertEquals;
4 import static org.junit.Assert.assertFalse;
5 import static org.junit.Assert.assertNull;
7 import java.io.IOException;
9 import org.junit.Before;
10 import org.junit.Test;
12 import com.vaadin.testbench.elements.NotificationElement;
13 import com.vaadin.tests.components.grid.basicfeatures.EscalatorBasicClientFeaturesTest;
15 public class EscalatorBasicsTest extends EscalatorBasicClientFeaturesTest {
24 public void testDetachingAnEmptyEscalator() {
25 selectMenuPath(GENERAL, DETACH_ESCALATOR);
26 assertEscalatorIsRemovedCorrectly();
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();
38 public void testDetachingAPopulatedEscalator() {
39 selectMenuPath(GENERAL, POPULATE_COLUMN_ROW);
40 selectMenuPath(GENERAL, DETACH_ESCALATOR);
41 assertEscalatorIsRemovedCorrectly();
45 public void testDetachingAndReattachingAnEscalator() {
46 selectMenuPath(GENERAL, POPULATE_COLUMN_ROW);
48 scrollVerticallyTo(50);
49 scrollHorizontallyTo(50);
51 selectMenuPath(GENERAL, DETACH_ESCALATOR);
52 selectMenuPath(GENERAL, ATTACH_ESCALATOR);
54 assertEquals("Vertical scroll position", 50, getScrollTop());
55 assertEquals("Horizontal scroll position", 50, getScrollLeft());
57 assertEquals("First cell of first visible row", "Row 2: 0,2",
58 getBodyCell(0, 0).getText());
61 private void assertEscalatorIsRemovedCorrectly() {
62 assertFalse($(NotificationElement.class).exists());
63 assertNull(getEscalator());