1 package com.vaadin.tests.server.component.abstractcomponent;
3 import junit.framework.TestCase;
5 import com.vaadin.ui.AbstractComponent;
7 public class AbstractComponentStyleNamesTest extends TestCase {
9 public void testSetMultiple() {
10 AbstractComponent component = getComponent();
11 component.setStyleName("style1 style2");
12 assertEquals(component.getStyleName(), "style1 style2");
15 public void testSetAdd() {
16 AbstractComponent component = getComponent();
17 component.setStyleName("style1");
18 component.addStyleName("style2");
19 assertEquals(component.getStyleName(), "style1 style2");
22 public void testAddSame() {
23 AbstractComponent component = getComponent();
24 component.setStyleName("style1 style2");
25 component.addStyleName("style1");
26 assertEquals(component.getStyleName(), "style1 style2");
29 public void testSetRemove() {
30 AbstractComponent component = getComponent();
31 component.setStyleName("style1 style2");
32 component.removeStyleName("style1");
33 assertEquals(component.getStyleName(), "style2");
36 public void testAddRemove() {
37 AbstractComponent component = getComponent();
38 component.addStyleName("style1");
39 component.addStyleName("style2");
40 component.removeStyleName("style1");
41 assertEquals(component.getStyleName(), "style2");
44 public void testRemoveMultipleWithExtraSpaces() {
45 AbstractComponent component = getComponent();
46 component.setStyleName("style1 style2 style3");
47 component.removeStyleName(" style1 style3 ");
48 assertEquals(component.getStyleName(), "style2");
51 public void testSetWithExtraSpaces() {
52 AbstractComponent component = getComponent();
53 component.setStyleName(" style1 style2 ");
54 assertEquals(component.getStyleName(), "style1 style2");
57 private AbstractComponent getComponent() {
58 return new AbstractComponent() {