You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Extends.java 1.3KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. package com.vaadin.sass.testcases.scss;
  2. import java.io.IOException;
  3. import java.net.URISyntaxException;
  4. import org.junit.Assert;
  5. import org.junit.Test;
  6. import org.w3c.css.sac.CSSException;
  7. import com.vaadin.sass.ScssStylesheet;
  8. import com.vaadin.sass.TestBase;
  9. import com.vaadin.sass.handler.SCSSDocumentHandler;
  10. import com.vaadin.sass.handler.SCSSDocumentHandlerImpl;
  11. import com.vaadin.sass.parser.Parser;
  12. import com.vaadin.sass.tree.ExtendNode;
  13. public class Extends extends TestBase {
  14. String scss = "/scss/extends.scss";
  15. String css = "/css/extends.css";
  16. @Test
  17. public void testParser() throws CSSException, URISyntaxException,
  18. IOException {
  19. Parser parser = new Parser();
  20. SCSSDocumentHandler handler = new SCSSDocumentHandlerImpl();
  21. parser.setDocumentHandler(handler);
  22. parser.parseStyleSheet(getClass().getResource(scss).getPath());
  23. ScssStylesheet root = handler.getStyleSheet();
  24. Assert.assertTrue(root.getChildren().get(2).getChildren().get(0) instanceof ExtendNode);
  25. }
  26. @Test
  27. public void testCompiler() throws CSSException, URISyntaxException,
  28. IOException {
  29. testCompiler(scss, css);
  30. Assert.assertEquals("Original CSS and parsed CSS doesn't match",
  31. comparisonCss, parsedScss);
  32. }
  33. }