diff options
author | Artur Signell <artur@vaadin.com> | 2015-01-21 20:59:32 +0200 |
---|---|---|
committer | Artur Signell <artur@vaadin.com> | 2015-01-21 20:59:32 +0200 |
commit | c410fa7e85e0769369cee2cebd2cea538919af2b (patch) | |
tree | c7535bd48ae9c2b221a867e47f91515e1bbc2ffa | |
parent | 74976a7ffcdd4ea3c19e799d16bf5430c6975420 (diff) | |
parent | f818f7cb44fc77db7252e97c78608ae6c67d6ab6 (diff) | |
download | vaadin-framework-c410fa7e85e0769369cee2cebd2cea538919af2b.tar.gz vaadin-framework-c410fa7e85e0769369cee2cebd2cea538919af2b.zip |
Merge remote-tracking branch 'origin/master' into grid
Conflicts:
client/src/com/vaadin/client/ui/VScrollTable.java
Change-Id: I79e003b2087e8e0e5c8aa6d25bdeb890ce9a60c5
34 files changed, 1492 insertions, 134 deletions
diff --git a/WebContent/VAADIN/themes/tests-components/images/logo.png b/WebContent/VAADIN/themes/tests-components/images/logo.png Binary files differnew file mode 100644 index 0000000000..9990cd2f28 --- /dev/null +++ b/WebContent/VAADIN/themes/tests-components/images/logo.png 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/client/src/com/vaadin/client/ui/VScrollTable.java b/client/src/com/vaadin/client/ui/VScrollTable.java index a6dcc85130..4c6fc8874c 100644 --- a/client/src/com/vaadin/client/ui/VScrollTable.java +++ b/client/src/com/vaadin/client/ui/VScrollTable.java @@ -6896,7 +6896,16 @@ public class VScrollTable extends FlowPanel implements HasWidgets, * visibleCellCount; if (willHaveScrollbars()) { totalExtraWidth += WidgetUtil.getNativeScrollbarSize(); + // if there will be vertical scrollbar, let's enable it + scrollBodyPanel.getElement().getStyle().clearOverflowY(); + } else { + // if there is no need for vertical scrollbar, let's disable it + // this is necessary since sometimes the browsers insist showing + // the scrollbar even if the content would fit perfectly + scrollBodyPanel.getElement().getStyle() + .setOverflowY(Overflow.HIDDEN); } + availW -= totalExtraWidth; int forceScrollBodyWidth = -1; @@ -6914,6 +6923,15 @@ public class VScrollTable extends FlowPanel implements HasWidgets, forceScrollBodyWidth = usedMinimumWidth + totalExtraWidth; } extraSpace = 0; + // if there will be horizontal scrollbar, let's enable it + scrollBodyPanel.getElement().getStyle().clearOverflowX(); + } else { + // if there is no need for horizontal scrollbar, let's disable + // it + // this is necessary since sometimes the browsers insist showing + // the scrollbar even if the content would fit perfectly + scrollBodyPanel.getElement().getStyle() + .setOverflowX(Overflow.HIDDEN); } if (forceScrollBodyWidth > 0) { diff --git a/client/src/com/vaadin/client/ui/embedded/EmbeddedConnector.java b/client/src/com/vaadin/client/ui/embedded/EmbeddedConnector.java index cd4c79ccc6..38995cf800 100644 --- a/client/src/com/vaadin/client/ui/embedded/EmbeddedConnector.java +++ b/client/src/com/vaadin/client/ui/embedded/EmbeddedConnector.java @@ -32,6 +32,7 @@ import com.vaadin.client.Paintable; import com.vaadin.client.UIDL; import com.vaadin.client.VConsole; import com.vaadin.client.VTooltip; +import com.vaadin.client.communication.StateChangeEvent; import com.vaadin.client.ui.AbstractComponentConnector; import com.vaadin.client.ui.ClickEventHandler; import com.vaadin.client.ui.VEmbedded; @@ -46,12 +47,45 @@ import com.vaadin.ui.Embedded; public class EmbeddedConnector extends AbstractComponentConnector implements Paintable { + private Element resourceElement; + private ObjectElement objectElement; + private String resourceUrl; + @Override protected void init() { super.init(); } @Override + public void onStateChanged(StateChangeEvent stateChangeEvent) { + super.onStateChanged(stateChangeEvent); + // if theme has changed the resourceUrl may need to be updated + updateResourceIfNecessary(); + } + + private void updateResourceIfNecessary() { + if (resourceElement != null || objectElement != null) { + String src = getResourceUrl("src"); + if (src != null && !src.isEmpty()) { + if (!src.equals(resourceUrl)) { + setResourceUrl(src); + } + } else if (resourceUrl != null && !resourceUrl.isEmpty()) { + setResourceUrl(""); + } + } + } + + private void setResourceUrl(String src) { + resourceUrl = src; + if (resourceElement != null) { + resourceElement.setAttribute("src", src); + } else if (objectElement != null) { + objectElement.setData(src); + } + } + + @Override public void updateFromUIDL(UIDL uidl, ApplicationConnection client) { if (!isRealUpdate(uidl)) { return; @@ -102,8 +136,9 @@ public class EmbeddedConnector extends AbstractComponentConnector implements style.setProperty("width", getState().width); style.setProperty("height", getState().height); - DOM.setElementProperty(el, "src", - getWidget().getSrc(uidl, client)); + resourceElement = el; + objectElement = null; + setResourceUrl(getResourceUrl("src")); if (uidl.hasAttribute(EmbeddedConstants.ALTERNATE_TEXT)) { el.setPropertyString( @@ -133,8 +168,9 @@ public class EmbeddedConnector extends AbstractComponentConnector implements getWidget().browserElement = DOM.getFirstChild(getWidget() .getElement()); } - DOM.setElementAttribute(getWidget().browserElement, "src", - getWidget().getSrc(uidl, client)); + resourceElement = getWidget().browserElement; + objectElement = null; + setResourceUrl(getResourceUrl("src")); clearBrowserElement = false; } else { VConsole.error("Unknown Embedded type '" + getWidget().type @@ -163,15 +199,19 @@ public class EmbeddedConnector extends AbstractComponentConnector implements getWidget().addStyleName(VEmbedded.CLASSNAME + "-svg"); String data; Map<String, String> parameters = VEmbedded.getParameters(uidl); + ObjectElement obj = Document.get().createObjectElement(); + resourceElement = null; if (parameters.get("data") == null) { - data = getWidget().getSrc(uidl, client); + objectElement = obj; + data = getResourceUrl("src"); + setResourceUrl(data); } else { + objectElement = null; data = "data:image/svg+xml," + parameters.get("data"); + obj.setData(data); } getWidget().setHTML(""); - ObjectElement obj = Document.get().createObjectElement(); obj.setType(mime); - obj.setData(data); if (!isUndefinedWidth()) { obj.getStyle().setProperty("width", "100%"); } diff --git a/client/src/com/vaadin/client/ui/textfield/TextFieldConnector.java b/client/src/com/vaadin/client/ui/textfield/TextFieldConnector.java index 1a4b64b0a6..0d85e98ee3 100644 --- a/client/src/com/vaadin/client/ui/textfield/TextFieldConnector.java +++ b/client/src/com/vaadin/client/ui/textfield/TextFieldConnector.java @@ -22,6 +22,7 @@ import com.google.gwt.user.client.Event; import com.vaadin.client.ApplicationConnection; import com.vaadin.client.Paintable; import com.vaadin.client.UIDL; +import com.vaadin.client.Util; import com.vaadin.client.ui.AbstractFieldConnector; import com.vaadin.client.ui.ShortcutActionHandler.BeforeShortcutActionListener; import com.vaadin.client.ui.VTextField; @@ -83,14 +84,15 @@ public class TextFieldConnector extends AbstractFieldConnector implements } /* * We skip the text content update if field has been repainted, but text - * has not been changed. Additional sanity check verifies there is no - * change in the queue (in which case we count more on the server side - * value). + * has not been changed (#6588). Additional sanity check verifies there + * is no change in the queue (in which case we count more on the server + * side value). <input> is updated only when it looses focus, so we + * force updating if not focused. Lost focus issue appeared in (#15144) */ - if (!(uidl - .getBooleanAttribute(TextFieldConstants.ATTR_NO_VALUE_CHANGE_BETWEEN_PAINTS) - && getWidget().valueBeforeEdit != null && text - .equals(getWidget().valueBeforeEdit))) { + if (!(Util.getFocusedElement() == getWidget().getElement()) + || !uidl.getBooleanAttribute(TextFieldConstants.ATTR_NO_VALUE_CHANGE_BETWEEN_PAINTS) + || getWidget().valueBeforeEdit == null + || !text.equals(getWidget().valueBeforeEdit)) { getWidget().updateFieldContent(text); } diff --git a/client/src/com/vaadin/client/ui/window/WindowConnector.java b/client/src/com/vaadin/client/ui/window/WindowConnector.java index b47152b903..5580793506 100644 --- a/client/src/com/vaadin/client/ui/window/WindowConnector.java +++ b/client/src/com/vaadin/client/ui/window/WindowConnector.java @@ -440,7 +440,6 @@ public class WindowConnector extends AbstractSingleComponentContainerConnector } } else if (state.windowMode == WindowMode.MAXIMIZED) { window.setPopupPositionNoUpdate(0, 0); - window.bringToFront(); } } @@ -469,6 +468,10 @@ public class WindowConnector extends AbstractSingleComponentContainerConnector state.windowMode = WindowMode.MAXIMIZED; } updateWindowMode(); + + VWindow window = getWidget(); + window.bringToFront(); + getRpcProxy(WindowServerRpc.class).windowModeChanged( state.windowMode); } diff --git a/server/src/com/vaadin/data/util/ContainerHierarchicalWrapper.java b/server/src/com/vaadin/data/util/ContainerHierarchicalWrapper.java index 0bfec33957..199d186fab 100644 --- a/server/src/com/vaadin/data/util/ContainerHierarchicalWrapper.java +++ b/server/src/com/vaadin/data/util/ContainerHierarchicalWrapper.java @@ -450,6 +450,8 @@ public class ContainerHierarchicalWrapper implements Container.Hierarchical, // Update parent parent.remove(itemId); + fireItemSetChangeIfAbstractContainer(); + return true; } @@ -490,10 +492,22 @@ public class ContainerHierarchicalWrapper implements Container.Hierarchical, } } + fireItemSetChangeIfAbstractContainer(); + return true; } /** + * inform container (if it is instance of AbstractContainer) about the + * change in hierarchy (#15421) + */ + private void fireItemSetChangeIfAbstractContainer() { + if (container instanceof AbstractContainer) { + ((AbstractContainer) container).fireItemSetChange(); + } + } + + /** * Creates a new Item into the Container, assigns it an automatic ID, and * adds it to the hierarchy. * diff --git a/server/src/com/vaadin/server/JsonCodec.java b/server/src/com/vaadin/server/JsonCodec.java index ec1ea10f2b..498bf3e6b2 100644 --- a/server/src/com/vaadin/server/JsonCodec.java +++ b/server/src/com/vaadin/server/JsonCodec.java @@ -757,7 +757,7 @@ public class JsonCodec implements Serializable { fieldType, connectorTracker); encoded.put(fieldName, encodeResult.getEncodedValue()); - if (!jsonEquals(encodeResult.getEncodedValue(), fieldReference)) { + if (valueChanged(encodeResult.getEncodedValue(), fieldReference)) { diff.put(fieldName, encodeResult.getDiffOrValue()); } } @@ -769,25 +769,101 @@ public class JsonCodec implements Serializable { } /** - * Compares the value with the reference. If they match, returns true. + * Compares the value with the reference. If they match, returns false. * * @param fieldValue * @param referenceValue * @return */ - private static boolean jsonEquals(JsonValue fieldValue, + private static boolean valueChanged(JsonValue fieldValue, JsonValue referenceValue) { if (fieldValue instanceof JsonNull) { fieldValue = null; } if (fieldValue == referenceValue) { - return true; - } else if (fieldValue == null || referenceValue == null) { return false; + } else if (fieldValue == null || referenceValue == null) { + return true; } else { - return fieldValue.jsEquals(referenceValue); + return !jsonEquals(fieldValue, referenceValue); + } + } + + /** + * Compares two json values for deep equality. + * + * This is a helper for overcoming the fact that + * {@link JsonValue#equals(Object)} only does an identity check and + * {@link JsonValue#jsEquals(JsonValue)} is defined to use JavaScript + * semantics where arrays and objects are equals only based on identity. + * + * @since + * @param a + * the first json value to check, may not be null + * @param b + * the second json value to check, may not be null + * @return <code>true</code> if both json values are the same; + * <code>false</code> otherwise + */ + public static boolean jsonEquals(JsonValue a, JsonValue b) { + assert a != null; + assert b != null; + + if (a == b) { + return true; + } + + JsonType type = a.getType(); + if (type != b.getType()) { + return false; + } + + switch (type) { + case NULL: + return true; + case BOOLEAN: + return a.asBoolean() == b.asBoolean(); + case NUMBER: + return a.asNumber() == b.asNumber(); + case STRING: + return a.asString().equals(b.asString()); + case OBJECT: + return jsonObjectEquals((JsonObject) a, (JsonObject) b); + case ARRAY: + return jsonArrayEquals((JsonArray) a, (JsonArray) b); + default: + throw new RuntimeException("Unsupported JsonType: " + type); + } + } + + private static boolean jsonObjectEquals(JsonObject a, JsonObject b) { + String[] keys = a.keys(); + + if (keys.length != b.keys().length) { + return false; + } + + for (String key : keys) { + JsonValue value = b.get(key); + if (value == null || !jsonEquals(a.get(key), value)) { + return false; + } + } + + return true; + } + + private static boolean jsonArrayEquals(JsonArray a, JsonArray b) { + if (a.length() != b.length()) { + return false; + } + for (int i = 0; i < a.length(); i++) { + if (!jsonEquals(a.get(i), b.get(i))) { + return false; + } } + return true; } private static JsonArray encodeArrayContents(Type componentType, diff --git a/server/src/com/vaadin/ui/Embedded.java b/server/src/com/vaadin/ui/Embedded.java index 1086da8d09..d83eef9c4d 100644 --- a/server/src/com/vaadin/ui/Embedded.java +++ b/server/src/com/vaadin/ui/Embedded.java @@ -79,11 +79,6 @@ public class Embedded extends AbstractComponent implements LegacyComponent { private int type = TYPE_OBJECT; /** - * Source of the embedded object. - */ - private Resource source = null; - - /** * Generic object attributes. */ private String mimeType = null; @@ -418,7 +413,7 @@ public class Embedded extends AbstractComponent implements LegacyComponent { * @return the Resource */ public Resource getSource() { - return source; + return getResource("src"); } /** @@ -445,8 +440,8 @@ public class Embedded extends AbstractComponent implements LegacyComponent { * the source to set. */ public void setSource(Resource source) { - if (source != null && !source.equals(this.source)) { - this.source = source; + if (source != null && !source.equals(getSource())) { + setResource("src", source); final String mt = source.getMIMEType(); if (mimeType == null) { diff --git a/server/tests/src/com/vaadin/server/JsonEqualsTest.java b/server/tests/src/com/vaadin/server/JsonEqualsTest.java new file mode 100644 index 0000000000..ca3bfced79 --- /dev/null +++ b/server/tests/src/com/vaadin/server/JsonEqualsTest.java @@ -0,0 +1,276 @@ +/* + * 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.server; + +import org.junit.Assert; +import org.junit.Test; + +import elemental.json.Json; +import elemental.json.JsonArray; +import elemental.json.JsonObject; +import elemental.json.JsonValue; + +public class JsonEqualsTest { + + @Test + public void differentTypes_notEqual() { + boolean equals = JsonCodec.jsonEquals(Json.create(5), Json.create("5")); + + Assert.assertFalse("Different types should not be equal", equals); + } + + @Test + public void nulls_equal() { + boolean equals = JsonCodec.jsonEquals(Json.createNull(), + Json.createNull()); + + Assert.assertTrue("Null and null should be equal", equals); + } + + @Test + public void differentBooleans_notEqual() { + boolean equals = JsonCodec.jsonEquals(Json.create(true), + Json.create(false)); + + Assert.assertFalse("Different booleans should not be equal", equals); + } + + @Test + public void sameBooleans_equal() { + boolean equals = JsonCodec.jsonEquals(Json.create(false), + Json.create(false)); + + Assert.assertTrue("Same booleans should be equal", equals); + } + + @Test + public void differentNumbers_notEqual() { + boolean equals = JsonCodec.jsonEquals(Json.create(2), Json.create(5.6)); + + Assert.assertFalse("Different numbers should not be equal", equals); + } + + @Test + public void sameNumbers_equal() { + boolean equals = JsonCodec.jsonEquals(Json.create(3.14), + Json.create(3.14)); + + Assert.assertTrue("Same numbers should be equal", equals); + } + + @Test + public void differentStrings_notEqual() { + boolean equals = JsonCodec.jsonEquals(Json.create("abc"), + Json.create("def")); + + Assert.assertFalse("Different strings should not be equal", equals); + } + + @Test + public void sameStrings_equal() { + boolean equals = JsonCodec.jsonEquals(Json.create("abc"), + Json.create("abc")); + + Assert.assertTrue("Same strings should be equal", equals); + } + + @Test + public void differentKeyCountObject_notEqual() { + JsonObject o1 = Json.createObject(); + o1.put("key", "value"); + + JsonObject o2 = Json.createObject(); + + boolean equals = JsonCodec.jsonEquals(o1, o2); + + Assert.assertFalse( + "Object with different key counts should not be equal", equals); + } + + @Test + public void differentKeySetObject_notEqual() { + JsonObject o1 = Json.createObject(); + o1.put("key", "value"); + + JsonObject o2 = Json.createObject(); + o2.put("key2", "value"); + + boolean equals = JsonCodec.jsonEquals(o1, o2); + + Assert.assertFalse("Object with different keys should not be equal", + equals); + } + + @Test + public void differentChildValuesObject_notEqual() { + JsonObject o1 = Json.createObject(); + o1.put("key", "value"); + + JsonObject o2 = Json.createObject(); + o2.put("key", true); + + boolean equals = JsonCodec.jsonEquals(o1, o2); + + Assert.assertFalse( + "Object with different child values should not be equal", + equals); + } + + @Test + public void emptyObjects_equal() { + JsonObject o1 = Json.createObject(); + JsonObject o2 = Json.createObject(); + + boolean equals = JsonCodec.jsonEquals(o1, o2); + + Assert.assertTrue("Empty objects should be equal", equals); + } + + @Test + public void sameObjects_equal() { + JsonObject o1 = Json.createObject(); + o1.put("key", "value"); + + JsonObject o2 = Json.createObject(); + o2.put("key", "value"); + + boolean equals = JsonCodec.jsonEquals(o1, o2); + + Assert.assertTrue("Same objects should be equal", equals); + } + + @Test + public void sameObjectsWithNullValues_equal() { + JsonObject o1 = Json.createObject(); + o1.put("key", Json.createNull()); + + JsonObject o2 = Json.createObject(); + o2.put("key", Json.createNull()); + + boolean equals = JsonCodec.jsonEquals(o1, o2); + + Assert.assertTrue("Same objects should be equal", equals); + } + + @Test + public void differentSizeArray_notEqual() { + JsonArray a1 = Json.createArray(); + a1.set(0, 0); + + JsonArray a2 = Json.createArray(); + + boolean equals = JsonCodec.jsonEquals(a1, a2); + + Assert.assertFalse("Arrays with different sizes should not be equal", + equals); + } + + @Test + public void differentContentArray_notEqual() { + JsonArray a1 = Json.createArray(); + a1.set(0, 0); + + JsonArray a2 = Json.createArray(); + a2.set(0, 1); + + boolean equals = JsonCodec.jsonEquals(a1, a2); + + Assert.assertFalse("Arrays with different content should not be equal", + equals); + } + + @Test + public void differentOrderArray_notEqual() { + JsonArray a1 = Json.createArray(); + a1.set(0, 0); + a1.set(1, true); + + JsonArray a2 = Json.createArray(); + a2.set(0, true); + a2.set(1, 0); + + boolean equals = JsonCodec.jsonEquals(a1, a2); + + Assert.assertFalse("Arrays with different order should not be equal", + equals); + } + + @Test + public void emptyArrays_equal() { + JsonArray a1 = Json.createArray(); + JsonArray a2 = Json.createArray(); + + boolean equals = JsonCodec.jsonEquals(a1, a2); + + Assert.assertTrue("Empty arrays should be equal", equals); + } + + @Test + public void sameArrays_equal() { + JsonArray a1 = Json.createArray(); + a1.set(0, 0); + a1.set(1, true); + + JsonArray a2 = Json.createArray(); + a2.set(0, 0); + a2.set(1, true); + + boolean equals = JsonCodec.jsonEquals(a1, a2); + + Assert.assertTrue("Same arrays should be equal", equals); + } + + @Test + public void sameArraysWitNull_equal() { + JsonArray a1 = Json.createArray(); + a1.set(0, Json.createNull()); + + JsonArray a2 = Json.createArray(); + a2.set(0, Json.createNull()); + + boolean equals = JsonCodec.jsonEquals(a1, a2); + + Assert.assertTrue("Same arrays should be equal", equals); + } + + @Test + public void differentDeeplyNested_notEquals() { + boolean equals = JsonCodec.jsonEquals(createDeeplyNestedValue(1), + createDeeplyNestedValue(2)); + + Assert.assertFalse("Values should not be equal", equals); + } + + @Test + public void sameDeeplyNested_equals() { + boolean equals = JsonCodec.jsonEquals(createDeeplyNestedValue(1), + createDeeplyNestedValue(1)); + + Assert.assertTrue("Values should be equal", equals); + } + + private static JsonValue createDeeplyNestedValue(int leafValue) { + JsonObject childObject = Json.createObject(); + childObject.put("value", leafValue); + + JsonArray childArray = Json.createArray(); + childArray.set(0, childObject); + + JsonObject value = Json.createObject(); + value.put("child", childArray); + return value; + } +} diff --git a/uitest/src/com/vaadin/tests/components/embedded/EmbeddedThemeResource.java b/uitest/src/com/vaadin/tests/components/embedded/EmbeddedThemeResource.java new file mode 100644 index 0000000000..ecc746b858 --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/embedded/EmbeddedThemeResource.java @@ -0,0 +1,69 @@ +/* + * 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.embedded; + +import com.vaadin.server.ThemeResource; +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.Embedded; +import com.vaadin.ui.Image; +import com.vaadin.ui.themes.Reindeer; + +/** + * Tests that {@link Embedded} uses correct theme when the theme is set with + * {@link #setTheme(String)}, and also updates correctly if theme is changed + * later. {@link Image} is used as the baseline for correct behaviour. + * + * @author Vaadin Ltd + */ +public class EmbeddedThemeResource extends AbstractTestUI { + + @Override + protected void setup(VaadinRequest request) { + setTheme("tests-components"); + + addButton("Toggle theme", new Button.ClickListener() { + + @Override + public void buttonClick(ClickEvent event) { + if (Reindeer.THEME_NAME.equals(getTheme())) { + setTheme("tests-components"); + } else { + setTheme(Reindeer.THEME_NAME); + } + } + }); + + // let's show a simple themeresource + ThemeResource logoResource = new ThemeResource("images/logo.png"); + Embedded embedded = new Embedded("embedded:", logoResource); + Image image = new Image("image:", logoResource); + + addComponents(embedded, image); + } + + @Override + protected String getTestDescription() { + return "Tests that Embedded updates correctly when using setTheme(String)"; + } + + @Override + protected Integer getTicketNumber() { + return 15194; + } +} diff --git a/uitest/src/com/vaadin/tests/components/embedded/EmbeddedThemeResourceTest.java b/uitest/src/com/vaadin/tests/components/embedded/EmbeddedThemeResourceTest.java new file mode 100644 index 0000000000..f3dca71cad --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/embedded/EmbeddedThemeResourceTest.java @@ -0,0 +1,109 @@ +/* + * 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.embedded; + +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.is; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + +import java.util.Arrays; +import java.util.List; + +import org.junit.Before; +import org.junit.Test; +import org.openqa.selenium.By; +import org.openqa.selenium.WebDriver; +import org.openqa.selenium.remote.DesiredCapabilities; +import org.openqa.selenium.support.ui.ExpectedCondition; + +import com.vaadin.testbench.elements.ButtonElement; +import com.vaadin.testbench.elements.EmbeddedElement; +import com.vaadin.testbench.elements.ImageElement; +import com.vaadin.tests.tb3.MultiBrowserTest; +import com.vaadin.tests.tb3.SingleBrowserTest; +import com.vaadin.ui.Embedded; + +/** + * Tests that {@link Embedded} uses correct theme when the theme is set with + * {@link #setTheme(String)}, and also updates correctly if theme is changed + * later. {@link Image} is used as the baseline for correct behaviour. + * + * @author Vaadin Ltd + */ +public class EmbeddedThemeResourceTest extends SingleBrowserTest { + + @Override + public List<DesiredCapabilities> getBrowsersToTest() { + // Seems like stylesheet onload is not fired on PhantomJS + // https://github.com/ariya/phantomjs/issues/12332 + return Arrays.asList(MultiBrowserTest.Browser.FIREFOX + .getDesiredCapabilities()); + } + + @Before + @Override + public void setup() throws Exception { + super.setup(); + openTestURL(); + waitForElementPresent(By.className("v-embedded")); + } + + @Test + public void testInitialTheme() { + EmbeddedElement embedded = $(EmbeddedElement.class).first(); + ImageElement image = $(ImageElement.class).first(); + final String initial = image.getAttribute("src"); + + assertFalse( + "ThemeResource image source uses default theme instead of set theme.", + initial.contains("/reindeer/")); + assertThat( + "Embedded and Image aren't using the same source for the image despite sharing the ThemeResource.", + embedded.findElement(By.tagName("img")).getAttribute("src"), + is(initial)); + } + + @Test + public void testUpdatedTheme() { + EmbeddedElement embedded = $(EmbeddedElement.class).first(); + final ImageElement image = $(ImageElement.class).first(); + final String initial = image.getAttribute("src"); + + // update theme + $(ButtonElement.class).first().click(); + + waitUntil(new ExpectedCondition<Boolean>() { + @Override + public Boolean apply(WebDriver input) { + return !initial.equals(image.getAttribute("src")); + } + + @Override + public String toString() { + // Timed out after 10 seconds waiting for ... + return "image source to be updated (was: " + initial + ")"; + } + }); + + assertTrue("ThemeResource image source didn't update correctly.", image + .getAttribute("src").contains("/reindeer/")); + assertThat( + "Embedded and Image aren't using the same source for the image despite sharing the ThemeResource.", + embedded.findElement(By.tagName("img")).getAttribute("src"), + is(image.getAttribute("src"))); + } +} diff --git a/uitest/src/com/vaadin/tests/components/notification/NotificationDelayTest.java b/uitest/src/com/vaadin/tests/components/notification/NotificationDelayTest.java index 219d44710c..903c3440cc 100644 --- a/uitest/src/com/vaadin/tests/components/notification/NotificationDelayTest.java +++ b/uitest/src/com/vaadin/tests/components/notification/NotificationDelayTest.java @@ -15,12 +15,13 @@ */ package com.vaadin.tests.components.notification; +import com.vaadin.tests.tb3.MultiBrowserTest; import org.junit.Assert; import org.junit.Test; import org.openqa.selenium.By; +import org.openqa.selenium.WebDriver; import org.openqa.selenium.interactions.Actions; - -import com.vaadin.tests.tb3.MultiBrowserTest; +import org.openqa.selenium.support.ui.ExpectedCondition; /** * Test to check notification delay. @@ -34,20 +35,16 @@ public class NotificationDelayTest extends MultiBrowserTest { openTestURL(); Assert.assertTrue("No notification found", hasNotification()); - Actions actions = new Actions(getDriver()); - actions.moveByOffset(10, 10).build().perform(); - long start = System.currentTimeMillis(); - boolean hidden = false; - while (System.currentTimeMillis() <= start + 5000) { - Thread.sleep(500); - hidden = !hasNotification(); - if (hidden) { - break; - } - } - Assert.assertTrue("Notification is still visible after 5 seconds", - hidden); + waitUntil(new ExpectedCondition<Boolean>() { + + @Override + public Boolean apply(WebDriver input) { + new Actions(getDriver()).moveByOffset(10, 10).perform(); + + return !hasNotification(); + } + }); } private boolean hasNotification() { diff --git a/uitest/src/com/vaadin/tests/components/table/UnnecessaryScrollbarWhenZooming.java b/uitest/src/com/vaadin/tests/components/table/UnnecessaryScrollbarWhenZooming.java new file mode 100644 index 0000000000..8d95261825 --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/table/UnnecessaryScrollbarWhenZooming.java @@ -0,0 +1,51 @@ +/* + * 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.table; + +import com.vaadin.server.VaadinRequest; +import com.vaadin.tests.components.AbstractTestUI; +import com.vaadin.ui.Table; + +public class UnnecessaryScrollbarWhenZooming extends AbstractTestUI { + + @Override + protected void setup(VaadinRequest request) { + Table table = new Table("A Table"); + table.setId("test-table"); + table.addContainerProperty("Text property 1", String.class, null); + table.addContainerProperty("Text property 2", String.class, null); + table.addContainerProperty("Text property 3", String.class, null); + table.addContainerProperty("Numeric property", Integer.class, null); + table.addItem(new Object[] { "Value 1 ", "Value 2", "Value 3", + new Integer(39) }, new Integer(1)); + table.addItem(new Object[] { "Value 1 ", "Value 2", "Value 3", + new Integer(39) }, new Integer(2)); + table.setWidth("100%"); + table.setPageLength(0); + addComponent(table); + } + + @Override + protected String getTestDescription() { + return "Test case for extra scrollbar being displayed in Table when browser window is zoomed (or page length is 0)"; + } + + @Override + protected Integer getTicketNumber() { + return 15164; + } + +} diff --git a/uitest/src/com/vaadin/tests/components/table/UnnecessaryScrollbarWhenZoomingTest.java b/uitest/src/com/vaadin/tests/components/table/UnnecessaryScrollbarWhenZoomingTest.java new file mode 100644 index 0000000000..df01800180 --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/table/UnnecessaryScrollbarWhenZoomingTest.java @@ -0,0 +1,195 @@ +/* + * 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.table; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; + +import java.util.Arrays; + +import org.junit.After; +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; +import org.openqa.selenium.JavascriptExecutor; +import org.openqa.selenium.Keys; +import org.openqa.selenium.WebDriver; +import org.openqa.selenium.WebElement; +import org.openqa.selenium.remote.DesiredCapabilities; +import org.openqa.selenium.support.ui.ExpectedConditions; +import org.openqa.selenium.support.ui.WebDriverWait; + +import com.vaadin.testbench.By; +import com.vaadin.testbench.commands.TestBenchCommandExecutor; +import com.vaadin.tests.tb3.MultiBrowserTest; + +public class UnnecessaryScrollbarWhenZoomingTest extends MultiBrowserTest { + + private ZoomLevelSetter zoomSetter; + private int zoomOutIterations = 3; + private int zoomInIterations = 3; + + @Before + public void init() { + testBench().resizeViewPortTo(995, 400); + DesiredCapabilities capabilities = getDesiredCapabilities(); + if (BrowserUtil.isChrome(capabilities) + || BrowserUtil.isPhantomJS(capabilities)) { + zoomSetter = new ChromeZoomLevelSetter(driver); + } else { + zoomSetter = new NonChromeZoomLevelSetter(driver); + } + zoomSetter.resetZoom(); + openTestURL(); + // IE sometimes has trouble waiting long enough. + new WebDriverWait(getDriver(), 30).until(ExpectedConditions + .presenceOfElementLocated(By + .cssSelector(".v-table-body-wrapper"))); + } + + @Test + public void testInitial() { + testExtraScrollbarsNotShown(); + } + + @Test + public void testZoomingIn() { + for (int i = 0; i < zoomInIterations; i++) { + zoomSetter.increaseZoom(); + testExtraScrollbarsNotShown(); + } + } + + @Test + public void testZoomingOut() throws InterruptedException { + for (int i = 0; i < zoomOutIterations; i++) { + zoomSetter.decreaseZoom(); + testExtraScrollbarsNotShown(); + } + } + + @After + public void resetZoomLevel() { + zoomSetter.resetZoom(); + } + + private void testExtraScrollbarsNotShown() { + // wait a bit for the layout + try { + Thread.sleep(1000); + } catch (InterruptedException e) { + Assert.fail(); + } + WebElement element = findElement(By + .cssSelector(".v-table-body-wrapper")); + assertNotNull("There must be a table", element); + String overflow = element.getCssValue("overflow"); + // As long as the overflow is hidden, there will not be scroll bars. + if (!"hidden".equals(overflow)) { + // compare scroll width to offset width. True if scrolling. + String detectHorizontalScroll = "return arguments[0].scrollWidth > arguments[0].clientWidth"; + Boolean horizontal = (Boolean) ((TestBenchCommandExecutor) getDriver()) + .executeScript(detectHorizontalScroll, element); + assertEquals("there must be no horizontal scrollbar", false, + horizontal); + + String detectVerticalScroll = "return arguments[0].scrollHeight > arguments[0].clientHeight"; + Boolean vertical = (Boolean) ((TestBenchCommandExecutor) getDriver()) + .executeScript(detectVerticalScroll, element); + assertEquals("there must be no vertical scrollbar", false, vertical); + } + } + + interface ZoomLevelSetter { + public void increaseZoom(); + + public void decreaseZoom(); + + public void resetZoom(); + } + + /* + * A class for setting the zoom levels by sending keys such as ctrl and +. + */ + class NonChromeZoomLevelSetter implements ZoomLevelSetter { + private WebDriver driver; + + public NonChromeZoomLevelSetter(WebDriver driver) { + this.driver = driver; + } + + @Override + public void increaseZoom() { + getElement().sendKeys(Keys.chord(Keys.CONTROL, Keys.ADD)); + } + + @Override + public void decreaseZoom() { + getElement().sendKeys(Keys.chord(Keys.CONTROL, Keys.SUBTRACT)); + } + + @Override + public void resetZoom() { + getElement().sendKeys(Keys.chord(Keys.CONTROL, "0")); + } + + private WebElement getElement() { + return driver.findElement(By.tagName("html")); + } + } + + /* + * A class for setting the zoom levels using JavaScript. This setter is used + * for browsers for which the method of sending the keys ctrl and + does not + * work. + */ + class ChromeZoomLevelSetter implements ZoomLevelSetter { + private JavascriptExecutor js; + private int currentZoomIndex = 2; + private int[] zoomLevels = { 70, 80, 90, 100, 110, 120, 130 }; + + public ChromeZoomLevelSetter(WebDriver driver) { + js = (JavascriptExecutor) driver; + } + + @Override + public void increaseZoom() { + currentZoomIndex++; + if (currentZoomIndex >= zoomLevels.length) { + currentZoomIndex = zoomLevels.length - 1; + } + js.executeScript("document.body.style.zoom='" + + zoomLevels[currentZoomIndex] + "%'"); + } + + @Override + public void decreaseZoom() { + currentZoomIndex--; + if (currentZoomIndex < 0) { + currentZoomIndex = 0; + } + js.executeScript("document.body.style.zoom='" + + zoomLevels[currentZoomIndex] + "%'"); + } + + @Override + public void resetZoom() { + js.executeScript("document.body.style.zoom='100%'"); + currentZoomIndex = Arrays.binarySearch(zoomLevels, 100); + } + } + +} diff --git a/uitest/src/com/vaadin/tests/components/textfield/TextFieldEmptyingPrompt.java b/uitest/src/com/vaadin/tests/components/textfield/TextFieldEmptyingPrompt.java new file mode 100644 index 0000000000..9fe18f131b --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/textfield/TextFieldEmptyingPrompt.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.textfield; + +import com.vaadin.event.FieldEvents; +import com.vaadin.event.FieldEvents.TextChangeEvent; +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.Label; +import com.vaadin.ui.TextField; + +@SuppressWarnings("serial") +public class TextFieldEmptyingPrompt extends AbstractTestUI { + + final TextField textField = new TextField(); + final Label label = new Label(); + final static String RANDOM_PROMPT = "Some prompt here"; + + @Override + public String getTestDescription() { + return "Type something, then erase it, then click on the button.<br>" + + "Input prompt should dissapear.<br>"; + } + + @Override + protected Integer getTicketNumber() { + return 15144; + } + + @Override + protected void setup(VaadinRequest request) { + + addComponent(label); + + textField.setInputPrompt(RANDOM_PROMPT); + textField.addTextChangeListener(new FieldEvents.TextChangeListener() { + + @Override + public void textChange(TextChangeEvent event) { + label.setValue("Textfield value: " + event.getText()); + } + }); + addComponent(textField); + + Button button = new Button("Click To Remove Prompt"); + button.addClickListener(new Button.ClickListener() { + + @Override + public void buttonClick(ClickEvent event) { + + textField.setInputPrompt(""); + } + }); + addComponent(button); + } +} diff --git a/uitest/src/com/vaadin/tests/components/textfield/TextFieldEmptyingPromptTest.java b/uitest/src/com/vaadin/tests/components/textfield/TextFieldEmptyingPromptTest.java new file mode 100644 index 0000000000..f4fa5d0dc5 --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/textfield/TextFieldEmptyingPromptTest.java @@ -0,0 +1,104 @@ +/* + * 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.textfield; + +import org.junit.Test; +import org.openqa.selenium.Keys; +import org.openqa.selenium.WebDriver; +import org.openqa.selenium.support.ui.ExpectedCondition; + +import com.vaadin.testbench.elements.ButtonElement; +import com.vaadin.testbench.elements.LabelElement; +import com.vaadin.testbench.elements.TextFieldElement; +import com.vaadin.tests.tb3.MultiBrowserTest; + +public class TextFieldEmptyingPromptTest extends MultiBrowserTest { + + private String RANDOM_INPUT = "Some input here"; + + private TextFieldElement textfield; + private LabelElement label; + private ButtonElement button; + + @Test + public void testInputPrompt() throws InterruptedException { + openTestURL(); + + textfield = $(TextFieldElement.class).first(); + label = $(LabelElement.class).get(1); + button = $(ButtonElement.class).first(); + + // Write on the TextField + writeOnTextField(); + + // Make sure a complete server communication cycle happened + waitServerUpdate("Textfield value: " + RANDOM_INPUT); + + // Empty the TextField + emptyTextField(); + + // Click attempts to remove the prompt + button.click(); + + // Assert Prompt text disappeared + waitServerUpdateText(""); + } + + private void waitServerUpdate(final String expectedValue) { + waitUntil(new ExpectedCondition<Boolean>() { + + @Override + public Boolean apply(WebDriver input) { + return label.getText().equals(expectedValue); + } + + @Override + public String toString() { + // Timed out after 10 seconds waiting for ... + return "the server to get updated with the entered value: '" + + expectedValue + "' (was: '" + label.getText() + "')"; + } + }); + } + + private void waitServerUpdateText(final String expectedValue) { + waitUntil(new ExpectedCondition<Boolean>() { + + @Override + public Boolean apply(WebDriver input) { + return textfield.getValue().equals(expectedValue); + } + + @Override + public String toString() { + // Timed out after 10 seconds waiting for ... + return "the server to get updated with the entered value: '" + + expectedValue + "' (was: '" + textfield.getValue() + + "')"; + } + }); + } + + private void writeOnTextField() { + textfield.sendKeys(RANDOM_INPUT); + } + + private void emptyTextField() { + for (int i = 0; i < RANDOM_INPUT.length(); i++) { + textfield.sendKeys(Keys.BACK_SPACE); + } + } +} diff --git a/uitest/src/com/vaadin/tests/components/treetable/TreeTableContainerHierarchicalWrapper.java b/uitest/src/com/vaadin/tests/components/treetable/TreeTableContainerHierarchicalWrapper.java new file mode 100644 index 0000000000..95f8c54e9e --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/treetable/TreeTableContainerHierarchicalWrapper.java @@ -0,0 +1,82 @@ +package com.vaadin.tests.components.treetable; + +import com.vaadin.data.util.BeanItemContainer; +import com.vaadin.data.util.ContainerHierarchicalWrapper; +import com.vaadin.server.VaadinRequest; +import com.vaadin.tests.components.AbstractTestUI; +import com.vaadin.ui.Tree.ExpandEvent; +import com.vaadin.ui.Tree.ExpandListener; +import com.vaadin.ui.TreeTable; + +@SuppressWarnings("serial") +public class TreeTableContainerHierarchicalWrapper extends AbstractTestUI { + + TreeTable treetable = new TreeTable(); + BeanItemContainer<Bean> beanContainer = new BeanItemContainer<Bean>( + Bean.class); + ContainerHierarchicalWrapper hierarchicalWrapper = new ContainerHierarchicalWrapper( + beanContainer); + + @Override + protected void setup(VaadinRequest request) { + treetable = new TreeTable(); + treetable.setImmediate(true); + treetable.setWidth("100%"); + treetable.setHeight(null); + treetable.setPageLength(0); + treetable.setContainerDataSource(hierarchicalWrapper); + + treetable.addExpandListener(new ExpandListener() { + @Override + public void nodeExpand(ExpandEvent event) { + Bean parent = ((Bean) event.getItemId()); + if (!hierarchicalWrapper.hasChildren(parent)) { + for (int i = 1; i <= 5; i++) { + Bean newChild = new Bean(parent.getId() + "-" + i); + beanContainer.addBean(newChild); + hierarchicalWrapper.setParent(newChild, parent); + } + } + + } + }); + + for (int i = 0; i < 3; i++) { + beanContainer.addBean(new Bean("Item " + i)); + } + + addComponent(treetable); + } + + public class Bean { + public static final String PROP_ID = "id"; + private String id; + + public Bean() { + // empty + } + + public Bean(String id) { + this.id = id; + } + + public void setId(String id) { + this.id = id; + } + + public String getId() { + return id; + } + } + + @Override + protected String getTestDescription() { + return "Tests that TreeTable with ContainerHierarchicalWrapper is updated correctly when the setParent() is called for the item just added"; + } + + @Override + protected Integer getTicketNumber() { + return 15421; + } + +} diff --git a/uitest/src/com/vaadin/tests/components/treetable/TreeTableContainerHierarchicalWrapperTest.java b/uitest/src/com/vaadin/tests/components/treetable/TreeTableContainerHierarchicalWrapperTest.java new file mode 100644 index 0000000000..f767e5fd52 --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/treetable/TreeTableContainerHierarchicalWrapperTest.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.treetable; + +import static org.junit.Assert.assertEquals; + +import org.junit.Test; +import org.openqa.selenium.By; +import org.openqa.selenium.WebElement; + +import com.vaadin.testbench.TestBenchElement; +import com.vaadin.testbench.elements.TreeTableElement; +import com.vaadin.tests.tb3.MultiBrowserTest; + +/** + * Tests that TreeTable with ContainerHierarchicalWrapper is updated correctly + * when the setParent() is called for the item just added + * + * @author Vaadin Ltd + */ +public class TreeTableContainerHierarchicalWrapperTest extends MultiBrowserTest { + + @Test + public void testStructure() throws InterruptedException { + openTestURL(); + + TreeTableElement treeTable = $(TreeTableElement.class).first(); + WebElement findElement = treeTable.getCell(0, 0).findElement( + By.className("v-treetable-treespacer")); + findElement.click(); + + TestBenchElement cell = treeTable.getCell(5, 0); + WebElement findElement2 = cell.findElement(By + .className("v-treetable-treespacer")); + assertEquals("Item 0-5", cell.getText()); + findElement2.click(); + + TestBenchElement cell2 = treeTable.getCell(10, 0); + assertEquals("Item 0-5-5", cell2.getText()); + } + +} diff --git a/uitest/src/com/vaadin/tests/components/window/MaximizedWindowOrder.java b/uitest/src/com/vaadin/tests/components/window/MaximizedWindowOrder.java new file mode 100644 index 0000000000..8fe6c0ce5a --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/window/MaximizedWindowOrder.java @@ -0,0 +1,49 @@ +package com.vaadin.tests.components.window; + +import com.vaadin.server.VaadinRequest; +import com.vaadin.shared.ui.window.WindowMode; +import com.vaadin.tests.components.AbstractTestUI; +import com.vaadin.ui.Button; +import com.vaadin.ui.Button.ClickEvent; +import com.vaadin.ui.Button.ClickListener; +import com.vaadin.ui.Label; +import com.vaadin.ui.VerticalLayout; +import com.vaadin.ui.Window; + +public class MaximizedWindowOrder extends AbstractTestUI { + + @Override + protected void setup(VaadinRequest request) { + addButton("Open Maximized Window", new ClickListener() { + @Override + public void buttonClick(ClickEvent event) { + openWindow(true); + } + }); + } + + private void openWindow(boolean maximized) { + Window window = new Window(); + VerticalLayout layout = new VerticalLayout(); + + Label label = new Label(maximized ? "Maximized" : "Normal"); + + layout.addComponent(label); + Button button = new Button("Open Normal Window"); + button.addClickListener(new ClickListener() { + + @Override + public void buttonClick(ClickEvent event) { + openWindow(false); + } + + }); + + layout.addComponent(button); + + window.setContent(layout); + window.setWindowMode(maximized ? WindowMode.MAXIMIZED : WindowMode.NORMAL); + + addWindow(window); + } +}
\ No newline at end of file diff --git a/uitest/src/com/vaadin/tests/components/window/MaximizedWindowOrderTest.java b/uitest/src/com/vaadin/tests/components/window/MaximizedWindowOrderTest.java new file mode 100644 index 0000000000..5063c84658 --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/window/MaximizedWindowOrderTest.java @@ -0,0 +1,70 @@ +package com.vaadin.tests.components.window; + +import com.vaadin.testbench.elements.ButtonElement; +import com.vaadin.tests.tb3.AbstractTB3Test; +import com.vaadin.tests.tb3.MultiBrowserTest; +import com.vaadin.tests.tb3.newelements.WindowElement; +import org.junit.Test; + +import static org.hamcrest.CoreMatchers.is; +import static org.hamcrest.Matchers.greaterThan; +import static org.junit.Assert.assertThat; + +public class MaximizedWindowOrderTest extends MultiBrowserTest { + + private WindowElement openAnotherWindow() { + WindowElement maximizedWindow = getMaximizedWindow(); + maximizedWindow.$(ButtonElement.class).first().click(); + + return getAnotherWindow(); + } + + private WindowElement getMaximizedWindow() { + return $(WindowElement.class).first(); + } + + private WindowElement getAnotherWindow() { + return $(WindowElement.class).get(1); + } + + private WindowElement openMaximizedWindow() { + $(ButtonElement.class).first().click(); + + return getMaximizedWindow(); + } + + @Override + public void setup() throws Exception { + super.setup(); + openTestURL(); + } + + @Test + public void newWindowOpensOnTopOfMaximizedWindow() { + WindowElement maximizedWindow = openMaximizedWindow(); + WindowElement anotherWindow = openAnotherWindow(); + + assertThat(anotherWindow.getCssValue("z-index"), + is(greaterThan(maximizedWindow.getCssValue("z-index")))); + + assertThat(getMaximizedWindow().getCssValue("z-index"), is("10000")); + assertThat(getAnotherWindow().getCssValue("z-index"), is("10001")); + } + + @Test + public void backgroundWindowIsBroughtOnTopWhenMaximized() { + WindowElement maximizedWindow = openMaximizedWindow(); + + maximizedWindow.restore(); + + // the new window is opened on top of the original. + WindowElement anotherWindow = openAnotherWindow(); + + // move the window to make the maximize button visible. + anotherWindow.move(10, 20); + maximizedWindow.maximize(); + + assertThat(maximizedWindow.getCssValue("z-index"), + is(greaterThan(anotherWindow.getCssValue("z-index")))); + } +}
\ No newline at end of file diff --git a/uitest/src/com/vaadin/tests/tb3/newelements/WindowElement.java b/uitest/src/com/vaadin/tests/tb3/newelements/WindowElement.java new file mode 100644 index 0000000000..dd7cb55d01 --- /dev/null +++ b/uitest/src/com/vaadin/tests/tb3/newelements/WindowElement.java @@ -0,0 +1,53 @@ +package com.vaadin.tests.tb3.newelements; + +import com.vaadin.testbench.By; +import com.vaadin.testbench.elements.ServerClass; +import org.openqa.selenium.WebElement; +import org.openqa.selenium.interactions.Actions; + +/* + Suggestions for new elemental api for Window + */ +@ServerClass("com.vaadin.ui.Window") +public class WindowElement extends com.vaadin.testbench.elements.WindowElement { + + private final String restoreBoxClass = "v-window-restorebox"; + private final String maximizeBoxClass = "v-window-maximizebox"; + + public void restore() { + if(isMaximized()) { + getRestoreButton().click(); + } else { + throw new AssertionError("Window is not maximized, cannot be restored."); + } + } + + private boolean isMaximized() { + return isElementPresent(By.className(restoreBoxClass)); + } + + private WebElement getRestoreButton() { + return this.findElement(By.className("v-window-restorebox")); + } + + public void maximize() { + if(!isMaximized()) { + getMaximizeButton().click(); + } else { + throw new AssertionError("Window is already maximized, cannot maximize."); + } + } + + private WebElement getMaximizeButton() { + return this.findElement(By.className(maximizeBoxClass)); + } + + public void move(int xOffset, int yOffset) { + Actions action = new Actions(getDriver()); + action.moveToElement(this.findElement(org.openqa.selenium.By.className("v-window-wrap")), 5, 5); + action.clickAndHold(); + action.moveByOffset(xOffset, yOffset); + action.release(); + action.build().perform(); + } +} diff --git a/uitest/src/com/vaadin/tests/themes/valo/AlignTopIconInButtonTest.java b/uitest/src/com/vaadin/tests/themes/valo/AlignTopIconInButtonTest.java index 287e25d402..02ef886721 100644 --- a/uitest/src/com/vaadin/tests/themes/valo/AlignTopIconInButtonTest.java +++ b/uitest/src/com/vaadin/tests/themes/valo/AlignTopIconInButtonTest.java @@ -15,7 +15,10 @@ */ package com.vaadin.tests.themes.valo; -import org.junit.Assert; +import static org.hamcrest.CoreMatchers.is; +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.lessThanOrEqualTo; + import org.junit.Test; import org.openqa.selenium.By; import org.openqa.selenium.WebElement; @@ -30,7 +33,7 @@ import com.vaadin.tests.tb3.MultiBrowserTest; public class AlignTopIconInButtonTest extends MultiBrowserTest { @Test - public void testIconPositioninButton() { + public void iconIsCenteredInsideButton() { openTestURL(); WebElement wrapper = findElement(By.className("v-button-wrap")); @@ -41,7 +44,6 @@ public class AlignTopIconInButtonTest extends MultiBrowserTest { + wrapper.getSize().getWidth() - icon.getLocation().getX() - icon.getSize().getWidth(); - Assert.assertTrue("Icon element is not centered inside button.", - Math.abs(rightSpace - leftSpace) <= 1); + assertThat(Math.abs(rightSpace - leftSpace), is(lessThanOrEqualTo(2))); } } 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")); } } diff --git a/uitest/tb2/com/vaadin/tests/components/calendar/CalendarWeeklyViewNewEvents.html b/uitest/tb2/com/vaadin/tests/components/calendar/CalendarWeeklyViewNewEvents.html index 6add1deba5..f2702420f1 100644 --- a/uitest/tb2/com/vaadin/tests/components/calendar/CalendarWeeklyViewNewEvents.html +++ b/uitest/tb2/com/vaadin/tests/components/calendar/CalendarWeeklyViewNewEvents.html @@ -313,7 +313,7 @@ </tr> <tr> <td>mouseClick</td> - <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/domChild[0]/domChild[0]/domChild[3]</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]/domChild[1]</td> <td>8,9</td> </tr> <!--Edit previously created events and change properties--> @@ -438,7 +438,7 @@ </tr> <tr> <td>mouseClick</td> - <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/domChild[0]/domChild[0]/domChild[3]</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]/domChild[1]</td> <td>11,8</td> </tr> <tr> @@ -558,7 +558,7 @@ </tr> <tr> <td>mouseClick</td> - <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/domChild[0]/domChild[0]/domChild[3]</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]/domChild[1]</td> <td>7,8</td> </tr> <tr> @@ -583,7 +583,7 @@ </tr> <tr> <td>mouseClick</td> - <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/domChild[0]/domChild[0]/domChild[3]</td> + <td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]/domChild[1]</td> <td>12,10</td> </tr> <!--Go to monthly view and assert inserted events--> diff --git a/uitest/tb2/com/vaadin/tests/components/uitest/base_theme_test.html b/uitest/tb2/com/vaadin/tests/components/uitest/base_theme_test.html index cdbcf8bacc..a87cba69ab 100644 --- a/uitest/tb2/com/vaadin/tests/components/uitest/base_theme_test.html +++ b/uitest/tb2/com/vaadin/tests/components/uitest/base_theme_test.html @@ -289,7 +289,7 @@ </tr> <tr> <td>mouseClick</td> - <td>vaadin=runThemeTestUI::/VWindow[0]/domChild[0]/domChild[0]/domChild[3]</td> + <td>vaadin=runThemeTestUI::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]/domChild[1]</td> <td>9,8</td> </tr> <tr> @@ -304,7 +304,7 @@ </tr> <tr> <td>mouseClick</td> - <td>vaadin=runThemeTestUI::/VWindow[0]/domChild[0]/domChild[0]/domChild[3]</td> + <td>vaadin=runThemeTestUI::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]/domChild[1]</td> <td>11,6</td> </tr> <tr> @@ -319,7 +319,7 @@ </tr> <tr> <td>mouseClick</td> - <td>vaadin=runThemeTestUI::/VWindow[0]/domChild[0]/domChild[0]/domChild[3]</td> + <td>vaadin=runThemeTestUI::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]/domChild[1]</td> <td>8,5</td> </tr> <tr> @@ -334,7 +334,7 @@ </tr> <tr> <td>mouseClick</td> - <td>vaadin=runThemeTestUI::/VWindow[0]/domChild[0]/domChild[0]/domChild[3]</td> + <td>vaadin=runThemeTestUI::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]/domChild[1]</td> <td>9,6</td> </tr> <tr> @@ -349,7 +349,7 @@ </tr> <tr> <td>mouseClick</td> - <td>vaadin=runThemeTestUI::/VWindow[0]/domChild[0]/domChild[0]/domChild[3]</td> + <td>vaadin=runThemeTestUI::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]/domChild[1]</td> <td>10,7</td> </tr> <tr> diff --git a/uitest/tb2/com/vaadin/tests/components/uitest/chameleon_theme_test.html b/uitest/tb2/com/vaadin/tests/components/uitest/chameleon_theme_test.html index d5d70a62d2..3c3c229e97 100644 --- a/uitest/tb2/com/vaadin/tests/components/uitest/chameleon_theme_test.html +++ b/uitest/tb2/com/vaadin/tests/components/uitest/chameleon_theme_test.html @@ -289,7 +289,7 @@ </tr> <tr> <td>mouseClick</td> - <td>vaadin=runThemeTestUI::/VWindow[0]/domChild[0]/domChild[0]/domChild[3]</td> + <td>vaadin=runThemeTestUI::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]/domChild[1]</td> <td>9,8</td> </tr> <tr> @@ -304,7 +304,7 @@ </tr> <tr> <td>mouseClick</td> - <td>vaadin=runThemeTestUI::/VWindow[0]/domChild[0]/domChild[0]/domChild[3]</td> + <td>vaadin=runThemeTestUI::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]/domChild[1]</td> <td>11,6</td> </tr> <tr> @@ -319,7 +319,7 @@ </tr> <tr> <td>mouseClick</td> - <td>vaadin=runThemeTestUI::/VWindow[0]/domChild[0]/domChild[0]/domChild[3]</td> + <td>vaadin=runThemeTestUI::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]/domChild[1]</td> <td>8,5</td> </tr> <tr> @@ -334,7 +334,7 @@ </tr> <tr> <td>mouseClick</td> - <td>vaadin=runThemeTestUI::/VWindow[0]/domChild[0]/domChild[0]/domChild[3]</td> + <td>vaadin=runThemeTestUI::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]/domChild[1]</td> <td>9,6</td> </tr> <tr> @@ -349,7 +349,7 @@ </tr> <tr> <td>mouseClick</td> - <td>vaadin=runThemeTestUI::/VWindow[0]/domChild[0]/domChild[0]/domChild[3]</td> + <td>vaadin=runThemeTestUI::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]/domChild[1]</td> <td>10,7</td> </tr> <tr> diff --git a/uitest/tb2/com/vaadin/tests/components/uitest/liferay_theme_test.html b/uitest/tb2/com/vaadin/tests/components/uitest/liferay_theme_test.html index 783784e993..3ed5836c86 100644 --- a/uitest/tb2/com/vaadin/tests/components/uitest/liferay_theme_test.html +++ b/uitest/tb2/com/vaadin/tests/components/uitest/liferay_theme_test.html @@ -289,7 +289,7 @@ </tr> <tr> <td>mouseClick</td> - <td>vaadin=runThemeTestUI::/VWindow[0]/domChild[0]/domChild[0]/domChild[3]</td> + <td>vaadin=runThemeTestUI::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]/domChild[1]</td> <td>9,8</td> </tr> <tr> @@ -304,7 +304,7 @@ </tr> <tr> <td>mouseClick</td> - <td>vaadin=runThemeTestUI::/VWindow[0]/domChild[0]/domChild[0]/domChild[3]</td> + <td>vaadin=runThemeTestUI::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]/domChild[1]</td> <td>11,6</td> </tr> <tr> @@ -319,7 +319,7 @@ </tr> <tr> <td>mouseClick</td> - <td>vaadin=runThemeTestUI::/VWindow[0]/domChild[0]/domChild[0]/domChild[3]</td> + <td>vaadin=runThemeTestUI::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]/domChild[1]</td> <td>8,5</td> </tr> <tr> @@ -334,7 +334,7 @@ </tr> <tr> <td>mouseClick</td> - <td>vaadin=runThemeTestUI::/VWindow[0]/domChild[0]/domChild[0]/domChild[3]</td> + <td>vaadin=runThemeTestUI::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]/domChild[1]</td> <td>9,6</td> </tr> <tr> @@ -349,7 +349,7 @@ </tr> <tr> <td>mouseClick</td> - <td>vaadin=runThemeTestUI::/VWindow[0]/domChild[0]/domChild[0]/domChild[3]</td> + <td>vaadin=runThemeTestUI::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]/domChild[1]</td> <td>10,7</td> </tr> <tr> diff --git a/uitest/tb2/com/vaadin/tests/components/uitest/reindeer_theme_test.html b/uitest/tb2/com/vaadin/tests/components/uitest/reindeer_theme_test.html index 175def94d3..6d19f5c7a1 100644 --- a/uitest/tb2/com/vaadin/tests/components/uitest/reindeer_theme_test.html +++ b/uitest/tb2/com/vaadin/tests/components/uitest/reindeer_theme_test.html @@ -289,7 +289,7 @@ </tr> <tr> <td>mouseClick</td> - <td>vaadin=runThemeTestUI::/VWindow[0]/domChild[0]/domChild[0]/domChild[3]</td> + <td>vaadin=runThemeTestUI::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]/domChild[1]</td> <td>9,8</td> </tr> <tr> @@ -304,7 +304,7 @@ </tr> <tr> <td>mouseClick</td> - <td>vaadin=runThemeTestUI::/VWindow[0]/domChild[0]/domChild[0]/domChild[3]</td> + <td>vaadin=runThemeTestUI::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]/domChild[1]</td> <td>11,6</td> </tr> <tr> @@ -319,7 +319,7 @@ </tr> <tr> <td>mouseClick</td> - <td>vaadin=runThemeTestUI::/VWindow[0]/domChild[0]/domChild[0]/domChild[3]</td> + <td>vaadin=runThemeTestUI::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]/domChild[1]</td> <td>8,5</td> </tr> <tr> @@ -334,7 +334,7 @@ </tr> <tr> <td>mouseClick</td> - <td>vaadin=runThemeTestUI::/VWindow[0]/domChild[0]/domChild[0]/domChild[3]</td> + <td>vaadin=runThemeTestUI::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]/domChild[1]</td> <td>9,6</td> </tr> <tr> @@ -349,7 +349,7 @@ </tr> <tr> <td>mouseClick</td> - <td>vaadin=runThemeTestUI::/VWindow[0]/domChild[0]/domChild[0]/domChild[3]</td> + <td>vaadin=runThemeTestUI::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]/domChild[1]</td> <td>10,7</td> </tr> <tr> diff --git a/uitest/tb2/com/vaadin/tests/components/uitest/runo_theme_test.html b/uitest/tb2/com/vaadin/tests/components/uitest/runo_theme_test.html index 0db6614a9c..183854102d 100644 --- a/uitest/tb2/com/vaadin/tests/components/uitest/runo_theme_test.html +++ b/uitest/tb2/com/vaadin/tests/components/uitest/runo_theme_test.html @@ -289,7 +289,7 @@ </tr> <tr> <td>mouseClick</td> - <td>vaadin=runThemeTestUI::/VWindow[0]/domChild[0]/domChild[0]/domChild[3]</td> + <td>vaadin=runThemeTestUI::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]/domChild[1]</td> <td>9,8</td> </tr> <tr> @@ -304,7 +304,7 @@ </tr> <tr> <td>mouseClick</td> - <td>vaadin=runThemeTestUI::/VWindow[0]/domChild[0]/domChild[0]/domChild[3]</td> + <td>vaadin=runThemeTestUI::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]/domChild[1]</td> <td>11,6</td> </tr> <tr> @@ -319,7 +319,7 @@ </tr> <tr> <td>mouseClick</td> - <td>vaadin=runThemeTestUI::/VWindow[0]/domChild[0]/domChild[0]/domChild[3]</td> + <td>vaadin=runThemeTestUI::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]/domChild[1]</td> <td>8,5</td> </tr> <tr> @@ -334,7 +334,7 @@ </tr> <tr> <td>mouseClick</td> - <td>vaadin=runThemeTestUI::/VWindow[0]/domChild[0]/domChild[0]/domChild[3]</td> + <td>vaadin=runThemeTestUI::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]/domChild[1]</td> <td>9,6</td> </tr> <tr> @@ -349,7 +349,7 @@ </tr> <tr> <td>mouseClick</td> - <td>vaadin=runThemeTestUI::/VWindow[0]/domChild[0]/domChild[0]/domChild[3]</td> + <td>vaadin=runThemeTestUI::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]/domChild[1]</td> <td>10,7</td> </tr> <tr> diff --git a/uitest/tb2/com/vaadin/tests/components/window/CloseSubWindow.html b/uitest/tb2/com/vaadin/tests/components/window/CloseSubWindow.html index ae77628bff..de5a793909 100644 --- a/uitest/tb2/com/vaadin/tests/components/window/CloseSubWindow.html +++ b/uitest/tb2/com/vaadin/tests/components/window/CloseSubWindow.html @@ -40,7 +40,7 @@ <!--Click close in title bar--> <tr> <td>click</td> - <td>vaadin=runcomvaadintestscomponentswindowCloseSubWindow::/VWindow[0]/domChild[0]/domChild[0]/domChild[3]</td> + <td>vaadin=runcomvaadintestscomponentswindowCloseSubWindow::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]/domChild[1]</td> <td></td> </tr> <tr> diff --git a/uitest/tb2/com/vaadin/tests/components/window/SubWindowOrder.html b/uitest/tb2/com/vaadin/tests/components/window/SubWindowOrder.html index 6fd99caa19..f0ccddcce4 100644 --- a/uitest/tb2/com/vaadin/tests/components/window/SubWindowOrder.html +++ b/uitest/tb2/com/vaadin/tests/components/window/SubWindowOrder.html @@ -90,7 +90,7 @@ <!--Close window 4, which is the topmost window--> <tr> <td>mouseClick</td> - <td>vaadin=runcomvaadintestscomponentswindowSubWindowOrder::/VWindow[3]/domChild[0]/domChild[0]/domChild[3]</td> + <td>vaadin=runcomvaadintestscomponentswindowSubWindowOrder::/VWindow[3]/domChild[0]/domChild[0]/domChild[1]/domChild[1]</td> <td>11,15</td> </tr> <tr> @@ -101,7 +101,7 @@ <!--Close Dialog 3 (topmost)--> <tr> <td>mouseClick</td> - <td>vaadin=runcomvaadintestscomponentswindowSubWindowOrder::/VWindow[2]/domChild[0]/domChild[0]/domChild[3]</td> + <td>vaadin=runcomvaadintestscomponentswindowSubWindowOrder::/VWindow[2]/domChild[0]/domChild[0]/domChild[1]/domChild[1]</td> <td>6,8</td> </tr> <!--Make Dialog 5 (topmost) non-modal--> @@ -139,7 +139,7 @@ <!--Close dialog 5--> <tr> <td>mouseClick</td> - <td>vaadin=runcomvaadintestscomponentswindowSubWindowOrder::/VWindow[2]/domChild[0]/domChild[0]/domChild[3]</td> + <td>vaadin=runcomvaadintestscomponentswindowSubWindowOrder::/VWindow[2]/domChild[0]/domChild[0]/domChild[1]/domChild[1]</td> <td>10,5</td> </tr> <tr> diff --git a/uitest/tb2/com/vaadin/tests/components/window/WindowMaximizeRestoreTest.html b/uitest/tb2/com/vaadin/tests/components/window/WindowMaximizeRestoreTest.html index a27963a066..65d5fd20e3 100644 --- a/uitest/tb2/com/vaadin/tests/components/window/WindowMaximizeRestoreTest.html +++ b/uitest/tb2/com/vaadin/tests/components/window/WindowMaximizeRestoreTest.html @@ -18,59 +18,59 @@ <!--Test maximize-restore button--> <tr> <td>assertCSSClass</td> - <td>vaadin=runcomvaadintestscomponentswindowWindowMaximizeRestoreTest::/VWindow[0]/domChild[0]/domChild[0]/domChild[2]</td> + <td>vaadin=runcomvaadintestscomponentswindowWindowMaximizeRestoreTest::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]/domChild[0]</td> <td>v-window-maximizebox</td> </tr> <tr> <td>assertText</td> - <td>vaadin=runcomvaadintestscomponentswindowWindowMaximizeRestoreTest::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]/domChild[0]</td> + <td>vaadin=runcomvaadintestscomponentswindowWindowMaximizeRestoreTest::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]/domChild[2]</td> <td>Window 1</td> </tr> <tr> <td>mouseClick</td> - <td>vaadin=runcomvaadintestscomponentswindowWindowMaximizeRestoreTest::/VWindow[0]/domChild[0]/domChild[0]/domChild[2]</td> + <td>vaadin=runcomvaadintestscomponentswindowWindowMaximizeRestoreTest::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]/domChild[0]</td> <td>7,8</td> </tr> <tr> <td>assertCSSClass</td> - <td>vaadin=runcomvaadintestscomponentswindowWindowMaximizeRestoreTest::/VWindow[0]/domChild[0]/domChild[0]/domChild[2]</td> + <td>vaadin=runcomvaadintestscomponentswindowWindowMaximizeRestoreTest::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]/domChild[0]</td> <td>v-window-restorebox</td> </tr> <tr> <td>mouseClick</td> - <td>vaadin=runcomvaadintestscomponentswindowWindowMaximizeRestoreTest::/VWindow[0]/domChild[0]/domChild[0]/domChild[2]</td> + <td>vaadin=runcomvaadintestscomponentswindowWindowMaximizeRestoreTest::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]/domChild[0]</td> <td>9,7</td> </tr> <tr> <td>assertCSSClass</td> - <td>vaadin=runcomvaadintestscomponentswindowWindowMaximizeRestoreTest::/VWindow[0]/domChild[0]/domChild[0]/domChild[2]</td> + <td>vaadin=runcomvaadintestscomponentswindowWindowMaximizeRestoreTest::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]/domChild[0]</td> <td>v-window-maximizebox</td> </tr> <!--test double click on header--> <tr> <td>doubleClickAt</td> - <td>vaadin=runcomvaadintestscomponentswindowWindowMaximizeRestoreTest::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]/domChild[0]</td> + <td>vaadin=runcomvaadintestscomponentswindowWindowMaximizeRestoreTest::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]/domChild[2]</td> <td></td> </tr> <tr> <td>assertCSSClass</td> - <td>vaadin=runcomvaadintestscomponentswindowWindowMaximizeRestoreTest::/VWindow[0]/domChild[0]/domChild[0]/domChild[2]</td> + <td>vaadin=runcomvaadintestscomponentswindowWindowMaximizeRestoreTest::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]/domChild[0]</td> <td>v-window-restorebox</td> </tr> <tr> <td>doubleClickAt</td> - <td>vaadin=runcomvaadintestscomponentswindowWindowMaximizeRestoreTest::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]/domChild[0]</td> + <td>vaadin=runcomvaadintestscomponentswindowWindowMaximizeRestoreTest::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]/domChild[2]</td> <td></td> </tr> <tr> <td>assertCSSClass</td> - <td>vaadin=runcomvaadintestscomponentswindowWindowMaximizeRestoreTest::/VWindow[0]/domChild[0]/domChild[0]/domChild[2]</td> + <td>vaadin=runcomvaadintestscomponentswindowWindowMaximizeRestoreTest::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]/domChild[0]</td> <td>v-window-maximizebox</td> </tr> <!--Resizable = false should hide max-restore button--> <tr> <td>assertVisible</td> - <td>vaadin=runcomvaadintestscomponentswindowWindowMaximizeRestoreTest::/VWindow[0]/domChild[0]/domChild[0]/domChild[2]</td> + <td>vaadin=runcomvaadintestscomponentswindowWindowMaximizeRestoreTest::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]/domChild[0]</td> <td></td> </tr> <tr> @@ -80,7 +80,7 @@ </tr> <tr> <td>assertNotVisible</td> - <td>vaadin=runcomvaadintestscomponentswindowWindowMaximizeRestoreTest::/VWindow[0]/domChild[0]/domChild[0]/domChild[2]</td> + <td>vaadin=runcomvaadintestscomponentswindowWindowMaximizeRestoreTest::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]/domChild[0]</td> <td></td> </tr> <!--Test server side max-restore--> @@ -91,7 +91,7 @@ </tr> <tr> <td>assertCSSClass</td> - <td>vaadin=runcomvaadintestscomponentswindowWindowMaximizeRestoreTest::/VWindow[0]/domChild[0]/domChild[0]/domChild[2]</td> + <td>vaadin=runcomvaadintestscomponentswindowWindowMaximizeRestoreTest::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]/domChild[0]</td> <td>v-window-restorebox</td> </tr> <tr> @@ -101,28 +101,28 @@ </tr> <tr> <td>assertCSSClass</td> - <td>vaadin=runcomvaadintestscomponentswindowWindowMaximizeRestoreTest::/VWindow[0]/domChild[0]/domChild[0]/domChild[2]</td> + <td>vaadin=runcomvaadintestscomponentswindowWindowMaximizeRestoreTest::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]/domChild[0]</td> <td>v-window-maximizebox</td> </tr> <!--test double click on header doesn't work--> <tr> <td>doubleClickAt</td> - <td>vaadin=runcomvaadintestscomponentswindowWindowMaximizeRestoreTest::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]/domChild[0]</td> + <td>vaadin=runcomvaadintestscomponentswindowWindowMaximizeRestoreTest::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]/domChild[2]</td> <td></td> </tr> <tr> <td>assertCSSClass</td> - <td>vaadin=runcomvaadintestscomponentswindowWindowMaximizeRestoreTest::/VWindow[0]/domChild[0]/domChild[0]/domChild[2]</td> + <td>vaadin=runcomvaadintestscomponentswindowWindowMaximizeRestoreTest::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]/domChild[0]</td> <td>v-window-maximizebox</td> </tr> <tr> <td>doubleClickAt</td> - <td>vaadin=runcomvaadintestscomponentswindowWindowMaximizeRestoreTest::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]/domChild[0]</td> + <td>vaadin=runcomvaadintestscomponentswindowWindowMaximizeRestoreTest::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]/domChild[2]</td> <td></td> </tr> <tr> <td>assertCSSClass</td> - <td>vaadin=runcomvaadintestscomponentswindowWindowMaximizeRestoreTest::/VWindow[0]/domChild[0]/domChild[0]/domChild[2]</td> + <td>vaadin=runcomvaadintestscomponentswindowWindowMaximizeRestoreTest::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]/domChild[0]</td> <td>v-window-maximizebox</td> </tr> <tr> @@ -148,7 +148,7 @@ </tr> <tr> <td>mouseClick</td> - <td>vaadin=runcomvaadintestscomponentswindowWindowMaximizeRestoreTest::/VWindow[0]/domChild[0]/domChild[0]/domChild[2]</td> + <td>vaadin=runcomvaadintestscomponentswindowWindowMaximizeRestoreTest::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]/domChild[0]</td> <td>10,8</td> </tr> <tr> @@ -174,7 +174,7 @@ </tr> <tr> <td>mouseClick</td> - <td>vaadin=runcomvaadintestscomponentswindowWindowMaximizeRestoreTest::/VWindow[1]/domChild[0]/domChild[0]/domChild[2]</td> + <td>vaadin=runcomvaadintestscomponentswindowWindowMaximizeRestoreTest::/VWindow[1]/domChild[0]/domChild[0]/domChild[1]/domChild[0]</td> <td>6,11</td> </tr> <tr> @@ -184,7 +184,7 @@ </tr> <tr> <td>mouseClick</td> - <td>vaadin=runcomvaadintestscomponentswindowWindowMaximizeRestoreTest::/VWindow[1]/domChild[0]/domChild[0]/domChild[3]</td> + <td>vaadin=runcomvaadintestscomponentswindowWindowMaximizeRestoreTest::/VWindow[1]/domChild[0]/domChild[0]/domChild[1]/domChild[1]</td> <td>7,5</td> </tr> <tr> @@ -209,12 +209,12 @@ </tr> <tr> <td>mouseClick</td> - <td>vaadin=runcomvaadintestscomponentswindowWindowMaximizeRestoreTest::/VWindow[1]/domChild[0]/domChild[0]/domChild[2]</td> + <td>vaadin=runcomvaadintestscomponentswindowWindowMaximizeRestoreTest::/VWindow[1]/domChild[0]/domChild[0]/domChild[1]/domChild[0]</td> <td>6,11</td> </tr> <tr> <td>doubleClickAt</td> - <td>vaadin=runcomvaadintestscomponentswindowWindowMaximizeRestoreTest::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]/domChild[0]</td> + <td>vaadin=runcomvaadintestscomponentswindowWindowMaximizeRestoreTest::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]/domChild[2]</td> <td>113,10</td> </tr> <tr> @@ -225,27 +225,27 @@ <!--Test that size and position is preserved when maximizing and restoring--> <tr> <td>mouseClick</td> - <td>vaadin=runcomvaadintestscomponentswindowWindowMaximizeRestoreTest::/VWindow[0]/domChild[0]/domChild[0]/domChild[2]</td> + <td>vaadin=runcomvaadintestscomponentswindowWindowMaximizeRestoreTest::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]/domChild[0]</td> <td>8,4</td> </tr> <tr> <td>dragAndDrop</td> - <td>vaadin=runcomvaadintestscomponentswindowWindowMaximizeRestoreTest::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]/domChild[0]</td> + <td>vaadin=runcomvaadintestscomponentswindowWindowMaximizeRestoreTest::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]/domChild[2]</td> <td>-200,-200</td> </tr> <tr> <td>dragAndDrop</td> - <td>vaadin=runcomvaadintestscomponentswindowWindowMaximizeRestoreTest::/VWindow[0]/domChild[0]/domChild[0]/domChild[5]/domChild[0]</td> + <td>vaadin=runcomvaadintestscomponentswindowWindowMaximizeRestoreTest::/VWindow[0]/domChild[0]/domChild[0]/domChild[3]/domChild[0]</td> <td>+100,+100</td> </tr> <tr> <td>mouseClick</td> - <td>vaadin=runcomvaadintestscomponentswindowWindowMaximizeRestoreTest::/VWindow[0]/domChild[0]/domChild[0]/domChild[2]</td> + <td>vaadin=runcomvaadintestscomponentswindowWindowMaximizeRestoreTest::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]/domChild[0]</td> <td>6,5</td> </tr> <tr> <td>mouseClick</td> - <td>vaadin=runcomvaadintestscomponentswindowWindowMaximizeRestoreTest::/VWindow[0]/domChild[0]/domChild[0]/domChild[2]</td> + <td>vaadin=runcomvaadintestscomponentswindowWindowMaximizeRestoreTest::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]/domChild[0]</td> <td>5,8</td> </tr> <tr> diff --git a/uitest/tb2/com/vaadin/tests/components/window/WindowWithInvalidCloseListener.html b/uitest/tb2/com/vaadin/tests/components/window/WindowWithInvalidCloseListener.html index 3ea1f8f732..ea4d2c3666 100644 --- a/uitest/tb2/com/vaadin/tests/components/window/WindowWithInvalidCloseListener.html +++ b/uitest/tb2/com/vaadin/tests/components/window/WindowWithInvalidCloseListener.html @@ -18,7 +18,7 @@ </tr> <tr> <td>mouseClick</td> - <td>vaadin=runcomvaadintestscomponentswindowWindowWithInvalidCloseListener::/VWindow[0]/domChild[0]/domChild[0]/domChild[3]</td> + <td>vaadin=runcomvaadintestscomponentswindowWindowWithInvalidCloseListener::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]/domChild[1]</td> <td>6,7</td> </tr> <tr> |