diff options
author | Teemu Suo-Anttila <teemusa@vaadin.com> | 2015-05-18 10:22:15 +0300 |
---|---|---|
committer | Mika Murtojarvi <mika@vaadin.com> | 2015-05-25 13:34:46 +0300 |
commit | c8703cc12fe3f918fa4caaa39b419067b76024b1 (patch) | |
tree | c48c8577664268ade08e5e1f77dc00b1b9b18f43 | |
parent | 9d8eeef0e825824f69c5fac86bfa06c6f71bec02 (diff) | |
download | vaadin-framework-c8703cc12fe3f918fa4caaa39b419067b76024b1.tar.gz vaadin-framework-c8703cc12fe3f918fa4caaa39b419067b76024b1.zip |
Fix MenuItemStyleRemoved test UI to work with IE8
Change-Id: Id6db65290caacce1ef32293bc76142d5c6c93f63
-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'};"); } }); } |