summaryrefslogtreecommitdiffstats
path: root/uitest/src/com/vaadin/tests
diff options
context:
space:
mode:
authorAlexey Fansky <alexey.fansky@effective-soft.com>2015-04-15 12:12:11 -0700
committerTeemu Suo-Anttila <teemusa@vaadin.com>2015-04-27 13:49:56 +0300
commit438c4d3af4988ddefdd040ff991d46617a54771a (patch)
tree0fa6f971903e4f491d41e97cfdc23d104d609cae /uitest/src/com/vaadin/tests
parentddd804369cf155c45c90e7e790b06d0289fdead5 (diff)
downloadvaadin-framework-438c4d3af4988ddefdd040ff991d46617a54771a.tar.gz
vaadin-framework-438c4d3af4988ddefdd040ff991d46617a54771a.zip
Keeping MenuItem custom classes when updating styles (#17427)
Change-Id: I54b7e700148797f0145c4ec5f1802ea999142ab3
Diffstat (limited to 'uitest/src/com/vaadin/tests')
-rw-r--r--uitest/src/com/vaadin/tests/components/menubar/MenuItemStyleRemoved.java43
-rw-r--r--uitest/src/com/vaadin/tests/components/menubar/MenuItemStyleRemovedTest.java30
2 files changed, 73 insertions, 0 deletions
diff --git a/uitest/src/com/vaadin/tests/components/menubar/MenuItemStyleRemoved.java b/uitest/src/com/vaadin/tests/components/menubar/MenuItemStyleRemoved.java
new file mode 100644
index 0000000000..ea8bf5aec7
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/menubar/MenuItemStyleRemoved.java
@@ -0,0 +1,43 @@
+package com.vaadin.tests.components.menubar;
+
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.tests.components.AbstractTestUI;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.JavaScript;
+import com.vaadin.ui.MenuBar;
+
+public class MenuItemStyleRemoved extends AbstractTestUI {
+
+ @Override
+ protected void setup(VaadinRequest request) {
+ MenuBar menuBar = new MenuBar();
+
+ MenuBar.MenuItem first = menuBar.addItem("first", null, null);
+ first.addItem("first sub-item 1", null, null);
+ first.addItem("first sub-item 2", null, null);
+ MenuBar.MenuItem second = menuBar.addItem("second", null, null);
+ second.addItem("second sub-item 2", null, null);
+ second.addItem("second sub-item 2", null, null);
+
+ addComponent(menuBar);
+ addButton("Add styles", new Button.ClickListener() {
+ @Override
+ public void buttonClick(Button.ClickEvent event) {
+ JavaScript.getCurrent().execute(
+ "var x=document.getElementsByClassName('v-menubar-menuitem');" +
+ " var i; for(i=0; i < x.length; i++)" +
+ " {x[i].className += ' custom-menu-item'};");
+ }
+ });
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 17242;
+ }
+
+ @Override
+ public String getDescription() {
+ return "MenuItem's custom class names removed when hovering";
+ }
+}
diff --git a/uitest/src/com/vaadin/tests/components/menubar/MenuItemStyleRemovedTest.java b/uitest/src/com/vaadin/tests/components/menubar/MenuItemStyleRemovedTest.java
new file mode 100644
index 0000000000..2ba63587fe
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/menubar/MenuItemStyleRemovedTest.java
@@ -0,0 +1,30 @@
+package com.vaadin.tests.components.menubar;
+
+import com.vaadin.testbench.By;
+import com.vaadin.testbench.elements.ButtonElement;
+import com.vaadin.testbench.elements.MenuBarElement;
+import com.vaadin.tests.tb3.MultiBrowserTest;
+import org.junit.Assert;
+import org.junit.Test;
+import org.openqa.selenium.WebElement;
+
+import java.util.List;
+
+public class MenuItemStyleRemovedTest extends MultiBrowserTest {
+
+ @Test
+ public void testCustomStyleShouldStayAfterMenuSelect() {
+ openTestURL();
+
+ $(ButtonElement.class).caption("Add styles").first().click();
+
+ MenuBarElement menu = $(MenuBarElement.class).first();
+ List<WebElement> elements = menu.findElements(By.className("custom-menu-item"));
+ Assert.assertEquals(2, elements.size());
+
+ menu.clickItem("first");
+ menu.clickItem("second");
+ elements = menu.findElements(By.className("custom-menu-item"));
+ Assert.assertEquals(2, elements.size());
+ }
+}