diff options
author | Anastasia Smirnova <anasmi@utu.fi> | 2018-03-13 03:19:37 -1200 |
---|---|---|
committer | Ilia Motornyi <elmot@vaadin.com> | 2018-03-13 18:19:37 +0300 |
commit | dbba2f39980d753c208b72c83325fa18455cca61 (patch) | |
tree | 63e756574d23a3972ea343907b5f16c08c7047d6 /uitest | |
parent | d5ad32c20249f1eb91b5b7ad42ee770abf4c8803 (diff) | |
download | vaadin-framework-dbba2f39980d753c208b72c83325fa18455cca61.tar.gz vaadin-framework-dbba2f39980d753c208b72c83325fa18455cca61.zip |
Adding stylename to MenuBarItem also as one word (#10704)
Fixes #7912
Diffstat (limited to 'uitest')
-rw-r--r-- | uitest/src/main/java/com/vaadin/tests/components/menubar/MenuItemStyleAdd.java | 31 | ||||
-rw-r--r-- | uitest/src/test/java/com/vaadin/tests/components/menubar/MenuItemStyleAddTest.java | 38 |
2 files changed, 69 insertions, 0 deletions
diff --git a/uitest/src/main/java/com/vaadin/tests/components/menubar/MenuItemStyleAdd.java b/uitest/src/main/java/com/vaadin/tests/components/menubar/MenuItemStyleAdd.java new file mode 100644 index 0000000000..a0fe70c732 --- /dev/null +++ b/uitest/src/main/java/com/vaadin/tests/components/menubar/MenuItemStyleAdd.java @@ -0,0 +1,31 @@ +package com.vaadin.tests.components.menubar; + +import com.vaadin.annotations.Widgetset; +import com.vaadin.server.VaadinRequest; +import com.vaadin.tests.components.AbstractTestUI; +import com.vaadin.ui.MenuBar; + +@Widgetset("com.vaadin.DefaultWidgetSet") +public class MenuItemStyleAdd extends AbstractTestUI { + + @Override + protected void setup(VaadinRequest request) { + MenuBar barmenu = new MenuBar(); + MenuBar.MenuItem more = barmenu.addItem("More", null, null); + more.setStyleName("styleNameMore"); + barmenu.setMoreMenuItem(more); + + MenuBar.MenuItem drinks = barmenu.addItem("Drinks", null, null); + MenuBar.MenuItem hots = drinks.addItem("Hot", null, null); + hots.addItem("Tea", null); + hots.addItem("Coffee", null); + hots.setStyleName("styleTest"); + + MenuBar.MenuItem colds = drinks.addItem("Cold", null, null); + colds.addItem("Milk", null); + colds.addItem("Weissbier", null); + + addComponent(barmenu); + } + +} diff --git a/uitest/src/test/java/com/vaadin/tests/components/menubar/MenuItemStyleAddTest.java b/uitest/src/test/java/com/vaadin/tests/components/menubar/MenuItemStyleAddTest.java new file mode 100644 index 0000000000..79e390fcff --- /dev/null +++ b/uitest/src/test/java/com/vaadin/tests/components/menubar/MenuItemStyleAddTest.java @@ -0,0 +1,38 @@ +package com.vaadin.tests.components.menubar; + +import com.vaadin.testbench.By; +import com.vaadin.testbench.elements.MenuBarElement; +import com.vaadin.tests.tb3.MultiBrowserTest; +import org.junit.Test; +import org.openqa.selenium.WebElement; +import static org.junit.Assert.assertEquals; + +import java.util.List; + +public class MenuItemStyleAddTest extends MultiBrowserTest { + + @Test + public void testCustomStyleShouldStayAfterMenuSelect() { + openTestURL(); + + MenuBarElement menu = $(MenuBarElement.class).first(); + List<WebElement> elements = menu + .findElements(By.className("v-menubar-menuitem")); + WebElement more = elements.get(0); + assertEquals(true, + more.getAttribute("class") + .replaceAll("v-menubar-menuitem-styleNameMore", "") + .contains("styleNameMore")); + assertEquals(2, elements.size()); + menu.clickItem("Drinks"); + WebElement popup = getDriver() + .findElement(By.className("v-menubar-popup")); + List<WebElement> popupElCon = popup + .findElements(By.className("styleTest")); + assertEquals(1, popupElCon.size()); + assertEquals(true, + popupElCon.get(0).getAttribute("class") + .replaceAll("v-menubar-menuitem-styleTest", "") + .contains("styleTest")); + } +}
\ No newline at end of file |