Search in sources :

Example 1 with ElementInfo

use of org.eclipse.mylyn.wikitext.parser.css.ElementInfo in project mylyn.docs by eclipse.

the class HtmlTextPresentationParserTest method assertDefaultCssStyles.

private void assertDefaultCssStyles(String expectedStyles, final String elementName) {
    Stylesheet stylesheet = defaultStylesheet();
    final List<String> styles = new ArrayList<>();
    Receiver receiver = new Receiver() {

        @Override
        public void apply(CssRule rule) {
            styles.add(rule.name + ": " + rule.value);
        }
    };
    stylesheet.applyTo(new ElementInfo() {

        @Override
        public boolean hasId(String id) {
            return false;
        }

        @Override
        public boolean hasCssClass(String cssClass) {
            return false;
        }

        @Override
        public ElementInfo getParent() {
            return null;
        }

        @Override
        public String getLocalName() {
            return elementName;
        }
    }, receiver);
    assertEquals("element " + elementName, expectedStyles, Joiner.on("; ").join(styles));
}
Also used : CssRule(org.eclipse.mylyn.wikitext.parser.css.CssRule) ElementInfo(org.eclipse.mylyn.wikitext.parser.css.ElementInfo) ArrayList(java.util.ArrayList) Receiver(org.eclipse.mylyn.wikitext.parser.css.Stylesheet.Receiver) Stylesheet(org.eclipse.mylyn.wikitext.parser.css.Stylesheet)

Aggregations

ArrayList (java.util.ArrayList)1 CssRule (org.eclipse.mylyn.wikitext.parser.css.CssRule)1 ElementInfo (org.eclipse.mylyn.wikitext.parser.css.ElementInfo)1 Stylesheet (org.eclipse.mylyn.wikitext.parser.css.Stylesheet)1 Receiver (org.eclipse.mylyn.wikitext.parser.css.Stylesheet.Receiver)1