1 29 30 package nextapp.echo2.webrender.test; 31 32 import junit.framework.TestCase; 33 import nextapp.echo2.webrender.output.CssStyle; 34 35 38 public class CssStyleTest 39 extends TestCase { 40 41 44 public void testBasic() { 45 CssStyle style = new CssStyle(); 46 assertNull(style.getAttribute("color")); 47 assertEquals("", style.renderInline()); 48 assertFalse(style.hasAttributes()); 49 50 style.setAttribute("border", "10px solid red"); 51 assertEquals("10px solid red", style.getAttribute("border")); 52 assertEquals("border:10px solid red;", style.renderInline()); 53 assertTrue(style.hasAttributes()); 54 55 style.setAttribute("border", "10px solid blue"); 56 assertEquals("10px solid blue", style.getAttribute("border")); 57 assertEquals("border:10px solid blue;", style.renderInline()); 58 59 style.setAttribute("background-color", "green"); 60 assertEquals("border:10px solid blue;background-color:green;", style.renderInline()); 63 64 assertNull(style.getAttribute("color")); 65 assertEquals("10px solid blue", style.getAttribute("border")); 66 assertEquals("green", style.getAttribute("background-color")); 67 } 68 } 69 | Popular Tags |