From fc4aeac8b43bb3f200b25a997ade05075592ee90 Mon Sep 17 00:00:00 2001 From: John Ahlroos Date: Wed, 17 Apr 2013 17:17:39 +0300 Subject: Fixed IE8 scrollbar issue with vertical layout when using both expansions and alignments #11169 Change-Id: Ia62db30e4e7f9bd02966db31b3bb691a1a60e58d --- .../VerticalLayoutSlotExpansionAndAlignment.html | 26 +++++++++++++ .../VerticalLayoutSlotExpansionAndAlignment.java | 45 ++++++++++++++++++++++ 2 files changed, 71 insertions(+) create mode 100644 uitest/src/com/vaadin/tests/layouts/VerticalLayoutSlotExpansionAndAlignment.html create mode 100644 uitest/src/com/vaadin/tests/layouts/VerticalLayoutSlotExpansionAndAlignment.java (limited to 'uitest') diff --git a/uitest/src/com/vaadin/tests/layouts/VerticalLayoutSlotExpansionAndAlignment.html b/uitest/src/com/vaadin/tests/layouts/VerticalLayoutSlotExpansionAndAlignment.html new file mode 100644 index 0000000000..e0b17ec8cf --- /dev/null +++ b/uitest/src/com/vaadin/tests/layouts/VerticalLayoutSlotExpansionAndAlignment.html @@ -0,0 +1,26 @@ + + + + + + +New Test + + + + + + + + + + + + + + + + +
New Test
openrun/com.vaadin.tests.layouts.VerticalLayoutSlotExpansionAndAlignment?restartApplication
screenCaptureno-scrollbars
+ + diff --git a/uitest/src/com/vaadin/tests/layouts/VerticalLayoutSlotExpansionAndAlignment.java b/uitest/src/com/vaadin/tests/layouts/VerticalLayoutSlotExpansionAndAlignment.java new file mode 100644 index 0000000000..bba8ccf120 --- /dev/null +++ b/uitest/src/com/vaadin/tests/layouts/VerticalLayoutSlotExpansionAndAlignment.java @@ -0,0 +1,45 @@ +package com.vaadin.tests.layouts; + +import com.vaadin.annotations.Theme; +import com.vaadin.server.VaadinRequest; +import com.vaadin.ui.Alignment; +import com.vaadin.ui.HorizontalLayout; +import com.vaadin.ui.Label; +import com.vaadin.ui.UI; +import com.vaadin.ui.VerticalLayout; +import com.vaadin.ui.themes.Reindeer; + +@SuppressWarnings("serial") +public class VerticalLayoutSlotExpansionAndAlignment extends UI { + + @Override + protected void init(VaadinRequest request) { + + VerticalLayout layout = new VerticalLayout(); + layout.setSizeFull(); + setContent(layout); + + HorizontalLayout header = new HorizontalLayout(new Label("HEADER")); + header.setHeight("100px"); + header.setWidth("100%"); + header.setStyleName(Reindeer.LAYOUT_WHITE); + layout.addComponent(header); + + HorizontalLayout content = new HorizontalLayout(new Label("CONTENT")); + content.setSizeFull(); + content.setStyleName(Reindeer.LAYOUT_BLUE); + layout.addComponent(content); + + HorizontalLayout footer = new HorizontalLayout(new Label("FOOTER")); + footer.setHeight("150px"); + footer.setWidth("100%"); + footer.setStyleName(Reindeer.LAYOUT_BLACK); + layout.addComponent(footer); + + // This break things + layout.setComponentAlignment(footer, Alignment.BOTTOM_LEFT); + layout.setExpandRatio(content, 1); + + } + +} \ No newline at end of file -- cgit v1.2.3 From 747a88c642eb08992467ce88862fb93463d6ea20 Mon Sep 17 00:00:00 2001 From: Johannes Dahlström Date: Thu, 18 Apr 2013 16:45:02 +0300 Subject: Prevent double encoding problems when URI fragment contains special characters (#10769) Change-Id: I9043a1f84140b441ab4b3e86eadb708359a29155 --- client/src/com/vaadin/client/ui/VUI.java | 8 +- .../src/com/vaadin/client/ui/ui/UIConnector.java | 6 +- .../com/vaadin/tests/navigator/NavigatorTest.html | 145 ++++++++++++++++++--- .../com/vaadin/tests/navigator/NavigatorTest.java | 32 ++++- 4 files changed, 160 insertions(+), 31 deletions(-) (limited to 'uitest') diff --git a/client/src/com/vaadin/client/ui/VUI.java b/client/src/com/vaadin/client/ui/VUI.java index b07593896f..9a73aa5f8f 100644 --- a/client/src/com/vaadin/client/ui/VUI.java +++ b/client/src/com/vaadin/client/ui/VUI.java @@ -133,10 +133,16 @@ public class VUI extends SimplePanel implements ResizeHandler, // Send the location to the server if the fragment has changed // and flush active connectors in UI. if (!newFragment.equals(currentFragment) && connection != null) { + + // Ensure the fragment is properly encoded in all browsers + // (#10769) + String location = Window.Location.createUrlBuilder() + .buildString(); + currentFragment = newFragment; connection.flushActiveConnector(); connection.updateVariable(id, UIConstants.LOCATION_VARIABLE, - Window.Location.getHref(), true); + location, true); } } }; diff --git a/client/src/com/vaadin/client/ui/ui/UIConnector.java b/client/src/com/vaadin/client/ui/ui/UIConnector.java index ac441fc625..593aa0d793 100644 --- a/client/src/com/vaadin/client/ui/ui/UIConnector.java +++ b/client/src/com/vaadin/client/ui/ui/UIConnector.java @@ -28,6 +28,7 @@ import com.google.gwt.event.dom.client.ScrollEvent; import com.google.gwt.event.dom.client.ScrollHandler; import com.google.gwt.event.logical.shared.ResizeEvent; import com.google.gwt.event.logical.shared.ResizeHandler; +import com.google.gwt.http.client.URL; import com.google.gwt.user.client.Command; import com.google.gwt.user.client.DOM; import com.google.gwt.user.client.Element; @@ -303,8 +304,9 @@ public class UIConnector extends AbstractSingleComponentContainerConnector .getStringAttribute(UIConstants.LOCATION_VARIABLE); int fragmentIndex = location.indexOf('#'); if (fragmentIndex >= 0) { - getWidget().currentFragment = location - .substring(fragmentIndex + 1); + // Decode fragment to avoid double encoding (#10769) + getWidget().currentFragment = URL.decodePathSegment(location + .substring(fragmentIndex + 1)); } if (!getWidget().currentFragment.equals(History.getToken())) { History.newItem(getWidget().currentFragment, true); diff --git a/uitest/src/com/vaadin/tests/navigator/NavigatorTest.html b/uitest/src/com/vaadin/tests/navigator/NavigatorTest.html index 030b30f37a..7eba02aa94 100644 --- a/uitest/src/com/vaadin/tests/navigator/NavigatorTest.html +++ b/uitest/src/com/vaadin/tests/navigator/NavigatorTest.html @@ -18,8 +18,13 @@ assertText - vaadin=runcomvaadintestsnavigatorNavigatorTest::/VVerticalLayout[0]/VOrderedLayout$Slot[4]/VVerticalLayout[0]/VOrderedLayout$Slot[0]/VLabel[0] - 1. Navigated to DefaultView with params + vaadin=runcomvaadintestsnavigatorNavigatorTest::PID_SLog_row_0 + 1. Navigated to DefaultView without params + + + assertText + vaadin=runcomvaadintestsnavigatorNavigatorTest::/VVerticalLayout[0]/Slot[6]/VVerticalLayout[0]/Slot[0]/VLabel[0] + Default view: click @@ -28,8 +33,13 @@ assertText - vaadin=runcomvaadintestsnavigatorNavigatorTest::/VVerticalLayout[0]/VOrderedLayout$Slot[4]/VVerticalLayout[0]/VOrderedLayout$Slot[0]/VLabel[0] - 2. Navigated to ListView with params + vaadin=runcomvaadintestsnavigatorNavigatorTest::PID_SLog_row_0 + 2. Navigated to ListView without params + + + assertElementPresent + vaadin=runcomvaadintestsnavigatorNavigatorTest::/VVerticalLayout[0]/Slot[6]/VVerticalLayout[0]/Slot[0]/VScrollTable[0] + assertLocation @@ -43,8 +53,13 @@ assertText - vaadin=runcomvaadintestsnavigatorNavigatorTest::/VVerticalLayout[0]/VOrderedLayout$Slot[4]/VVerticalLayout[0]/VOrderedLayout$Slot[0]/VLabel[0] - 3. Navigated to EditView with params + vaadin=runcomvaadintestsnavigatorNavigatorTest::PID_SLog_row_0 + 3. Navigated to EditView without params + + + assertElementPresent + vaadin=runcomvaadintestsnavigatorNavigatorTest::/VVerticalLayout[0]/Slot[6]/VVerticalLayout[0]/Slot[0]/VRichTextArea[0] + assertLocation @@ -53,12 +68,12 @@ mouseClick - vaadin=runcomvaadintestsnavigatorNavigatorTest::/VVerticalLayout[0]/VOrderedLayout$Slot[3]/VTextField[0] + vaadin=runcomvaadintestsnavigatorNavigatorTest::/VVerticalLayout[0]/Slot[4]/VTextField[0] 56,6 enterCharacter - vaadin=runcomvaadintestsnavigatorNavigatorTest::/VVerticalLayout[0]/VOrderedLayout$Slot[3]/VTextField[0] + vaadin=runcomvaadintestsnavigatorNavigatorTest::/VVerticalLayout[0]/Slot[4]/VTextField[0] param=value @@ -68,9 +83,19 @@ assertText - vaadin=runcomvaadintestsnavigatorNavigatorTest::/VVerticalLayout[0]/VOrderedLayout$Slot[4]/VVerticalLayout[0]/VOrderedLayout$Slot[0]/VLabel[0] + vaadin=runcomvaadintestsnavigatorNavigatorTest::PID_SLog_row_0 4. Navigated to ListView with params param=value + + assertText + vaadin=runcomvaadintestsnavigatorNavigatorTest::/VVerticalLayout[0]/Slot[6]/VVerticalLayout[0]/Slot[0]/VScrollTable[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[0]/domChild[0]/domChild[0] + param + + + assertText + vaadin=runcomvaadintestsnavigatorNavigatorTest::/VVerticalLayout[0]/Slot[6]/VVerticalLayout[0]/Slot[0]/VScrollTable[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[0]/domChild[1]/domChild[0] + value + assertLocation *#!list/param=value @@ -83,7 +108,7 @@ assertText - vaadin=runcomvaadintestsnavigatorNavigatorTest::/VVerticalLayout[0]/VOrderedLayout$Slot[4]/VVerticalLayout[0]/VOrderedLayout$Slot[0]/VLabel[0] + vaadin=runcomvaadintestsnavigatorNavigatorTest::PID_SLog_row_0 5. Navigated to EditView with params param=value @@ -98,7 +123,7 @@ assertText - vaadin=runcomvaadintestsnavigatorNavigatorTest::/VVerticalLayout[0]/VOrderedLayout$Slot[4]/VVerticalLayout[0]/VOrderedLayout$Slot[0]/VLabel[0] + vaadin=runcomvaadintestsnavigatorNavigatorTest::PID_SLog_row_0 6. Prevent navigation to ForbiddenView @@ -106,46 +131,124 @@ *#!edit/param=value + + click + vaadin=runcomvaadintestsnavigatorNavigatorTest::/VVerticalLayout[0]/Slot[3]/VButton[0]/domChild[0]/domChild[0] + + + + assertText + vaadin=runcomvaadintestsnavigatorNavigatorTest::PID_SLog_row_0 + 7. Navigated to SpecialCharsView: öääö !%&/()=; fragment: !öääö !%&/()=/param=value + + + assertText + vaadin=runcomvaadintestsnavigatorNavigatorTest::/VVerticalLayout[0]/Slot[6]/VVerticalLayout[0]/Slot[0]/VLabel[0] + öääö !%&/()= + + + assertLocation + *#!%C3%B6%C3%A4%C3%A4%C3%B6%20!%25&/()=/param=value + + + + runScript + window.location.hash='!foo bar' + + + + pause + 3000 + + + + assertText + vaadin=runcomvaadintestsnavigatorNavigatorTest::PID_SLog_row_0 + 8. View 'foo bar' not found! + + + assertText + vaadin=runcomvaadintestsnavigatorNavigatorTest::/VVerticalLayout[0]/Slot[6]/VVerticalLayout[0]/Slot[0]/VLabel[0] + Tried to navigate to foo bar but such a view could not be found :( + + + assertLocation + regex:.*#!foo( |%20)bar + + + + runScript + window.location.hash='!/foo=bar' + + + + pause + 3000 + + + + assertText + vaadin=runcomvaadintestsnavigatorNavigatorTest::PID_SLog_row_0 + 9. Navigated to DefaultView with params foo=bar + + + assertText + vaadin=runcomvaadintestsnavigatorNavigatorTest::/VVerticalLayout[0]/Slot[6]/VVerticalLayout[0]/Slot[0]/VLabel[0] + Default view: foo=bar + + + assertLocation + *#!/foo=bar + + runScript - window.location.hash='!foo' + window.location.hash='foo bar' pause - 1000 + 3000 assertText - vaadin=runcomvaadintestsnavigatorNavigatorTest::/VVerticalLayout[0]/VOrderedLayout$Slot[4]/VVerticalLayout[0]/VOrderedLayout$Slot[0]/VLabel[0] - 7. View 'foo' not found! + vaadin=runcomvaadintestsnavigatorNavigatorTest::PID_SLog_row_0 + 10. Navigated to DefaultView without params assertLocation - *#!foo + regex:.*#foo( |%20)bar + diff --git a/uitest/src/com/vaadin/tests/navigator/NavigatorTest.java b/uitest/src/com/vaadin/tests/navigator/NavigatorTest.java index f35c8b876d..81944abd40 100644 --- a/uitest/src/com/vaadin/tests/navigator/NavigatorTest.java +++ b/uitest/src/com/vaadin/tests/navigator/NavigatorTest.java @@ -37,7 +37,9 @@ public class NavigatorTest extends UI { @Override public void enter(ViewChangeEvent event) { String params = event.getParameters(); - log.log("Navigated to ListView with params " + params); + log.log("Navigated to ListView " + + (params.isEmpty() ? "without params" : "with params " + + params)); removeAllItems(); for (String arg : params.split(",")) { addItem(arg.split("=|$", 2), arg); @@ -49,19 +51,33 @@ public class NavigatorTest extends UI { @Override public void enter(ViewChangeEvent event) { - log.log("Navigated to EditView with params " - + event.getParameters()); - setValue("Displaying edit view with parameters " - + event.getParameters()); + String params = event.getParameters(); + log.log("Navigated to EditView " + + (params.isEmpty() ? "without params" : "with params " + + params)); + setValue("Displaying edit view with parameters " + params); } } + class SpecialCharsView extends Label implements View { + + @Override + public void enter(ViewChangeEvent event) { + log.log("Navigated to SpecialCharsView: " + event.getViewName() + + "; fragment: " + getPage().getUriFragment()); + setValue(event.getViewName()); + } + + } + class DefaultView extends Label implements View { @Override public void enter(ViewChangeEvent event) { - log.log("Navigated to DefaultView with params " - + event.getParameters()); + String params = event.getParameters(); + log.log("Navigated to DefaultView " + + (params.isEmpty() ? "without params" : "with params " + + params)); setValue("Default view: " + event.getParameters()); } } @@ -123,6 +139,7 @@ public class NavigatorTest extends UI { navi.addView("list", new ListView()); navi.addView("edit", new EditView()); + navi.addView("öääö !%&/()=", new SpecialCharsView()); navi.addView("forbidden", new ForbiddenView()); navi.addViewChangeListener(new NaviListener()); @@ -132,6 +149,7 @@ public class NavigatorTest extends UI { layout.addComponent(new NaviButton("list")); layout.addComponent(new NaviButton("edit")); layout.addComponent(new NaviButton("forbidden")); + layout.addComponent(new NaviButton("öääö !%&/()=")); layout.addComponent(params); layout.addComponent(log); -- cgit v1.2.3 From 184114b0881a5323139e5cafd6bd7e5c04afd8e2 Mon Sep 17 00:00:00 2001 From: John Ahlroos Date: Fri, 12 Apr 2013 10:35:36 +0000 Subject: Fixed Accordion tab stylenames which never got applied on the tab widgets #11645 (merged from #10605 in 6.8 branch) Change-Id: I6af93e3846ecedd31cb9afac6321316b122c9df5 --- client/src/com/vaadin/client/ui/VAccordion.java | 32 +++++++++++++++++ .../accordion/AccordionTabStylenames.html | 41 ++++++++++++++++++++++ .../accordion/AccordionTabStylenames.java | 32 +++++++++++++++++ 3 files changed, 105 insertions(+) create mode 100644 uitest/src/com/vaadin/tests/components/accordion/AccordionTabStylenames.html create mode 100644 uitest/src/com/vaadin/tests/components/accordion/AccordionTabStylenames.java (limited to 'uitest') diff --git a/client/src/com/vaadin/client/ui/VAccordion.java b/client/src/com/vaadin/client/ui/VAccordion.java index 6c4bd06b6d..f87186fe37 100644 --- a/client/src/com/vaadin/client/ui/VAccordion.java +++ b/client/src/com/vaadin/client/ui/VAccordion.java @@ -34,6 +34,7 @@ import com.vaadin.client.Util; import com.vaadin.client.VCaption; import com.vaadin.client.ui.TouchScrollDelegate.TouchScrollHandler; import com.vaadin.shared.ui.tabsheet.TabsheetBaseConstants; +import com.vaadin.shared.ui.tabsheet.TabsheetConstants; public class VAccordion extends VTabsheetBase { @@ -76,6 +77,9 @@ public class VAccordion extends VTabsheetBase { } item.updateCaption(tabUidl); + item.updateTabStyleName(tabUidl + .getStringAttribute(TabsheetConstants.TAB_STYLE_NAME)); + item.setVisible(!hidden); if (selected) { @@ -290,6 +294,7 @@ public class VAccordion extends VTabsheetBase { private boolean open = false; private Element content = DOM.createDiv(); private Element captionNode = DOM.createDiv(); + private String styleName; public StackItem(UIDL tabUidl) { setElement(DOM.createDiv()); @@ -312,6 +317,7 @@ public class VAccordion extends VTabsheetBase { captionNode.removeClassName(getStylePrimaryName() + "-caption"); setStylePrimaryName(primaryStyleName + "-item"); + updateTabStyleName(getStylePrimaryName()); captionNode.addClassName(getStylePrimaryName() + "-caption"); content.addClassName(getStylePrimaryName() + "-content"); @@ -399,6 +405,32 @@ public class VAccordion extends VTabsheetBase { uidl.getStringAttribute(TabsheetBaseConstants.ATTRIBUTE_TAB_ICON)); } + /** + * Updates a tabs stylename from the child UIDL + * + * @param uidl + * The child uidl of the tab + */ + private void updateTabStyleName(String newStyleName) { + if (newStyleName != null && newStyleName.length() != 0) { + if (!newStyleName.equals(styleName)) { + // If we have a new style name + if (styleName != null && styleName.length() != 0) { + // Remove old style name if present + removeStyleDependentName(styleName); + } + // Set new style name + addStyleDependentName(newStyleName); + styleName = newStyleName; + } + } else if (styleName != null) { + // Remove the set stylename if no stylename is present in the + // uidl + removeStyleDependentName(styleName); + styleName = null; + } + } + public int getWidgetWidth() { return DOM.getFirstChild(content).getOffsetWidth(); } diff --git a/uitest/src/com/vaadin/tests/components/accordion/AccordionTabStylenames.html b/uitest/src/com/vaadin/tests/components/accordion/AccordionTabStylenames.html new file mode 100644 index 0000000000..4870777717 --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/accordion/AccordionTabStylenames.html @@ -0,0 +1,41 @@ + + + + + + +New Test + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
New Test
open/run/com.vaadin.tests.components.accordion.AccordionTabStylenames?restartApplication
assertCSSClassvaadin=runcomvaadintestscomponentsaccordionAccordionTabStylenames::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VAccordion[0]/domChild[0]v-accordion-item-tab0
assertCSSClassvaadin=runcomvaadintestscomponentsaccordionAccordionTabStylenames::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VAccordion[0]/domChild[1]v-accordion-item-tab1
assertCSSClassvaadin=runcomvaadintestscomponentsaccordionAccordionTabStylenames::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VAccordion[0]/domChild[2]v-accordion-item-tab2
assertCSSClassvaadin=runcomvaadintestscomponentsaccordionAccordionTabStylenames::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VAccordion[0]/domChild[3]v-accordion-item-tab3
+ + diff --git a/uitest/src/com/vaadin/tests/components/accordion/AccordionTabStylenames.java b/uitest/src/com/vaadin/tests/components/accordion/AccordionTabStylenames.java new file mode 100644 index 0000000000..1412ae6289 --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/accordion/AccordionTabStylenames.java @@ -0,0 +1,32 @@ +package com.vaadin.tests.components.accordion; + +import com.vaadin.tests.components.TestBase; +import com.vaadin.ui.Accordion; +import com.vaadin.ui.Label; +import com.vaadin.ui.TabSheet.Tab; + +public class AccordionTabStylenames extends TestBase { + + @Override + protected void setup() { + Accordion acc = new Accordion(); + addComponent(acc); + + for (int tabIndex = 0; tabIndex < 5; tabIndex++) { + Tab tab = acc.addTab(new Label("Tab " + tabIndex)); + tab.setCaption("Tab " + tabIndex); + tab.setStyleName("tab" + tabIndex); + } + } + + @Override + protected String getDescription() { + return null; + } + + @Override + protected Integer getTicketNumber() { + return 10605; + } + +} -- cgit v1.2.3 From feb9a8c3510afc76c079fafcd9e507205bde139c Mon Sep 17 00:00:00 2001 From: Artur Signell Date: Tue, 23 Apr 2013 10:36:44 +0300 Subject: Different fix for #11152 which is restricted to the problematic case in horizontal layout Change-Id: I4727f0a8f0b82f14f059c7e47a1819a18630a4c0 --- WebContent/VAADIN/themes/base/common/common.scss | 6 --- WebContent/VAADIN/themes/base/layout/layout.scss | 5 ++ .../combobox/ComboBoxCursorPositionReset.java | 55 ++++++++++++++++++++++ 3 files changed, 60 insertions(+), 6 deletions(-) create mode 100644 uitest/src/com/vaadin/tests/components/combobox/ComboBoxCursorPositionReset.java (limited to 'uitest') diff --git a/WebContent/VAADIN/themes/base/common/common.scss b/WebContent/VAADIN/themes/base/common/common.scss index d6dfed11df..e7fdd3fe84 100644 --- a/WebContent/VAADIN/themes/base/common/common.scss +++ b/WebContent/VAADIN/themes/base/common/common.scss @@ -204,12 +204,6 @@ body &.v-app-loading { padding: 2px; } -/* Fix for IE9 caret bug #11152 */ -input, -textarea { - position: relative; -} - .v-drag-element { z-index: 60000; /* override any other position: properties */ diff --git a/WebContent/VAADIN/themes/base/layout/layout.scss b/WebContent/VAADIN/themes/base/layout/layout.scss index d49b2ad0dd..049c527518 100644 --- a/WebContent/VAADIN/themes/base/layout/layout.scss +++ b/WebContent/VAADIN/themes/base/layout/layout.scss @@ -105,6 +105,11 @@ div.v-layout.v-horizontal.v-widget { height: 100%; } +/* Workaround for IE8+IE9 bug where clicking inside an input area which is inside a div with negative margin causes cursor position to jump to wrong position. See #11152 */ +.v-horizontal > .v-expand > .v-slot { + position: relative; +} + .v-vertical > .v-spacing, .v-vertical > .v-expand > .v-spacing { width: 0; diff --git a/uitest/src/com/vaadin/tests/components/combobox/ComboBoxCursorPositionReset.java b/uitest/src/com/vaadin/tests/components/combobox/ComboBoxCursorPositionReset.java new file mode 100644 index 0000000000..20a62f2a33 --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/combobox/ComboBoxCursorPositionReset.java @@ -0,0 +1,55 @@ +/* + * Copyright 2000-2013 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.combobox; + +import com.vaadin.server.VaadinRequest; +import com.vaadin.tests.components.AbstractTestUI; +import com.vaadin.ui.ComboBox; +import com.vaadin.ui.HorizontalLayout; +import com.vaadin.ui.Label; + +public class ComboBoxCursorPositionReset extends AbstractTestUI { + + @Override + protected void setup(VaadinRequest request) { + final HorizontalLayout root = new HorizontalLayout(); + root.setSizeFull(); + setContent(root); + + ComboBox combo = new ComboBox(); + combo.setImmediate(true); + root.addComponent(combo); + combo.addItem("Hello World"); + combo.addItem("Please click on the text"); + + combo.setValue("Please click on the text"); + Label gap = new Label(); + root.addComponent(gap); + root.setExpandRatio(gap, 1); + + } + + @Override + protected String getTestDescription() { + return "Clicking on the text in the ComboBox should position the caret where you clicked, not cause it to jump to the start or the end"; + } + + @Override + protected Integer getTicketNumber() { + return 11152; + } + +} -- cgit v1.2.3