summaryrefslogtreecommitdiffstats
path: root/compatibility-server
diff options
context:
space:
mode:
authorDenis Anisimov <denis@vaadin.com>2016-10-17 16:43:43 +0300
committerVaadin Code Review <review@vaadin.com>2016-10-21 08:44:19 +0000
commit203baea2fbc3dead5831ffba7f32cf66094f8ae8 (patch)
tree49db641badcede347959898ce64941ff540969bd /compatibility-server
parent6541122062aaceeb545732c6e8fe707bdb439c89 (diff)
downloadvaadin-framework-203baea2fbc3dead5831ffba7f32cf66094f8ae8.tar.gz
vaadin-framework-203baea2fbc3dead5831ffba7f32cf66094f8ae8.zip
Provide declarative tests for all V7 field components.
Change-Id: I6bd65efe355730f358fdbc38b9cc592e27077de2
Diffstat (limited to 'compatibility-server')
-rw-r--r--compatibility-server/src/test/java/com/vaadin/tests/server/component/slider/SliderDeclarativeTest.java83
1 files changed, 53 insertions, 30 deletions
diff --git a/compatibility-server/src/test/java/com/vaadin/tests/server/component/slider/SliderDeclarativeTest.java b/compatibility-server/src/test/java/com/vaadin/tests/server/component/slider/SliderDeclarativeTest.java
index dcfb415810..0f75ea8099 100644
--- a/compatibility-server/src/test/java/com/vaadin/tests/server/component/slider/SliderDeclarativeTest.java
+++ b/compatibility-server/src/test/java/com/vaadin/tests/server/component/slider/SliderDeclarativeTest.java
@@ -18,7 +18,7 @@ package com.vaadin.tests.server.component.slider;
import org.junit.Test;
import com.vaadin.shared.ui.slider.SliderOrientation;
-import com.vaadin.tests.design.DeclarativeTestBase;
+import com.vaadin.tests.server.component.abstractfield.AbstractFieldDeclarativeTest;
import com.vaadin.ui.Slider;
/**
@@ -27,55 +27,78 @@ import com.vaadin.ui.Slider;
* @since
* @author Vaadin Ltd
*/
-public class SliderDeclarativeTest extends DeclarativeTestBase<Slider> {
+public class SliderDeclarativeTest
+ extends AbstractFieldDeclarativeTest<Slider, Double> {
+ @Override
@Test
- public void testDefault() {
- String design = "<vaadin-slider>";
+ public void valueDeserialization()
+ throws InstantiationException, IllegalAccessException {
+ Double value = 12.3;
+ int resolution = 1;
+ String design = String.format("<%s resolution=%d value='%s'/>",
+ getComponentTag(), resolution, value);
- Slider expected = new Slider();
+ Slider component = new Slider();
+ component.setResolution(resolution);
+ component.setValue(value);
- testRead(design, expected);
- testWrite(design, expected);
+ testRead(design, component);
+ testWrite(design, component);
}
@Test
- public void testHorizontal() {
- String design = "<vaadin-slider min=10 max=20 resolution=1 value=12.3>";
+ public void testVertical() {
+ String design = "<vaadin-slider vertical>";
Slider expected = new Slider();
- expected.setMin(10.0);
- expected.setMax(20.0);
- expected.setResolution(1);
- expected.setValue(12.3);
+ expected.setOrientation(SliderOrientation.VERTICAL);
testRead(design, expected);
testWrite(design, expected);
}
- @Test
- public void testVertical() {
- String design = "<vaadin-slider vertical>";
+ @Override
+ public void readOnlyValue()
+ throws InstantiationException, IllegalAccessException {
+ Double value = 12.3;
+ int resolution = 1;
+ String design = String.format("<%s resolution=%d readonly value='%s'/>",
+ getComponentTag(), resolution, value);
- Slider expected = new Slider();
- expected.setOrientation(SliderOrientation.VERTICAL);
+ Slider component = new Slider();
+ component.setResolution(resolution);
+ component.setValue(value);
- testRead(design, expected);
- testWrite(design, expected);
+ component.setReadOnly(true);
+ testRead(design, component);
+ testWrite(design, component);
}
@Test
- public void testReadOnlyValue() {
- String design = "<vaadin-slider readonly min=10 max=20 resolution=1 value=12.3>";
+ public void remainingAttributeDeserialization() {
+ int min = 3;
+ int max = 47;
+ String design = String.format("<%s min=%d value=%d max='%d'/>",
+ getComponentTag(), min, min, max);
- Slider expected = new Slider();
- expected.setMin(10.0);
- expected.setMax(20.0);
- expected.setResolution(1);
- expected.setValue(12.3);
- expected.setReadOnly(true);
+ Slider component = new Slider();
+ component.setMin(min);
+ component.setMax(max);
+ component.setOrientation(SliderOrientation.HORIZONTAL);
- testRead(design, expected);
- testWrite(design, expected);
+ testRead(design, component);
+ testWrite(design, component);
}
+
+ @Override
+ protected String getComponentTag() {
+ return "vaadin-slider";
+ }
+
+ @Override
+ protected Class<Slider> getComponentClass() {
+ return Slider.class;
+ }
+
}