summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordenis.magdenkov <denis.magdenkov@arcadia.spb.ru>2014-10-01 17:50:30 +0400
committerVaadin Code Review <review@vaadin.com>2014-10-23 12:29:48 +0000
commit949215f3d89485d02a57bebdd45d7ea2904e28e1 (patch)
tree061ff43ea975af72b0bce53ff0371acfecb69a1b
parent98a6367842b34f9de56fc19d41dfbbe079c248c1 (diff)
downloadvaadin-framework-949215f3d89485d02a57bebdd45d7ea2904e28e1.tar.gz
vaadin-framework-949215f3d89485d02a57bebdd45d7ea2904e28e1.zip
Fix button on immediate upload does not obey setWidth() (#14485)
Added sass selector for upload in base theme. Change-Id: Iebf796f0965de6afeac98d6e2a2a9246c9251bab
-rw-r--r--WebContent/VAADIN/themes/base/upload/upload.scss3
-rw-r--r--uitest/src/com/vaadin/tests/components/upload/UploadImmediateButtonWidth.java55
-rw-r--r--uitest/src/com/vaadin/tests/components/upload/UploadImmediateButtonWidthTest.java47
3 files changed, 105 insertions, 0 deletions
diff --git a/WebContent/VAADIN/themes/base/upload/upload.scss b/WebContent/VAADIN/themes/base/upload/upload.scss
index 933482764c..e705fc1c78 100644
--- a/WebContent/VAADIN/themes/base/upload/upload.scss
+++ b/WebContent/VAADIN/themes/base/upload/upload.scss
@@ -9,6 +9,9 @@
position: relative;
margin: 0;
overflow: hidden;
+ .v-button{
+ width:100%;
+ }
}
.v-ff & .#{$primaryStyleName}-immediate,
diff --git a/uitest/src/com/vaadin/tests/components/upload/UploadImmediateButtonWidth.java b/uitest/src/com/vaadin/tests/components/upload/UploadImmediateButtonWidth.java
new file mode 100644
index 0000000000..b0314e9907
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/upload/UploadImmediateButtonWidth.java
@@ -0,0 +1,55 @@
+/*
+ * 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.upload;
+
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.tests.components.AbstractTestUI;
+import com.vaadin.ui.Upload;
+import com.vaadin.ui.VerticalLayout;
+
+public class UploadImmediateButtonWidth extends AbstractTestUI {
+
+ @Override
+ protected void setup(VaadinRequest request) {
+ VerticalLayout lt = new VerticalLayout();
+ lt.setWidth("500px");
+
+ Upload upload1 = new Upload();
+ upload1.setImmediate(true);
+ upload1.setId("upload1");
+ upload1.setWidth("300px");
+ lt.addComponent(upload1);
+
+ Upload upload2 = new Upload();
+ upload2.setImmediate(true);
+ upload2.setWidth("50%");
+ upload2.setId("upload2");
+ lt.addComponent(upload2);
+
+ addComponent(lt);
+ }
+
+ @Override
+ protected String getTestDescription() {
+ return "Width of immediate upload button should obey setWidth()";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 14485;
+ }
+
+}
diff --git a/uitest/src/com/vaadin/tests/components/upload/UploadImmediateButtonWidthTest.java b/uitest/src/com/vaadin/tests/components/upload/UploadImmediateButtonWidthTest.java
new file mode 100644
index 0000000000..37dcb47929
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/upload/UploadImmediateButtonWidthTest.java
@@ -0,0 +1,47 @@
+/*
+ * 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.upload;
+
+import static org.junit.Assert.assertEquals;
+
+import org.junit.Test;
+import org.openqa.selenium.WebElement;
+
+import com.vaadin.testbench.By;
+import com.vaadin.tests.tb3.MultiBrowserTest;
+
+public class UploadImmediateButtonWidthTest extends MultiBrowserTest {
+
+ private void checkButtonWidth(String id, int expectedWidth) {
+ WebElement upload = driver.findElement(By.id(id));
+ WebElement button = upload.findElement(By.className("v-button"));
+ assertEquals("width of button " + id + " is incorrect", expectedWidth,
+ button.getSize().getWidth());
+ }
+
+ @Test
+ public void buttonWithPixelWidth() {
+ openTestURL();
+ checkButtonWidth("upload1", 300);
+ }
+
+ @Test
+ public void buttonWithPercentageWidth() {
+ openTestURL();
+ checkButtonWidth("upload2", 250);
+ }
+
+}