From 21bf33e29323d65b3e7c3b7ecdfba39db69d8e00 Mon Sep 17 00:00:00 2001 From: Artur Signell Date: Tue, 18 Sep 2012 17:40:12 +0300 Subject: Ensure propertyDataSource can be set back to null (#9618) Added additional tests for Label with a data source. Note that the locale dependent tests still fail because of #8192 --- .../components/label/LabelPropertySourceValue.html | 51 +++++++++++++++++++++- .../components/label/LabelPropertySourceValue.java | 35 ++++++++++----- 2 files changed, 75 insertions(+), 11 deletions(-) (limited to 'uitest/src/com/vaadin/tests/components') diff --git a/uitest/src/com/vaadin/tests/components/label/LabelPropertySourceValue.html b/uitest/src/com/vaadin/tests/components/label/LabelPropertySourceValue.html index bda4403b2b..e62ef4bba1 100644 --- a/uitest/src/com/vaadin/tests/components/label/LabelPropertySourceValue.html +++ b/uitest/src/com/vaadin/tests/components/label/LabelPropertySourceValue.html @@ -21,6 +21,7 @@ //div[@id='runLabelPropertySourceValue-596713704']/div/div[2]/div[2]/div/div/div Hello Vaadin user + click vaadin=runLabelPropertySourceValue::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VButton[0]/domChild[0] @@ -31,7 +32,55 @@ vaadin=runLabelPropertySourceValue::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[0]/VLabel[0] This text should appear on the label after clicking the button. - + + + click + vaadin=runLabelPropertySourceValue::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[2]/VButton[0]/domChild[0]/domChild[0] + + + + assertText + vaadin=runLabelPropertySourceValue::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[0]/VLabel[0] + This text should appear on the label after clicking the button. + + + + click + vaadin=runLabelPropertySourceValue::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[3]/VButton[0]/domChild[0]/domChild[0] + + + + assertText + vaadin=runLabelPropertySourceValue::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[0]/VLabel[0] + foo + + + + click + vaadin=runLabelPropertySourceValue::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VButton[0]/domChild[0] + + + + assertText + vaadin=runLabelPropertySourceValue::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[0]/VLabel[0] + This text should appear on the label after clicking the button. + + + + click + vaadin=runLabelPropertySourceValue::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[3]/VButton[0]/domChild[0]/domChild[0] + + + + assertText + vaadin=runLabelPropertySourceValue::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[0]/VLabel[0] + This text should appear on the label after clicking the button. + + + assertCSSClass + vaadin=runLabelPropertySourceValue::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[3]/VButton[0]/domChild[0]/domChild[0] + v-errorindicator + diff --git a/uitest/src/com/vaadin/tests/components/label/LabelPropertySourceValue.java b/uitest/src/com/vaadin/tests/components/label/LabelPropertySourceValue.java index fdbb3caddb..c3d0d9cccd 100644 --- a/uitest/src/com/vaadin/tests/components/label/LabelPropertySourceValue.java +++ b/uitest/src/com/vaadin/tests/components/label/LabelPropertySourceValue.java @@ -5,28 +5,43 @@ import com.vaadin.server.WrappedRequest; 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; -public class LabelPropertySourceValue extends AbstractTestUI implements - Button.ClickListener { +public class LabelPropertySourceValue extends AbstractTestUI { private Label label; @Override public void setup(WrappedRequest request) { label = new Label("Hello Vaadin user"); + addComponent(label); Button button = new Button("Give label a new property data source..."); - button.addClickListener(this); + button.addClickListener(new ClickListener() { + public void buttonClick(ClickEvent event) { + ObjectProperty p = new ObjectProperty( + "This text should appear on the label after clicking the button."); + + label.setPropertyDataSource(p); + } + }); + addComponent(button); + button = new Button("Remove data source", new ClickListener() { - addComponent(label); + @Override + public void buttonClick(ClickEvent event) { + label.setPropertyDataSource(null); + } + }); addComponent(button); - } - public void buttonClick(ClickEvent event) { - ObjectProperty p = new ObjectProperty( - "This text should appear on the label after clicking the button."); + button = new Button("Set label value to 'foo'", new ClickListener() { - label.setPropertyDataSource(p); - // + @Override + public void buttonClick(ClickEvent event) { + label.setValue("foo"); + } + }); + addComponent(button); } @Override -- cgit v1.2.3