2 * Copyright 2000-2016 Vaadin Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
5 * use this file except in compliance with the License. You may obtain a copy of
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 * License for the specific language governing permissions and limitations under
16 package com.vaadin.tests.components.grid.basicfeatures.escalator;
18 import static org.junit.Assert.assertEquals;
19 import static org.junit.Assert.assertFalse;
20 import static org.junit.Assert.assertNull;
22 import java.io.IOException;
24 import org.junit.Before;
25 import org.junit.Test;
27 import com.vaadin.testbench.elements.NotificationElement;
28 import com.vaadin.tests.components.grid.basicfeatures.EscalatorBasicClientFeaturesTest;
30 public class EscalatorBasicsTest extends EscalatorBasicClientFeaturesTest {
39 public void testDetachingAnEmptyEscalator() {
40 selectMenuPath(GENERAL, DETACH_ESCALATOR);
41 assertEscalatorIsRemovedCorrectly();
45 public void testDetachingASemiPopulatedEscalator() throws IOException {
46 selectMenuPath(COLUMNS_AND_ROWS, ADD_ONE_OF_EACH_ROW);
47 selectMenuPath(COLUMNS_AND_ROWS, COLUMNS, ADD_ONE_COLUMN_TO_BEGINNING);
48 selectMenuPath(GENERAL, DETACH_ESCALATOR);
49 assertEscalatorIsRemovedCorrectly();
53 public void testDetachingAPopulatedEscalator() {
54 selectMenuPath(GENERAL, POPULATE_COLUMN_ROW);
55 selectMenuPath(GENERAL, DETACH_ESCALATOR);
56 assertEscalatorIsRemovedCorrectly();
60 public void testDetachingAndReattachingAnEscalator() {
61 selectMenuPath(GENERAL, POPULATE_COLUMN_ROW);
63 scrollVerticallyTo(50);
64 scrollHorizontallyTo(50);
66 selectMenuPath(GENERAL, DETACH_ESCALATOR);
67 selectMenuPath(GENERAL, ATTACH_ESCALATOR);
69 assertEquals("Vertical scroll position", 50, getScrollTop());
70 assertEquals("Horizontal scroll position", 50, getScrollLeft());
72 assertEquals("First cell of first visible row", "Row 2: 0,2",
73 getBodyCell(0, 0).getText());
76 private void assertEscalatorIsRemovedCorrectly() {
77 assertFalse($(NotificationElement.class).exists());
78 assertNull(getEscalator());