diff options
author | Artur Signell <artur@vaadin.com> | 2013-05-28 19:52:21 +0300 |
---|---|---|
committer | Vaadin Code Review <review@vaadin.com> | 2013-05-29 13:42:04 +0000 |
commit | a5b8209d928815aab9eee2151bdd00686a2b0ff7 (patch) | |
tree | 8a0cd2d8bbe50dbdeb156b64af0c3883df5622a7 /uitest | |
parent | 91182e237f2f4f8784582887970c32b5be3ad7c5 (diff) | |
download | vaadin-framework-a5b8209d928815aab9eee2151bdd00686a2b0ff7.tar.gz vaadin-framework-a5b8209d928815aab9eee2151bdd00686a2b0ff7.zip |
Add primary style name support for ProgressBar/Indicator (#9913)
Change-Id: I3d773640d2f1c8cd1b71c673685afd7059811d16
Diffstat (limited to 'uitest')
3 files changed, 183 insertions, 0 deletions
diff --git a/uitest/src/com/vaadin/tests/components/AbstractComponentTestCase.java b/uitest/src/com/vaadin/tests/components/AbstractComponentTestCase.java index 81ec4a9da4..8666956bdb 100644 --- a/uitest/src/com/vaadin/tests/components/AbstractComponentTestCase.java +++ b/uitest/src/com/vaadin/tests/components/AbstractComponentTestCase.java @@ -226,6 +226,13 @@ public abstract class AbstractComponentTestCase<T extends AbstractComponent> } }; + protected Command<T, String> primaryStyleNameCommand = new Command<T, String>() { + @Override + public void execute(T c, String value, Object data) { + c.setPrimaryStyleName(value); + } + }; + @Override protected String getDescription() { return "Generic test case for " + getTestClass().getSimpleName(); diff --git a/uitest/src/com/vaadin/tests/components/progressindicator/ProgressBarGenericTest.java b/uitest/src/com/vaadin/tests/components/progressindicator/ProgressBarGenericTest.java new file mode 100644 index 0000000000..79797c60a2 --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/progressindicator/ProgressBarGenericTest.java @@ -0,0 +1,55 @@ +package com.vaadin.tests.components.progressindicator; + +import java.util.LinkedHashMap; + +import com.vaadin.tests.components.abstractfield.AbstractFieldTest; +import com.vaadin.ui.ProgressBar; + +public class ProgressBarGenericTest extends AbstractFieldTest<ProgressBar> { + + private Command<ProgressBar, Boolean> indeterminate = new Command<ProgressBar, Boolean>() { + + @Override + public void execute(ProgressBar c, Boolean value, Object data) { + c.setIndeterminate(value); + } + }; + + @Override + protected Class<ProgressBar> getTestClass() { + return ProgressBar.class; + } + + @Override + protected void createActions() { + super.createActions(); + createBooleanAction("Indeterminate", CATEGORY_FEATURES, false, + indeterminate, null); + createValueSelection(CATEGORY_FEATURES); + createPrimaryStyleNameSelect(); + } + + /** + * @since + */ + protected void createPrimaryStyleNameSelect() { + LinkedHashMap<String, String> options = new LinkedHashMap<String, String>(); + String primaryStyle = getComponent().getPrimaryStyleName(); + options.put(primaryStyle, primaryStyle); + options.put(primaryStyle + "-foo", primaryStyle + "-foo"); + options.put("foo", "foo"); + createSelectAction("Primary style name", CATEGORY_DECORATIONS, options, + primaryStyle, primaryStyleNameCommand); + + } + + private void createValueSelection(String categorySelection) { + LinkedHashMap<String, Object> options = new LinkedHashMap<String, Object>(); + options.put("null", null); + for (float f = 0; f <= 1; f += 0.1) { + options.put("" + f, f); + } + createSelectAction("Value", categorySelection, options, null, + setValueCommand); + } +} diff --git a/uitest/src/com/vaadin/tests/components/progressindicator/ProgressBarPrimaryStyleName.html b/uitest/src/com/vaadin/tests/components/progressindicator/ProgressBarPrimaryStyleName.html new file mode 100644 index 0000000000..92f678947a --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/progressindicator/ProgressBarPrimaryStyleName.html @@ -0,0 +1,121 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> +<head profile="http://selenium-ide.openqa.org/profiles/test-case"> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> +<link rel="selenium.base" href="http://localhost:8888/" /> +<title>New Test</title> +</head> +<body> +<table cellpadding="1" cellspacing="1" border="1"> +<thead> +<tr><td rowspan="1" colspan="3">New Test</td></tr> +</thead><tbody> +<tr> + <td>open</td> + <td>/run/com.vaadin.tests.components.progressindicator.ProgressBarGenericTest?restartApplication</td> + <td></td> +</tr> +<tr> + <td>assertCSSClass</td> + <td>vaadin=runcomvaadintestscomponentsprogressindicatorProgressBarGenericTest::PID_StestComponent</td> + <td>v-progressbar</td> +</tr> +<tr> + <td>assertCSSClass</td> + <td>vaadin=runcomvaadintestscomponentsprogressindicatorProgressBarGenericTest::PID_StestComponent/domChild[0]</td> + <td>v-progressbar-wrapper</td> +</tr> +<tr> + <td>assertCSSClass</td> + <td>vaadin=runcomvaadintestscomponentsprogressindicatorProgressBarGenericTest::PID_StestComponent/domChild[0]/domChild[0]</td> + <td>v-progressbar-indicator</td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentsprogressindicatorProgressBarGenericTest::PID_Smenu#item0</td> + <td>36,8</td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentsprogressindicatorProgressBarGenericTest::Root/VOverlay[0]/VMenuBar[0]#item1</td> + <td>45,4</td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentsprogressindicatorProgressBarGenericTest::Root/VOverlay[1]/VMenuBar[0]#item6</td> + <td>67,10</td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentsprogressindicatorProgressBarGenericTest::Root/VOverlay[2]/VMenuBar[0]#item2</td> + <td>37,7</td> +</tr> +<tr> + <td>assertNotCSSClass</td> + <td>vaadin=runcomvaadintestscomponentsprogressindicatorProgressBarGenericTest::PID_StestComponent</td> + <td>v-progressbar</td> +</tr> +<tr> + <td>assertCSSClass</td> + <td>vaadin=runcomvaadintestscomponentsprogressindicatorProgressBarGenericTest::PID_StestComponent</td> + <td>foo</td> +</tr> +<tr> + <td>assertNotCSSClass</td> + <td>vaadin=runcomvaadintestscomponentsprogressindicatorProgressBarGenericTest::PID_StestComponent/domChild[0]</td> + <td>v-progressbar-wrapper</td> +</tr> +<tr> + <td>assertCSSClass</td> + <td>vaadin=runcomvaadintestscomponentsprogressindicatorProgressBarGenericTest::PID_StestComponent/domChild[0]</td> + <td>foo-wrapper</td> +</tr> +<tr> + <td>assertNotCSSClass</td> + <td>vaadin=runcomvaadintestscomponentsprogressindicatorProgressBarGenericTest::PID_StestComponent/domChild[0]/domChild[0]</td> + <td>v-progressbar-indicator</td> +</tr> +<tr> + <td>assertCSSClass</td> + <td>vaadin=runcomvaadintestscomponentsprogressindicatorProgressBarGenericTest::PID_StestComponent/domChild[0]/domChild[0]</td> + <td>foo-indicator</td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentsprogressindicatorProgressBarGenericTest::PID_Smenu#item0</td> + <td>20,13</td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentsprogressindicatorProgressBarGenericTest::Root/VOverlay[0]/VMenuBar[0]#item1</td> + <td>34,11</td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentsprogressindicatorProgressBarGenericTest::Root/VOverlay[1]/VMenuBar[0]#item6</td> + <td>51,4</td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentsprogressindicatorProgressBarGenericTest::Root/VOverlay[2]/VMenuBar[0]#item0</td> + <td>38,6</td> +</tr> +<tr> + <td>assertCSSClass</td> + <td>vaadin=runcomvaadintestscomponentsprogressindicatorProgressBarGenericTest::PID_StestComponent</td> + <td>v-progressbar</td> +</tr> +<tr> + <td>assertCSSClass</td> + <td>vaadin=runcomvaadintestscomponentsprogressindicatorProgressBarGenericTest::PID_StestComponent/domChild[0]</td> + <td>v-progressbar-wrapper</td> +</tr> +<tr> + <td>assertCSSClass</td> + <td>vaadin=runcomvaadintestscomponentsprogressindicatorProgressBarGenericTest::PID_StestComponent/domChild[0]/domChild[0]</td> + <td>v-progressbar-indicator</td> +</tr> +</tbody></table> +</body> +</html> |