@Test public void testGetOriginAfterRemovingRuleFromStylesheet() { Rule instance = new Rule(Collections.EMPTY_LIST, Collections.EMPTY_LIST); Stylesheet stylesheet = new Stylesheet(); stylesheet.getRules().add(instance); stylesheet.setOrigin(StyleOrigin.INLINE); stylesheet.getRules().remove(instance); StyleOrigin result = instance.getOrigin(); assertNull(result); }
private static Style createStyle(String stylesheetText) { Stylesheet stylesheet = CSSParser.getInstance().parse(stylesheetText); Rule rule = stylesheet.getRules().get(0); Selector sel = rule.getUnobservedSelectorList().get(0); Declaration decl = rule.getUnobservedDeclarationList().get(0); return new Style(sel, decl); }
@Test public void testGetStylesheet() { Rule instance = new Rule(Collections.EMPTY_LIST, Collections.EMPTY_LIST); Stylesheet expResult = new Stylesheet(); expResult.getRules().add(instance); Stylesheet result = instance.getStylesheet(); assertEquals(expResult, result); }
@Test public void testGetOriginAfterSettingOriginBeforeAddingRuleToStylesheet() { Rule instance = new Rule(Collections.EMPTY_LIST, Collections.EMPTY_LIST); Stylesheet stylesheet = new Stylesheet(); stylesheet.setOrigin(StyleOrigin.INLINE); stylesheet.getRules().add(instance); StyleOrigin expResult = StyleOrigin.INLINE; StyleOrigin result = instance.getOrigin(); assertEquals(expResult, result); }