diff options
author | Sauli Tähkäpää <sauli@vaadin.com> | 2015-01-17 21:34:21 +0200 |
---|---|---|
committer | Sauli Tähkäpää <sauli@vaadin.com> | 2015-01-21 11:04:18 +0200 |
commit | c5d3b8b35b64c92be11f7b0fb964b64c75db79d9 (patch) | |
tree | 17b17042bda0f74d08ed03ca57f918dc1e547b6a | |
parent | 6cf7199173984b16c43c0c1a47cc196e9e982e06 (diff) | |
download | vaadin-framework-c5d3b8b35b64c92be11f7b0fb964b64c75db79d9.tar.gz vaadin-framework-c5d3b8b35b64c92be11f7b0fb964b64c75db79d9.zip |
Hide input field from clicking for immediate upload in Valo. (#15404)
Change-Id: I69bcd7b1d610d0e9adb6ce43e06591a769bef957
-rw-r--r-- | WebContent/VAADIN/themes/valo/components/_upload.scss | 2 | ||||
-rw-r--r-- | uitest/src/com/vaadin/tests/themes/valo/ImmediateUploadTest.java | 72 |
2 files changed, 50 insertions, 24 deletions
diff --git a/WebContent/VAADIN/themes/valo/components/_upload.scss b/WebContent/VAADIN/themes/valo/components/_upload.scss index 07a51f03ef..1616e80563 100644 --- a/WebContent/VAADIN/themes/valo/components/_upload.scss +++ b/WebContent/VAADIN/themes/valo/components/_upload.scss @@ -16,7 +16,7 @@ .#{$primary-stylename}-immediate input[type="file"] { @include opacity(0); - z-index: 2; + z-index: -1; position: absolute; right: 0; height: $v-unit-size; diff --git a/uitest/src/com/vaadin/tests/themes/valo/ImmediateUploadTest.java b/uitest/src/com/vaadin/tests/themes/valo/ImmediateUploadTest.java index 044f76e335..87827b1358 100644 --- a/uitest/src/com/vaadin/tests/themes/valo/ImmediateUploadTest.java +++ b/uitest/src/com/vaadin/tests/themes/valo/ImmediateUploadTest.java @@ -15,9 +15,10 @@ */ package com.vaadin.tests.themes.valo; -import static org.hamcrest.Matchers.equalToIgnoringCase; +import static org.hamcrest.CoreMatchers.is; import static org.junit.Assert.assertThat; +import java.io.IOException; import java.util.List; import org.junit.Test; @@ -40,34 +41,59 @@ public class ImmediateUploadTest extends MultiBrowserTest { return getAllBrowsers(); } - @Test - public void fileInputShouldNotBeVisibleInImmediate() - throws InterruptedException { + @Override + public void setup() throws Exception { + super.setup(); openTestURL(); + } + + private WebElement getUploadButton(String id) { + UploadElement normalUpload = $(UploadElement.class).id(id); + + return normalUpload.findElement(By.tagName("div")); + } + + private WebElement getUploadFileInput(String id) { + UploadElement normalUpload = $(UploadElement.class).id(id); + + return normalUpload.findElement(By.cssSelector("input[type='file']")); + } + + @Test + public void normalUploadButtonIsVisible() { + WebElement button = getUploadButton("upload"); - UploadElement normalUpload = $(UploadElement.class).id("upload"); - UploadElement immediateUpload = $(UploadElement.class).id( - "immediateupload"); + assertThat(button.getCssValue("display"), is("block")); + } + + @Test + public void fileInputIsVisibleForNormalUpload() { + WebElement input = getUploadFileInput("upload"); - WebElement normalUploadInput = normalUpload.findElement(By - .cssSelector("input[type='file']")); - WebElement immediateUploadInput = immediateUpload.findElement(By - .cssSelector("input[type='file']")); + assertThat(input.getCssValue("position"), is("static")); + } - WebElement normalUploadButton = normalUpload.findElement(By - .tagName("div")); - WebElement immediateUploadButton = immediateUpload.findElement(By - .tagName("div")); + @Test + public void immediateUploadButtonIsVisible() { + WebElement button = getUploadButton("immediateupload"); - assertThat(normalUploadButton.getCssValue("display"), - equalToIgnoringCase("block")); - assertThat(immediateUploadButton.getCssValue("display"), - equalToIgnoringCase("block")); + assertThat(button.getCssValue("display"), is("block")); + } - assertThat(normalUploadInput.getCssValue("position"), - equalToIgnoringCase("static")); - assertThat(immediateUploadInput.getCssValue("position"), - equalToIgnoringCase("absolute")); + @Test + public void fileInputIsNotVisibleForImmediateUpload() { + WebElement input = getUploadFileInput("immediateupload"); + + assertThat(input.getCssValue("position"), is("absolute")); + } + + @Test + public void fileInputIsNotClickableForImmediateUpload() throws IOException { + WebElement input = getUploadFileInput("immediateupload"); + // input.click() and then verifying if the upload window is opened + // would be better but couldn't figure a way to do that. screenshots + // don't show the upload window, not at least in firefox. + assertThat(input.getCssValue("z-index"), is("-1")); } } |