]> source.dussan.org Git - vaadin-framework.git/commitdiff
Add opacity filter for disabled menubar item. (#15381)
authorSauli Tähkäpää <sauli@vaadin.com>
Sat, 20 Dec 2014 21:53:54 +0000 (23:53 +0200)
committerPekka Hyvönen <pekka@vaadin.com>
Thu, 7 May 2015 09:58:00 +0000 (12:58 +0300)
Change-Id: I457becda9b8741b0b0f85d8985581a2039fa7304

WebContent/VAADIN/themes/base/menubar/menubar.scss
uitest/src/com/vaadin/tests/themes/base/DisabledMenuBarItem.java [new file with mode: 0644]
uitest/src/com/vaadin/tests/themes/base/DisabledMenuBarItemTest.java [new file with mode: 0644]

index b5f0752c9bf7b98f422bf7f01e4b41519d8346a3..5ffac6de098445744858ca01ed0ae7cb9850f9d8 100644 (file)
@@ -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 (file)
index 0000000..825f267
--- /dev/null
@@ -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 (file)
index 0000000..0a10a7f
--- /dev/null
@@ -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