aboutsummaryrefslogtreecommitdiffstats
path: root/uitest/src/test/java/com/vaadin/tests/components/table/OnlyCollapsibleInMenu.java
blob: b6cf1b835f2525423b95280340d63da8913c573c (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
package com.vaadin.tests.components.table;

import static org.junit.Assert.assertEquals;

import org.junit.Test;

import com.vaadin.testbench.elements.TableElement;
import com.vaadin.tests.tb3.SingleBrowserTest;
import com.vaadin.v7.shared.ui.table.CollapseMenuContent;

public class OnlyCollapsibleInMenu extends SingleBrowserTest {

    @Override
    protected Class<?> getUIClass() {
        return Tables.class;
    }

    @Test
    public void testOnlyCollapsibleInMenu() {
        openTestURL();
        TableElement table = $(TableElement.class).first();

        selectMenuPath("Component", "Columns", "Property 3", "Collapsible");
        table.getCollapseMenuToggle().click();
        assertEquals("Property 3 should still be in the context menu",
                "Property 3", table.getContextMenu().getItem(2).getText());

        selectMenuPath("Component", "Features", "Collapsible menu content",
                CollapseMenuContent.COLLAPSIBLE_COLUMNS.toString());
        table.getCollapseMenuToggle().click();
        assertEquals("Property 3 should not be in the context menu",
                "Property 4", table.getContextMenu().getItem(2).getText());

        selectMenuPath("Component", "Features", "Collapsible menu content",
                CollapseMenuContent.ALL_COLUMNS.toString());
        table.getCollapseMenuToggle().click();
        assertEquals("Property 3 should again  be in the context menu",
                "Property 3", table.getContextMenu().getItem(2).getText());
    }

}