diff options
author | Denis Anisimov <denis@vaadin.com> | 2015-03-13 10:52:35 +0200 |
---|---|---|
committer | Vaadin Code Review <review@vaadin.com> | 2015-04-10 12:21:49 +0000 |
commit | 4217d7bbc8552e822367fac9d7d3cc9ee48821dd (patch) | |
tree | a037cd500937e4b55d0b42d92d18e8f6d5905927 /uitest/src/com/vaadin/tests/components | |
parent | 7afa802ba1260105493eda183cae58069c2b7a92 (diff) | |
download | vaadin-framework-4217d7bbc8552e822367fac9d7d3cc9ee48821dd.tar.gz vaadin-framework-4217d7bbc8552e822367fac9d7d3cc9ee48821dd.zip |
Don't use !important for ColorPicker width in Valo (#17140).
Change-Id: I47feff9c78a39e30233f388b938c7e4e53b52051
Diffstat (limited to 'uitest/src/com/vaadin/tests/components')
-rw-r--r-- | uitest/src/com/vaadin/tests/components/colorpicker/DefaultCaptionWidth.java | 72 | ||||
-rw-r--r-- | uitest/src/com/vaadin/tests/components/colorpicker/DefaultCaptionWidthTest.java | 67 |
2 files changed, 139 insertions, 0 deletions
diff --git a/uitest/src/com/vaadin/tests/components/colorpicker/DefaultCaptionWidth.java b/uitest/src/com/vaadin/tests/components/colorpicker/DefaultCaptionWidth.java new file mode 100644 index 0000000000..d3dd0aeccc --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/colorpicker/DefaultCaptionWidth.java @@ -0,0 +1,72 @@ +/* + * Copyright 2000-2014 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.vaadin.tests.components.colorpicker; + +import com.vaadin.server.VaadinRequest; +import com.vaadin.tests.components.AbstractTestUI; +import com.vaadin.ui.Button; +import com.vaadin.ui.Button.ClickEvent; +import com.vaadin.ui.ColorPicker; + +/** + * Test for color picker with default caption. + * + * @author Vaadin Ltd + */ +public class DefaultCaptionWidth extends AbstractTestUI { + + @Override + protected void setup(VaadinRequest request) { + final ColorPicker colorPicker = new ColorPicker(); + addComponent(colorPicker); + colorPicker.setDefaultCaptionEnabled(true); + + Button setWidth = new Button("Set explicit width", + new Button.ClickListener() { + + @Override + public void buttonClick(ClickEvent event) { + colorPicker.setCaption(null); + colorPicker.setWidth("150px"); + } + }); + setWidth.addStyleName("set-width"); + addComponent(setWidth); + + Button setCaption = new Button("Set explicit caption", + new Button.ClickListener() { + + @Override + public void buttonClick(ClickEvent event) { + colorPicker.setCaption("caption"); + colorPicker.setWidthUndefined(); + } + }); + setCaption.addStyleName("set-caption"); + addComponent(setCaption); + + } + + @Override + protected String getTestDescription() { + return "Color picker with default caption enabled should get appropriate style"; + } + + @Override + protected Integer getTicketNumber() { + return 17140; + } +} diff --git a/uitest/src/com/vaadin/tests/components/colorpicker/DefaultCaptionWidthTest.java b/uitest/src/com/vaadin/tests/components/colorpicker/DefaultCaptionWidthTest.java new file mode 100644 index 0000000000..78b7120b4e --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/colorpicker/DefaultCaptionWidthTest.java @@ -0,0 +1,67 @@ +/* + * Copyright 2000-2014 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.vaadin.tests.components.colorpicker; + +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; +import org.openqa.selenium.By; + +import com.vaadin.testbench.elements.ColorPickerElement; +import com.vaadin.tests.tb3.MultiBrowserTest; + +/** + * Test for default caption behavior in color picker. + * + * @author Vaadin Ltd + */ +public class DefaultCaptionWidthTest extends MultiBrowserTest { + + @Before + public void setUp() { + openTestURL(); + } + + @Test + public void setDefaultCaption_sizeAndCaptionAreNotSet_pickerGetsStyle() { + checkStylePresence(true); + } + + @Test + public void setDefaultCaption_explicitSizeIsSet_pickerNoCaptionStyle() { + findElement(By.className("set-width")).click(); + checkStylePresence(false); + } + + @Test + public void setDefaultCaption_explicitCaptionIsSet_pickerNoCaptionStyle() { + findElement(By.className("set-caption")).click(); + checkStylePresence(false); + } + + protected void checkStylePresence(boolean expectedStyle) { + String clazz = $(ColorPickerElement.class).first() + .getAttribute("class"); + if (expectedStyle) { + Assert.assertTrue("Default caption style is not found", + clazz.contains("v-default-caption-width")); + } else { + Assert.assertFalse("Found unexpected default caption style", + clazz.contains("v-default-caption-width")); + } + } + +} |