diff options
author | Teemu Suo-Anttila <teemusa@vaadin.com> | 2015-05-18 10:22:15 +0300 |
---|---|---|
committer | Vaadin Code Review <review@vaadin.com> | 2015-05-18 08:02:45 +0000 |
commit | cffff983b45b16760ba1cbb7b48ecc13247f43fd (patch) | |
tree | bd9d8942295a3cbe08dc3ea904662c18d582337a /uitest/src | |
parent | 7c78d70f47a56df65a85d166e390083162c0285d (diff) | |
download | vaadin-framework-cffff983b45b16760ba1cbb7b48ecc13247f43fd.tar.gz vaadin-framework-cffff983b45b16760ba1cbb7b48ecc13247f43fd.zip |
Fix MenuItemStyleRemoved test UI to work with IE8
Change-Id: I0987168f4531b8b548dbde03afd99da363ae31d4
Diffstat (limited to 'uitest/src')
-rw-r--r-- | uitest/src/com/vaadin/tests/components/menubar/MenuItemStyleRemoved.java | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/uitest/src/com/vaadin/tests/components/menubar/MenuItemStyleRemoved.java b/uitest/src/com/vaadin/tests/components/menubar/MenuItemStyleRemoved.java index ea8bf5aec7..cf06836f94 100644 --- a/uitest/src/com/vaadin/tests/components/menubar/MenuItemStyleRemoved.java +++ b/uitest/src/com/vaadin/tests/components/menubar/MenuItemStyleRemoved.java @@ -1,6 +1,8 @@ package com.vaadin.tests.components.menubar; +import com.vaadin.server.Page; import com.vaadin.server.VaadinRequest; +import com.vaadin.server.WebBrowser; import com.vaadin.tests.components.AbstractTestUI; import com.vaadin.ui.Button; import com.vaadin.ui.JavaScript; @@ -8,6 +10,8 @@ import com.vaadin.ui.MenuBar; public class MenuItemStyleRemoved extends AbstractTestUI { + protected static final String MENUITEM_CLASS = "v-menubar-menuitem"; + @Override protected void setup(VaadinRequest request) { MenuBar menuBar = new MenuBar(); @@ -23,10 +27,17 @@ public class MenuItemStyleRemoved extends AbstractTestUI { addButton("Add styles", new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { + String method = "getElementsByClassName('" + MENUITEM_CLASS + + "')"; + WebBrowser webBrowser = Page.getCurrent().getWebBrowser(); + if (webBrowser.isIE() + && webBrowser.getBrowserMajorVersion() == 8) { + method = "querySelectorAll('." + MENUITEM_CLASS + "')"; + } 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'};"); + "var x=document." + method + ";" + + " var i; for(i=0; i < x.length; i++)" + + " {x[i].className += ' custom-menu-item'};"); } }); } |