summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--theme-compiler/tests/resources/automatic/scss/foo/_bar.scss (renamed from theme-compiler/tests/resources/automatic/scss/foo/bar.scss)0
-rw-r--r--theme-compiler/tests/resources/automatic/scss/import-file-which-contains-comment-in-last-line.scss2
-rw-r--r--theme-compiler/tests/resources/automatic/scss/nested-import.scss2
-rw-r--r--theme-compiler/tests/resources/automatic/scss/to-be-imported/_imported-file-contains-comments-in-last-line.scss (renamed from theme-compiler/tests/resources/automatic/scss/to-be-imported/imported-file-contains-comments-in-last-line.scss)0
-rw-r--r--theme-compiler/tests/resources/automatic/scss/url-path.scss2
-rw-r--r--theme-compiler/tests/resources/automatic/scss/utf8-imported/_to-be-imported-scss-file-contains-utf8.scss (renamed from theme-compiler/tests/resources/automatic/scss/utf8-imported/to-be-imported-scss-file-contains-utf8.scss)0
-rw-r--r--theme-compiler/tests/resources/automatic/scss/utf8.scss2
-rw-r--r--theme-compiler/tests/src/com/vaadin/sass/testcases/scss/AbstractDirectoryScanningSassTests.java45
-rw-r--r--theme-compiler/tests/src/com/vaadin/sass/testcases/scss/AutomaticSassTests.java3
-rw-r--r--theme-compiler/tests/src/com/vaadin/sass/testcases/scss/SassLangTests.java3
-rw-r--r--theme-compiler/tests/src/com/vaadin/sass/testcases/scss/SassLangTestsBroken.java3
11 files changed, 41 insertions, 21 deletions
diff --git a/theme-compiler/tests/resources/automatic/scss/foo/bar.scss b/theme-compiler/tests/resources/automatic/scss/foo/_bar.scss
index 326d34232d..326d34232d 100644
--- a/theme-compiler/tests/resources/automatic/scss/foo/bar.scss
+++ b/theme-compiler/tests/resources/automatic/scss/foo/_bar.scss
diff --git a/theme-compiler/tests/resources/automatic/scss/import-file-which-contains-comment-in-last-line.scss b/theme-compiler/tests/resources/automatic/scss/import-file-which-contains-comment-in-last-line.scss
index 41adc908ed..8292d4efe3 100644
--- a/theme-compiler/tests/resources/automatic/scss/import-file-which-contains-comment-in-last-line.scss
+++ b/theme-compiler/tests/resources/automatic/scss/import-file-which-contains-comment-in-last-line.scss
@@ -1,4 +1,4 @@
-@import "to-be-imported/imported-file-contains-comments-in-last-line.scss";
+@import "to-be-imported/_imported-file-contains-comments-in-last-line.scss";
.foo{
foo: $foo;
} \ No newline at end of file
diff --git a/theme-compiler/tests/resources/automatic/scss/nested-import.scss b/theme-compiler/tests/resources/automatic/scss/nested-import.scss
index 605d64a13a..df720a5584 100644
--- a/theme-compiler/tests/resources/automatic/scss/nested-import.scss
+++ b/theme-compiler/tests/resources/automatic/scss/nested-import.scss
@@ -1,3 +1,3 @@
.foo {
- @import "foo/bar.scss";
+ @import "foo/_bar.scss";
} \ No newline at end of file
diff --git a/theme-compiler/tests/resources/automatic/scss/to-be-imported/imported-file-contains-comments-in-last-line.scss b/theme-compiler/tests/resources/automatic/scss/to-be-imported/_imported-file-contains-comments-in-last-line.scss
index 16244f2bfd..16244f2bfd 100644
--- a/theme-compiler/tests/resources/automatic/scss/to-be-imported/imported-file-contains-comments-in-last-line.scss
+++ b/theme-compiler/tests/resources/automatic/scss/to-be-imported/_imported-file-contains-comments-in-last-line.scss
diff --git a/theme-compiler/tests/resources/automatic/scss/url-path.scss b/theme-compiler/tests/resources/automatic/scss/url-path.scss
index 0cc954bfb4..6903d389b5 100644
--- a/theme-compiler/tests/resources/automatic/scss/url-path.scss
+++ b/theme-compiler/tests/resources/automatic/scss/url-path.scss
@@ -1 +1 @@
-@import "foo/bar.scss"; \ No newline at end of file
+@import "foo/_bar.scss"; \ No newline at end of file
diff --git a/theme-compiler/tests/resources/automatic/scss/utf8-imported/to-be-imported-scss-file-contains-utf8.scss b/theme-compiler/tests/resources/automatic/scss/utf8-imported/_to-be-imported-scss-file-contains-utf8.scss
index f8a08a4a96..f8a08a4a96 100644
--- a/theme-compiler/tests/resources/automatic/scss/utf8-imported/to-be-imported-scss-file-contains-utf8.scss
+++ b/theme-compiler/tests/resources/automatic/scss/utf8-imported/_to-be-imported-scss-file-contains-utf8.scss
diff --git a/theme-compiler/tests/resources/automatic/scss/utf8.scss b/theme-compiler/tests/resources/automatic/scss/utf8.scss
index b568674073..251d6e6513 100644
--- a/theme-compiler/tests/resources/automatic/scss/utf8.scss
+++ b/theme-compiler/tests/resources/automatic/scss/utf8.scss
@@ -1,4 +1,4 @@
@charset "UTF-8";
-@import "utf8-imported/to-be-imported-scss-file-contains-utf8";
+@import "utf8-imported/_to-be-imported-scss-file-contains-utf8";
.bar {content: "\1f4c5";}
.raw_utf {content: "📈";} \ No newline at end of file
diff --git a/theme-compiler/tests/src/com/vaadin/sass/testcases/scss/AbstractDirectoryScanningSassTests.java b/theme-compiler/tests/src/com/vaadin/sass/testcases/scss/AbstractDirectoryScanningSassTests.java
index 40da6179f6..21edde0c17 100644
--- a/theme-compiler/tests/src/com/vaadin/sass/testcases/scss/AbstractDirectoryScanningSassTests.java
+++ b/theme-compiler/tests/src/com/vaadin/sass/testcases/scss/AbstractDirectoryScanningSassTests.java
@@ -19,7 +19,6 @@ package com.vaadin.sass.testcases.scss;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
-import java.io.FilenameFilter;
import java.io.IOException;
import java.net.URISyntaxException;
import java.net.URL;
@@ -36,28 +35,43 @@ import com.vaadin.sass.testcases.scss.SassTestRunner.FactoryTest;
public abstract class AbstractDirectoryScanningSassTests {
public static Collection<String> getScssResourceNames(URL directoryUrl)
- throws URISyntaxException {
+ throws URISyntaxException, IOException {
List<String> resources = new ArrayList<String>();
- for (File scssFile : getScssFiles(directoryUrl)) {
- resources.add(scssFile.getName());
+ for (String scssFile : getScssFiles(directoryUrl)) {
+ resources.add(scssFile);
}
return resources;
}
- private static File[] getScssFiles(URL directoryUrl)
- throws URISyntaxException {
+ private static List<String> getScssFiles(URL directoryUrl)
+ throws URISyntaxException, IOException {
URL sasslangUrl = directoryUrl;
File sasslangDir = new File(sasslangUrl.toURI());
File scssDir = new File(sasslangDir, "scss");
Assert.assertTrue(scssDir.exists());
- return scssDir.listFiles(new FilenameFilter() {
+ List<File> scssFiles = new ArrayList<File>();
+ addScssFilesRecursively(scssDir, scssFiles);
- @Override
- public boolean accept(File dir, String name) {
- return name.endsWith(".scss");
+ List<String> scssRelativeNames = new ArrayList<String>();
+ for (File f : scssFiles) {
+ String relativeName = f.getCanonicalPath().substring(
+ scssDir.getCanonicalPath().length() + 1);
+ scssRelativeNames.add(relativeName);
+ }
+ return scssRelativeNames;
+ }
+
+ private static void addScssFilesRecursively(File scssDir,
+ List<File> scssFiles) {
+ for (File f : scssDir.listFiles()) {
+ if (f.isDirectory()) {
+ addScssFilesRecursively(f, scssFiles);
+ } else if (f.getName().endsWith(".scss")
+ && !f.getName().startsWith("_")) {
+ scssFiles.add(f);
}
- });
+ }
}
protected abstract URL getResourceURL(String path);
@@ -69,7 +83,7 @@ public abstract class AbstractDirectoryScanningSassTests {
File cssFile = getCssFile(scssFile);
referenceCss = IOUtils.toString(new FileInputStream(cssFile));
ScssStylesheet scssStylesheet = ScssStylesheet.get(scssFile
- .getAbsolutePath());
+ .getCanonicalPath());
scssStylesheet.compile();
String parsedCss = scssStylesheet.toString();
@@ -88,6 +102,9 @@ public abstract class AbstractDirectoryScanningSassTests {
css = css.replaceAll("^[\n\r\t ]*", "");
// remove trailing whitespace
css = css.replaceAll("[\n\r\t ]*$", "");
+ css = css.replaceAll(";", ";\n");
+ css = css.replaceAll("\\{", "\\{\n");
+ css = css.replaceAll("}", "}\n");
return css;
}
@@ -103,7 +120,7 @@ public abstract class AbstractDirectoryScanningSassTests {
return new File(res.toURI());
}
- private File getCssFile(File scssFile) {
- return new File(scssFile.getAbsolutePath().replace("scss", "css"));
+ private File getCssFile(File scssFile) throws IOException {
+ return new File(scssFile.getCanonicalPath().replace("scss", "css"));
}
}
diff --git a/theme-compiler/tests/src/com/vaadin/sass/testcases/scss/AutomaticSassTests.java b/theme-compiler/tests/src/com/vaadin/sass/testcases/scss/AutomaticSassTests.java
index 4134c564f9..66e0bedac0 100644
--- a/theme-compiler/tests/src/com/vaadin/sass/testcases/scss/AutomaticSassTests.java
+++ b/theme-compiler/tests/src/com/vaadin/sass/testcases/scss/AutomaticSassTests.java
@@ -15,6 +15,7 @@
*/
package com.vaadin.sass.testcases.scss;
+import java.io.IOException;
import java.net.URISyntaxException;
import java.net.URL;
import java.util.Collection;
@@ -37,7 +38,7 @@ public class AutomaticSassTests extends AbstractDirectoryScanningSassTests {
@TestFactory
public static Collection<String> getScssResourceNames()
- throws URISyntaxException {
+ throws URISyntaxException, IOException {
return getScssResourceNames(getResourceURLInternal(""));
}
diff --git a/theme-compiler/tests/src/com/vaadin/sass/testcases/scss/SassLangTests.java b/theme-compiler/tests/src/com/vaadin/sass/testcases/scss/SassLangTests.java
index 4b8aada524..a8c9e80a3a 100644
--- a/theme-compiler/tests/src/com/vaadin/sass/testcases/scss/SassLangTests.java
+++ b/theme-compiler/tests/src/com/vaadin/sass/testcases/scss/SassLangTests.java
@@ -15,6 +15,7 @@
*/
package com.vaadin.sass.testcases.scss;
+import java.io.IOException;
import java.net.URISyntaxException;
import java.net.URL;
import java.util.Collection;
@@ -42,7 +43,7 @@ public class SassLangTests extends AbstractDirectoryScanningSassTests {
@TestFactory
public static Collection<String> getScssResourceNames()
- throws URISyntaxException {
+ throws URISyntaxException, IOException {
return getScssResourceNames(getResourceURLInternal(""));
}
diff --git a/theme-compiler/tests/src/com/vaadin/sass/testcases/scss/SassLangTestsBroken.java b/theme-compiler/tests/src/com/vaadin/sass/testcases/scss/SassLangTestsBroken.java
index 6b812a6940..0656565c20 100644
--- a/theme-compiler/tests/src/com/vaadin/sass/testcases/scss/SassLangTestsBroken.java
+++ b/theme-compiler/tests/src/com/vaadin/sass/testcases/scss/SassLangTestsBroken.java
@@ -15,6 +15,7 @@
*/
package com.vaadin.sass.testcases.scss;
+import java.io.IOException;
import java.net.URISyntaxException;
import java.net.URL;
import java.util.Collection;
@@ -45,7 +46,7 @@ public class SassLangTestsBroken extends AbstractDirectoryScanningSassTests {
@TestFactory
public static Collection<String> getScssResourceNames()
- throws URISyntaxException {
+ throws URISyntaxException, IOException {
return getScssResourceNames(getResourceURLInternal(""));
}