From c5515074b54f37c21d021ab910d2749a9a1bc24d Mon Sep 17 00:00:00 2001 From: Tomi Virtanen Date: Wed, 27 Nov 2013 15:10:41 +0200 Subject: Selected option is updated when item caption changes in Select (#9250) Fixed ComboBoxConnector to update input-element text to match the changed item caption. Added SelectItemCaptionRefresh test case and TestBench2 (html) test for it. Change-Id: I45b2168aab27f83203a59500715ac9aca5357412 --- .../select/SelectItemCaptionRefresh.html | 47 ++++++++++++++ .../select/SelectItemCaptionRefresh.java | 75 ++++++++++++++++++++++ 2 files changed, 122 insertions(+) create mode 100644 uitest/src/com/vaadin/tests/components/select/SelectItemCaptionRefresh.html create mode 100644 uitest/src/com/vaadin/tests/components/select/SelectItemCaptionRefresh.java (limited to 'uitest') diff --git a/uitest/src/com/vaadin/tests/components/select/SelectItemCaptionRefresh.html b/uitest/src/com/vaadin/tests/components/select/SelectItemCaptionRefresh.html new file mode 100644 index 0000000000..2f8532de61 --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/select/SelectItemCaptionRefresh.html @@ -0,0 +1,47 @@ + + + + + + +SelectItemCaptionRefresh + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
SelectItemCaptionRefresh
open/run/com.vaadin.tests.components.select.SelectItemCaptionRefresh?restartApplication
mouseClickvaadin=runcomvaadintestscomponentsselectSelectItemCaptionRefresh::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VFilterSelect[0]#button10,14
mouseClick//div[@id='VAADIN_COMBOBOX_OPTIONLIST']/div/div[2]/table/tbody/tr[2]/td/span16,11
verifyValuevaadin=runcomvaadintestscomponentsselectSelectItemCaptionRefresh::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VFilterSelect[0]#textboxstart
clickvaadin=runcomvaadintestscomponentsselectSelectItemCaptionRefresh::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[1]/VButton[0]/domChild[0]
verifyValuevaadin=runcomvaadintestscomponentsselectSelectItemCaptionRefresh::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VFilterSelect[0]#textbox0
+ + diff --git a/uitest/src/com/vaadin/tests/components/select/SelectItemCaptionRefresh.java b/uitest/src/com/vaadin/tests/components/select/SelectItemCaptionRefresh.java new file mode 100644 index 0000000000..1a1a8fa642 --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/select/SelectItemCaptionRefresh.java @@ -0,0 +1,75 @@ +/* + * 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.select; + +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.Select; + +public class SelectItemCaptionRefresh extends AbstractTestUI { + + final Object itemId = new Object(); + Select select; + + Button.ClickListener clickListener = new Button.ClickListener() { + Integer i = Integer.valueOf(0); + + @Override + public void buttonClick(final ClickEvent event) { + select.setItemCaption(itemId, (i++).toString()); + } + }; + + /* + * (non-Javadoc) + * + * @see com.vaadin.tests.components.AbstractTestUI#setup(com.vaadin.server. + * VaadinRequest) + */ + @Override + protected void setup(VaadinRequest request) { + select = new Select("Foo"); + + select.addItem(itemId); + select.setItemCaption(itemId, "start"); + + addComponent(select); + addComponent(new Button("click", clickListener)); + } + + /* + * (non-Javadoc) + * + * @see com.vaadin.tests.components.AbstractTestUI#getTestDescription() + */ + @Override + protected String getTestDescription() { + return "Selected option not updated when item caption changes in Select"; + } + + /* + * (non-Javadoc) + * + * @see com.vaadin.tests.components.AbstractTestUI#getTicketNumber() + */ + @Override + protected Integer getTicketNumber() { + return 9250; + } + +} -- cgit v1.2.3