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.server;
18 import static org.junit.Assert.assertEquals;
19 import static org.junit.Assert.assertTrue;
21 import org.junit.Test;
23 import com.vaadin.testbench.elements.ButtonElement;
24 import com.vaadin.testbench.elements.NotificationElement;
25 import com.vaadin.tests.components.grid.basicfeatures.GridBasicFeaturesTest;
27 public class GridStaticSectionComponentTest extends GridBasicFeaturesTest {
30 public void testNativeButtonInHeader() throws Exception {
33 selectMenuPath("Component", "Columns", "Column 1", "Header Type",
36 getGridElement().$(ButtonElement.class).first().click();
38 assertTrue("Button click should be logged",
39 logContainsText("Button clicked!"));
43 public void testNativeButtonInFooter() throws Exception {
46 selectMenuPath("Component", "Footer", "Visible");
47 selectMenuPath("Component", "Footer", "Append row");
48 selectMenuPath("Component", "Columns", "Column 1", "Footer Type",
51 getGridElement().$(ButtonElement.class).first().click();
53 assertTrue("Button click should be logged",
54 logContainsText("Button clicked!"));
58 public void testRemoveComponentFromHeader() throws Exception {
60 selectMenuPath("Component", "Columns", "Column 1", "Header Type",
62 selectMenuPath("Component", "Columns", "Column 1", "Header Type",
64 assertTrue("No notifications should've been shown",
65 !$(NotificationElement.class).exists());
66 assertEquals("Header should've been reverted back to text header",
68 getGridElement().getHeaderCell(0, 1).getText().toLowerCase());