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.

Functions.java 1.8KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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 org.junit.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.BlockNode;
  27. public class Functions extends AbstractTestBase {
  28. String scss = "/scss/functions.scss";
  29. String css = "/css/functions.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. Assert.assertEquals(3, root.getChildren().size());
  38. BlockNode blockNode = (BlockNode) root.getChildren().get(2);
  39. Assert.assertEquals(14, blockNode.getChildren().size());
  40. }
  41. @Test
  42. public void testCompiler() throws Exception {
  43. testCompiler(scss, css);
  44. }
  45. }