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.

Imports.java 1.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. /*
  2. * Copyright 2000-2013 Vaadin Ltd.
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License"); you may not
  5. * use this file except in compliance with the License. You may obtain a copy of
  6. * the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
  12. * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
  13. * License for the specific language governing permissions and limitations under
  14. * the License.
  15. */
  16. package com.vaadin.sass.testcases.scss;
  17. import java.io.IOException;
  18. import junit.framework.Assert;
  19. import org.junit.Test;
  20. import org.w3c.css.sac.CSSException;
  21. import com.vaadin.sass.AbstractTestBase;
  22. import com.vaadin.sass.internal.ScssStylesheet;
  23. import com.vaadin.sass.internal.handler.SCSSDocumentHandler;
  24. import com.vaadin.sass.internal.handler.SCSSDocumentHandlerImpl;
  25. import com.vaadin.sass.internal.parser.Parser;
  26. import com.vaadin.sass.internal.tree.ImportNode;
  27. public class Imports extends AbstractTestBase {
  28. String scss = "/scss/imports.scss";
  29. String css = "/css/imports.css";
  30. @Test
  31. public void testParser() throws CSSException, IOException {
  32. Parser parser = new Parser();
  33. SCSSDocumentHandler handler = new SCSSDocumentHandlerImpl();
  34. parser.setDocumentHandler(handler);
  35. parser.parseStyleSheet(getClass().getResource(scss).getPath());
  36. ScssStylesheet root = handler.getStyleSheet();
  37. ImportNode importNode = (ImportNode) root.getChildren().get(0);
  38. Assert.assertEquals("_partial-for-import", importNode.getUri());
  39. Assert.assertFalse(importNode.isPureCssImport());
  40. }
  41. @Test
  42. public void testCompiler() throws Exception {
  43. testCompiler(scss, css);
  44. }
  45. }