diff options
author | Sauli Tähkäpää <sauli@vaadin.com> | 2014-12-20 23:53:54 +0200 |
---|---|---|
committer | Pekka Hyvönen <pekka@vaadin.com> | 2015-05-07 12:58:00 +0300 |
commit | 4eb495cac3f006b9f1aa525f04025401734a3550 (patch) | |
tree | 73f31d06444093a3eaa8c6d146b01c4605063cca /uitest | |
parent | b22cf5257b9b890d5d529fa091d1bd3e67bbf43d (diff) | |
download | vaadin-framework-4eb495cac3f006b9f1aa525f04025401734a3550.tar.gz vaadin-framework-4eb495cac3f006b9f1aa525f04025401734a3550.zip |
Add opacity filter for disabled menubar item. (#15381)
Change-Id: I457becda9b8741b0b0f85d8985581a2039fa7304
Diffstat (limited to 'uitest')
-rw-r--r-- | uitest/src/com/vaadin/tests/themes/base/DisabledMenuBarItem.java | 29 | ||||
-rw-r--r-- | uitest/src/com/vaadin/tests/themes/base/DisabledMenuBarItemTest.java | 36 |
2 files changed, 65 insertions, 0 deletions
diff --git a/uitest/src/com/vaadin/tests/themes/base/DisabledMenuBarItem.java b/uitest/src/com/vaadin/tests/themes/base/DisabledMenuBarItem.java new file mode 100644 index 0000000000..825f267ad3 --- /dev/null +++ b/uitest/src/com/vaadin/tests/themes/base/DisabledMenuBarItem.java @@ -0,0 +1,29 @@ +package com.vaadin.tests.themes.base; + +import com.vaadin.server.ThemeResource; +import com.vaadin.server.VaadinRequest; +import com.vaadin.tests.components.AbstractTestUI; +import com.vaadin.ui.MenuBar; + +public class DisabledMenuBarItem extends AbstractTestUI { + @Override + protected void setup(VaadinRequest request) { + MenuBar menubar = new MenuBar(); + + MenuBar.MenuItem item = menubar.addItem("Item", null); + item.setEnabled(false); + item.setIcon(new ThemeResource("just_a_placeholder.png")); + + addComponent(menubar); + } + + @Override + protected String getTestDescription() { + return "Image icon should be greyed out."; + } + + @Override + protected Integer getTicketNumber() { + return 15381; + } +} diff --git a/uitest/src/com/vaadin/tests/themes/base/DisabledMenuBarItemTest.java b/uitest/src/com/vaadin/tests/themes/base/DisabledMenuBarItemTest.java new file mode 100644 index 0000000000..0a10a7f38b --- /dev/null +++ b/uitest/src/com/vaadin/tests/themes/base/DisabledMenuBarItemTest.java @@ -0,0 +1,36 @@ +package com.vaadin.tests.themes.base; + +import static org.hamcrest.CoreMatchers.is; +import static org.junit.Assert.assertThat; + +import org.junit.Test; +import org.openqa.selenium.WebElement; + +import com.vaadin.testbench.By; +import com.vaadin.testbench.parallel.Browser; +import com.vaadin.tests.tb3.MultiBrowserTest; + +public class DisabledMenuBarItemTest extends MultiBrowserTest { + + @Test + public void disabledMenuItemShouldHaveOpacity() { + openTestURL(); + + WebElement element = driver.findElement(By + .className("v-menubar-menuitem-disabled")); + + assertThat(element.getCssValue("opacity"), is("0.5")); + + if (browserIsIE8or9()) { + assertThat(element.getCssValue("filter"), is("alpha(opacity=50)")); + + } + } + + private boolean browserIsIE8or9() { + return Browser.IE8.getDesiredCapabilities().equals( + getDesiredCapabilities()) + || Browser.IE9.getDesiredCapabilities().equals( + getDesiredCapabilities()); + } +}
\ No newline at end of file |