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 | |
parent | b22cf5257b9b890d5d529fa091d1bd3e67bbf43d (diff) | |
download | vaadin-framework-4eb495cac3f006b9f1aa525f04025401734a3550.tar.gz vaadin-framework-4eb495cac3f006b9f1aa525f04025401734a3550.zip |
Add opacity filter for disabled menubar item. (#15381)
Change-Id: I457becda9b8741b0b0f85d8985581a2039fa7304
3 files changed, 67 insertions, 1 deletions
diff --git a/WebContent/VAADIN/themes/base/menubar/menubar.scss b/WebContent/VAADIN/themes/base/menubar/menubar.scss index b5f0752c9b..5ffac6de09 100644 --- a/WebContent/VAADIN/themes/base/menubar/menubar.scss +++ b/WebContent/VAADIN/themes/base/menubar/menubar.scss @@ -54,7 +54,8 @@ .#{$primaryStyleName} span.#{$primaryStyleName}-menuitem-disabled:hover, .#{$primaryStyleName} span.#{$primaryStyleName}-menuitem-disabled:focus, .#{$primaryStyleName} span.#{$primaryStyleName}-menuitem-disabled:active { - color: #999; + opacity: .5; + filter: alpha(opacity=50); } .#{$primaryStyleName}-more-menuitem { /* Arial has the most coverage for geometric entity characters */ 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 |