aboutsummaryrefslogtreecommitdiffstats
path: root/uitest/src/com/vaadin/tests/components/AddRemoveSetStyleNamesTest.java
diff options
context:
space:
mode:
authorArtur Signell <artur@vaadin.com>2012-08-30 17:24:36 +0300
committerArtur Signell <artur@vaadin.com>2012-08-30 17:24:36 +0300
commit7b25b3886ea95bc6495506fbe9472e45fcbde684 (patch)
tree0b93cb65dab437feb46720659a63b8f1ef48f7f4 /uitest/src/com/vaadin/tests/components/AddRemoveSetStyleNamesTest.java
parent8941056349e302e687e40e94c13709e75f256d73 (diff)
downloadvaadin-framework-7b25b3886ea95bc6495506fbe9472e45fcbde684.tar.gz
vaadin-framework-7b25b3886ea95bc6495506fbe9472e45fcbde684.zip
Renamed tests -> uitest and tests/testbench -> uitest/src (#9299)
Diffstat (limited to 'uitest/src/com/vaadin/tests/components/AddRemoveSetStyleNamesTest.java')
-rw-r--r--uitest/src/com/vaadin/tests/components/AddRemoveSetStyleNamesTest.java83
1 files changed, 83 insertions, 0 deletions
diff --git a/uitest/src/com/vaadin/tests/components/AddRemoveSetStyleNamesTest.java b/uitest/src/com/vaadin/tests/components/AddRemoveSetStyleNamesTest.java
new file mode 100644
index 0000000000..926af72a2f
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/AddRemoveSetStyleNamesTest.java
@@ -0,0 +1,83 @@
+package com.vaadin.tests.components;
+
+import com.vaadin.ui.Button;
+import com.vaadin.ui.Button.ClickEvent;
+import com.vaadin.ui.PopupDateField;
+
+public class AddRemoveSetStyleNamesTest extends TestBase {
+
+ private String style1 = "style1";
+ private String style2 = "style2";
+ private String thestyle = "thestyle";
+
+ private PopupDateField popupDateField;
+ private Button button1;
+ private Button button2;
+ private Button button3;
+
+ private Button.ClickListener listener;
+
+ @Override
+ protected void setup() {
+ popupDateField = new PopupDateField("PopupDateField");
+ popupDateField.setRequired(true);
+ popupDateField.setRequiredError("abcd");
+ addComponent(popupDateField);
+
+ listener = new Button.ClickListener() {
+
+ @Override
+ public void buttonClick(ClickEvent event) {
+ String style = (String) event.getButton().getData();
+ setComponentsStyle(style, !popupDateField.getStyleName()
+ .contains(style), event.getButton());
+ }
+ };
+
+ button1 = new Button("Add style1", listener);
+ button1.setData(style1);
+ addComponent(button1);
+
+ button2 = new Button("Add style2", listener);
+ button2.setData(style2);
+ addComponent(button2);
+
+ button3 = new Button("Set thestyle", new Button.ClickListener() {
+
+ @Override
+ public void buttonClick(ClickEvent event) {
+ if (popupDateField.getStyleName().contains(thestyle)) {
+ popupDateField.removeStyleName(thestyle);
+ button3.setCaption("Set thestyle");
+ } else {
+ popupDateField.setStyleName(thestyle);
+ button1.setCaption("Add style1");
+ button2.setCaption("Add style2");
+ button3.setCaption("Remove thestyle");
+ }
+ }
+ });
+ addComponent(button3);
+ }
+
+ private void setComponentsStyle(String style, boolean add, Button button) {
+ if (add) {
+ popupDateField.addStyleName(style);
+ button.setCaption("Remove " + style);
+ } else {
+ popupDateField.removeStyleName(style);
+ button.setCaption("Add " + style);
+ }
+ }
+
+ @Override
+ protected String getDescription() {
+ return "If a widget has set multiple css class names, AbtractComponentConnector.getStyleNames() removes all but first one of them. This is not acceptable, because we should be able to create connector for any existing GWT component and thus we do not know it it depends on multiple css class names.";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 8664;
+ }
+
+} \ No newline at end of file