From 78ba808322ff63e9950633dd62ec33a7163591b3 Mon Sep 17 00:00:00 2001 From: Christopher Chedeau Date: Wed, 24 May 2017 10:52:12 -0700 Subject: [PATCH] Initial CSS support (#1636) I wanted to see how hard it would be to add support for CSS inside of prettier. Turns out, it's not that hard. I spent a few hours printing post-css values and getting all the stylefmt unit tests to not throw. --- .gitignore | 2 + bin/prettier.js | 7 +- index.js | 4 + package.json | 5 + src/clean-ast.js | 16 +- src/parser.js | 168 +++++++ src/printer.js | 263 +++++++++-- src/util.js | 26 +- .../__snapshots__/jsfmt.spec.js.snap | 11 + tests/css_atword/atword.css | 1 + tests/css_atword/jsfmt.spec.js | 1 + .../__snapshots__/jsfmt.spec.js.snap | 40 ++ tests/css_comments/block.css | 6 + tests/css_comments/jsfmt.spec.js | 1 + tests/css_comments/places.css | 8 + .../__snapshots__/jsfmt.spec.js.snap | 14 + tests/css_empty/empty.css | 4 + tests/css_empty/jsfmt.spec.js | 1 + .../__snapshots__/jsfmt.spec.js.snap | 8 + tests/css_important/important.css | 1 + tests/css_important/jsfmt.spec.js | 1 + .../__snapshots__/jsfmt.spec.js.snap | 14 + tests/css_long_rule/jsfmt.spec.js | 1 + tests/css_long_rule/long_rule.css | 4 + .../__snapshots__/jsfmt.spec.js.snap | 14 + tests/css_prefix/jsfmt.spec.js | 1 + tests/css_prefix/prefix.css | 4 + .../__snapshots__/jsfmt.spec.js.snap | 10 + tests/css_pseudo_call/jsfmt.spec.js | 1 + tests/css_pseudo_call/pseudo_call.css | 2 + .../at-apply/__snapshots__/jsfmt.spec.js.snap | 11 + tests/stylefmt/at-apply/at-apply.css | 2 + tests/stylefmt/at-apply/jsfmt.spec.js | 1 + .../at-media/__snapshots__/jsfmt.spec.js.snap | 43 ++ tests/stylefmt/at-media/at-media.css | 12 + tests/stylefmt/at-media/jsfmt.spec.js | 1 + .../__snapshots__/jsfmt.spec.js.snap | 19 + .../stylefmt/attr-selector/attr-selector.css | 6 + tests/stylefmt/attr-selector/jsfmt.spec.js | 1 + .../__snapshots__/jsfmt.spec.js.snap | 8 + tests/stylefmt/charset-2/charset-2.css | 1 + tests/stylefmt/charset-2/jsfmt.spec.js | 1 + .../charset/__snapshots__/jsfmt.spec.js.snap | 8 + tests/stylefmt/charset/charset.css | 1 + tests/stylefmt/charset/jsfmt.spec.js | 1 + .../__snapshots__/jsfmt.spec.js.snap | 10 + .../color-hex-lowercase.css | 1 + .../color-hex-lowercase/jsfmt.spec.js | 1 + .../__snapshots__/jsfmt.spec.js.snap | 33 ++ .../comment-in-rules/comment-in-rules.css | 13 + tests/stylefmt/comment-in-rules/jsfmt.spec.js | 1 + .../comment/__snapshots__/jsfmt.spec.js.snap | 70 +++ tests/stylefmt/comment/comment.css | 32 ++ tests/stylefmt/comment/jsfmt.spec.js | 1 + .../content/__snapshots__/jsfmt.spec.js.snap | 12 + tests/stylefmt/content/content.css | 2 + tests/stylefmt/content/jsfmt.spec.js | 1 + .../__snapshots__/jsfmt.spec.js.snap | 106 +++++ .../cssnext-example/cssnext-example.css | 41 ++ tests/stylefmt/cssnext-example/jsfmt.spec.js | 1 + .../__snapshots__/jsfmt.spec.js.snap | 21 + .../custom-media-queries.css | 8 + .../custom-media-queries/jsfmt.spec.js | 1 + .../__snapshots__/jsfmt.spec.js.snap | 14 + .../custom-properties/custom-properties.css | 2 + .../stylefmt/custom-properties/jsfmt.spec.js | 1 + .../__snapshots__/jsfmt.spec.js.snap | 22 + .../custom-selectors/custom-selectors.css | 7 + tests/stylefmt/custom-selectors/jsfmt.spec.js | 1 + .../data-url/__snapshots__/jsfmt.spec.js.snap | 12 + tests/stylefmt/data-url/data-url.css | 3 + tests/stylefmt/data-url/jsfmt.spec.js | 1 + .../__snapshots__/jsfmt.spec.js.snap | 17 + tests/stylefmt/font-face/font-face.css | 1 + tests/stylefmt/font-face/jsfmt.spec.js | 1 + .../__snapshots__/jsfmt.spec.js.snap | 15 + .../font-shorthand/font-shorthand.css | 4 + tests/stylefmt/font-shorthand/jsfmt.spec.js | 1 + .../ie-hacks/__snapshots__/jsfmt.spec.js.snap | 27 ++ tests/stylefmt/ie-hacks/ie-hacks.css | 9 + tests/stylefmt/ie-hacks/jsfmt.spec.js | 1 + .../import/__snapshots__/jsfmt.spec.js.snap | 19 + tests/stylefmt/import/import.css | 6 + tests/stylefmt/import/jsfmt.spec.js | 1 + .../__snapshots__/jsfmt.spec.js.snap | 12 + tests/stylefmt/important/important.css | 3 + tests/stylefmt/important/jsfmt.spec.js | 1 + .../__snapshots__/jsfmt.spec.js.snap | 17 + .../inline-comment/inline-comment.css | 6 + tests/stylefmt/inline-comment/jsfmt.spec.js | 1 + .../__snapshots__/jsfmt.spec.js.snap | 105 +++++ tests/stylefmt/lowercase/jsfmt.spec.js | 1 + tests/stylefmt/lowercase/lowercase.css | 42 ++ .../__snapshots__/jsfmt.spec.js.snap | 19 + .../media-indent-with-import/jsfmt.spec.js | 1 + .../media-indent-with-import.css | 6 + .../__snapshots__/jsfmt.spec.js.snap | 17 + tests/stylefmt/media-indent/jsfmt.spec.js | 1 + tests/stylefmt/media-indent/media-indent.css | 6 + .../__snapshots__/jsfmt.spec.js.snap | 23 + .../media-queries-ranges/jsfmt.spec.js | 1 + .../media-queries-ranges.css | 6 + .../nested-2/__snapshots__/jsfmt.spec.js.snap | 43 ++ tests/stylefmt/nested-2/jsfmt.spec.js | 1 + tests/stylefmt/nested-2/nested-2.css | 14 + .../__snapshots__/jsfmt.spec.js.snap | 19 + tests/stylefmt/nested-atrule/jsfmt.spec.js | 1 + .../stylefmt/nested-atrule/nested-atrule.css | 6 + .../__snapshots__/jsfmt.spec.js.snap | 44 ++ .../stylefmt/nested-indention-2/jsfmt.spec.js | 1 + .../nested-indention-2/nested-indention-2.css | 19 + .../__snapshots__/jsfmt.spec.js.snap | 92 ++++ tests/stylefmt/nested-indention/jsfmt.spec.js | 1 + .../nested-indention/nested-indention.css | 46 ++ .../__snapshots__/jsfmt.spec.js.snap | 37 ++ tests/stylefmt/nested-mixin-2/jsfmt.spec.js | 1 + .../nested-mixin-2/nested-mixin-2.css | 16 + .../__snapshots__/jsfmt.spec.js.snap | 30 ++ tests/stylefmt/nested-mixin/jsfmt.spec.js | 1 + tests/stylefmt/nested-mixin/nested-mixin.css | 12 + .../nested/__snapshots__/jsfmt.spec.js.snap | 34 ++ tests/stylefmt/nested/jsfmt.spec.js | 1 + tests/stylefmt/nested/nested.css | 15 + .../__snapshots__/jsfmt.spec.js.snap | 26 ++ .../non-nested-combinator/jsfmt.spec.js | 1 + .../non-nested-combinator.css | 9 + .../__snapshots__/jsfmt.spec.js.snap | 15 + tests/stylefmt/pseudo-element/jsfmt.spec.js | 1 + .../pseudo-element/pseudo-element.css | 3 + .../readme/__snapshots__/jsfmt.spec.js.snap | 62 +++ tests/stylefmt/readme/jsfmt.spec.js | 1 + tests/stylefmt/readme/readme.css | 26 ++ .../__snapshots__/jsfmt.spec.js.snap | 11 + .../jsfmt.spec.js | 1 + .../shorthand-with-sass-variables.css | 2 + .../values/__snapshots__/jsfmt.spec.js.snap | 24 + tests/stylefmt/values/jsfmt.spec.js | 1 + tests/stylefmt/values/values.css | 9 + .../__snapshots__/jsfmt.spec.js.snap | 11 + tests/stylefmt/var-notation/jsfmt.spec.js | 1 + tests/stylefmt/var-notation/var-notation.css | 2 + .../__snapshots__/jsfmt.spec.js.snap | 15 + tests/stylefmt/vendor-prefix/jsfmt.spec.js | 1 + .../stylefmt/vendor-prefix/vendor-prefix.css | 5 + tests_config/run_spec.js | 2 +- yarn.lock | 431 +++++++++++------- 146 files changed, 2429 insertions(+), 208 deletions(-) create mode 100644 tests/css_atword/__snapshots__/jsfmt.spec.js.snap create mode 100644 tests/css_atword/atword.css create mode 100644 tests/css_atword/jsfmt.spec.js create mode 100644 tests/css_comments/__snapshots__/jsfmt.spec.js.snap create mode 100644 tests/css_comments/block.css create mode 100644 tests/css_comments/jsfmt.spec.js create mode 100644 tests/css_comments/places.css create mode 100644 tests/css_empty/__snapshots__/jsfmt.spec.js.snap create mode 100644 tests/css_empty/empty.css create mode 100644 tests/css_empty/jsfmt.spec.js create mode 100644 tests/css_important/__snapshots__/jsfmt.spec.js.snap create mode 100644 tests/css_important/important.css create mode 100644 tests/css_important/jsfmt.spec.js create mode 100644 tests/css_long_rule/__snapshots__/jsfmt.spec.js.snap create mode 100644 tests/css_long_rule/jsfmt.spec.js create mode 100644 tests/css_long_rule/long_rule.css create mode 100644 tests/css_prefix/__snapshots__/jsfmt.spec.js.snap create mode 100644 tests/css_prefix/jsfmt.spec.js create mode 100644 tests/css_prefix/prefix.css create mode 100644 tests/css_pseudo_call/__snapshots__/jsfmt.spec.js.snap create mode 100644 tests/css_pseudo_call/jsfmt.spec.js create mode 100644 tests/css_pseudo_call/pseudo_call.css create mode 100644 tests/stylefmt/at-apply/__snapshots__/jsfmt.spec.js.snap create mode 100644 tests/stylefmt/at-apply/at-apply.css create mode 100644 tests/stylefmt/at-apply/jsfmt.spec.js create mode 100644 tests/stylefmt/at-media/__snapshots__/jsfmt.spec.js.snap create mode 100644 tests/stylefmt/at-media/at-media.css create mode 100644 tests/stylefmt/at-media/jsfmt.spec.js create mode 100644 tests/stylefmt/attr-selector/__snapshots__/jsfmt.spec.js.snap create mode 100644 tests/stylefmt/attr-selector/attr-selector.css create mode 100644 tests/stylefmt/attr-selector/jsfmt.spec.js create mode 100644 tests/stylefmt/charset-2/__snapshots__/jsfmt.spec.js.snap create mode 100644 tests/stylefmt/charset-2/charset-2.css create mode 100644 tests/stylefmt/charset-2/jsfmt.spec.js create mode 100644 tests/stylefmt/charset/__snapshots__/jsfmt.spec.js.snap create mode 100644 tests/stylefmt/charset/charset.css create mode 100644 tests/stylefmt/charset/jsfmt.spec.js create mode 100644 tests/stylefmt/color-hex-lowercase/__snapshots__/jsfmt.spec.js.snap create mode 100644 tests/stylefmt/color-hex-lowercase/color-hex-lowercase.css create mode 100644 tests/stylefmt/color-hex-lowercase/jsfmt.spec.js create mode 100644 tests/stylefmt/comment-in-rules/__snapshots__/jsfmt.spec.js.snap create mode 100644 tests/stylefmt/comment-in-rules/comment-in-rules.css create mode 100644 tests/stylefmt/comment-in-rules/jsfmt.spec.js create mode 100644 tests/stylefmt/comment/__snapshots__/jsfmt.spec.js.snap create mode 100644 tests/stylefmt/comment/comment.css create mode 100644 tests/stylefmt/comment/jsfmt.spec.js create mode 100644 tests/stylefmt/content/__snapshots__/jsfmt.spec.js.snap create mode 100644 tests/stylefmt/content/content.css create mode 100644 tests/stylefmt/content/jsfmt.spec.js create mode 100644 tests/stylefmt/cssnext-example/__snapshots__/jsfmt.spec.js.snap create mode 100644 tests/stylefmt/cssnext-example/cssnext-example.css create mode 100644 tests/stylefmt/cssnext-example/jsfmt.spec.js create mode 100644 tests/stylefmt/custom-media-queries/__snapshots__/jsfmt.spec.js.snap create mode 100644 tests/stylefmt/custom-media-queries/custom-media-queries.css create mode 100644 tests/stylefmt/custom-media-queries/jsfmt.spec.js create mode 100644 tests/stylefmt/custom-properties/__snapshots__/jsfmt.spec.js.snap create mode 100644 tests/stylefmt/custom-properties/custom-properties.css create mode 100644 tests/stylefmt/custom-properties/jsfmt.spec.js create mode 100644 tests/stylefmt/custom-selectors/__snapshots__/jsfmt.spec.js.snap create mode 100644 tests/stylefmt/custom-selectors/custom-selectors.css create mode 100644 tests/stylefmt/custom-selectors/jsfmt.spec.js create mode 100644 tests/stylefmt/data-url/__snapshots__/jsfmt.spec.js.snap create mode 100644 tests/stylefmt/data-url/data-url.css create mode 100644 tests/stylefmt/data-url/jsfmt.spec.js create mode 100644 tests/stylefmt/font-face/__snapshots__/jsfmt.spec.js.snap create mode 100644 tests/stylefmt/font-face/font-face.css create mode 100644 tests/stylefmt/font-face/jsfmt.spec.js create mode 100644 tests/stylefmt/font-shorthand/__snapshots__/jsfmt.spec.js.snap create mode 100644 tests/stylefmt/font-shorthand/font-shorthand.css create mode 100644 tests/stylefmt/font-shorthand/jsfmt.spec.js create mode 100644 tests/stylefmt/ie-hacks/__snapshots__/jsfmt.spec.js.snap create mode 100644 tests/stylefmt/ie-hacks/ie-hacks.css create mode 100644 tests/stylefmt/ie-hacks/jsfmt.spec.js create mode 100644 tests/stylefmt/import/__snapshots__/jsfmt.spec.js.snap create mode 100644 tests/stylefmt/import/import.css create mode 100644 tests/stylefmt/import/jsfmt.spec.js create mode 100644 tests/stylefmt/important/__snapshots__/jsfmt.spec.js.snap create mode 100644 tests/stylefmt/important/important.css create mode 100644 tests/stylefmt/important/jsfmt.spec.js create mode 100644 tests/stylefmt/inline-comment/__snapshots__/jsfmt.spec.js.snap create mode 100644 tests/stylefmt/inline-comment/inline-comment.css create mode 100644 tests/stylefmt/inline-comment/jsfmt.spec.js create mode 100644 tests/stylefmt/lowercase/__snapshots__/jsfmt.spec.js.snap create mode 100644 tests/stylefmt/lowercase/jsfmt.spec.js create mode 100644 tests/stylefmt/lowercase/lowercase.css create mode 100644 tests/stylefmt/media-indent-with-import/__snapshots__/jsfmt.spec.js.snap create mode 100644 tests/stylefmt/media-indent-with-import/jsfmt.spec.js create mode 100644 tests/stylefmt/media-indent-with-import/media-indent-with-import.css create mode 100644 tests/stylefmt/media-indent/__snapshots__/jsfmt.spec.js.snap create mode 100644 tests/stylefmt/media-indent/jsfmt.spec.js create mode 100644 tests/stylefmt/media-indent/media-indent.css create mode 100644 tests/stylefmt/media-queries-ranges/__snapshots__/jsfmt.spec.js.snap create mode 100644 tests/stylefmt/media-queries-ranges/jsfmt.spec.js create mode 100644 tests/stylefmt/media-queries-ranges/media-queries-ranges.css create mode 100644 tests/stylefmt/nested-2/__snapshots__/jsfmt.spec.js.snap create mode 100644 tests/stylefmt/nested-2/jsfmt.spec.js create mode 100644 tests/stylefmt/nested-2/nested-2.css create mode 100644 tests/stylefmt/nested-atrule/__snapshots__/jsfmt.spec.js.snap create mode 100644 tests/stylefmt/nested-atrule/jsfmt.spec.js create mode 100644 tests/stylefmt/nested-atrule/nested-atrule.css create mode 100644 tests/stylefmt/nested-indention-2/__snapshots__/jsfmt.spec.js.snap create mode 100644 tests/stylefmt/nested-indention-2/jsfmt.spec.js create mode 100644 tests/stylefmt/nested-indention-2/nested-indention-2.css create mode 100644 tests/stylefmt/nested-indention/__snapshots__/jsfmt.spec.js.snap create mode 100644 tests/stylefmt/nested-indention/jsfmt.spec.js create mode 100644 tests/stylefmt/nested-indention/nested-indention.css create mode 100644 tests/stylefmt/nested-mixin-2/__snapshots__/jsfmt.spec.js.snap create mode 100644 tests/stylefmt/nested-mixin-2/jsfmt.spec.js create mode 100644 tests/stylefmt/nested-mixin-2/nested-mixin-2.css create mode 100644 tests/stylefmt/nested-mixin/__snapshots__/jsfmt.spec.js.snap create mode 100644 tests/stylefmt/nested-mixin/jsfmt.spec.js create mode 100644 tests/stylefmt/nested-mixin/nested-mixin.css create mode 100644 tests/stylefmt/nested/__snapshots__/jsfmt.spec.js.snap create mode 100644 tests/stylefmt/nested/jsfmt.spec.js create mode 100644 tests/stylefmt/nested/nested.css create mode 100644 tests/stylefmt/non-nested-combinator/__snapshots__/jsfmt.spec.js.snap create mode 100644 tests/stylefmt/non-nested-combinator/jsfmt.spec.js create mode 100644 tests/stylefmt/non-nested-combinator/non-nested-combinator.css create mode 100644 tests/stylefmt/pseudo-element/__snapshots__/jsfmt.spec.js.snap create mode 100644 tests/stylefmt/pseudo-element/jsfmt.spec.js create mode 100644 tests/stylefmt/pseudo-element/pseudo-element.css create mode 100644 tests/stylefmt/readme/__snapshots__/jsfmt.spec.js.snap create mode 100644 tests/stylefmt/readme/jsfmt.spec.js create mode 100644 tests/stylefmt/readme/readme.css create mode 100644 tests/stylefmt/shorthand-with-sass-variables/__snapshots__/jsfmt.spec.js.snap create mode 100644 tests/stylefmt/shorthand-with-sass-variables/jsfmt.spec.js create mode 100644 tests/stylefmt/shorthand-with-sass-variables/shorthand-with-sass-variables.css create mode 100644 tests/stylefmt/values/__snapshots__/jsfmt.spec.js.snap create mode 100644 tests/stylefmt/values/jsfmt.spec.js create mode 100644 tests/stylefmt/values/values.css create mode 100644 tests/stylefmt/var-notation/__snapshots__/jsfmt.spec.js.snap create mode 100644 tests/stylefmt/var-notation/jsfmt.spec.js create mode 100644 tests/stylefmt/var-notation/var-notation.css create mode 100644 tests/stylefmt/vendor-prefix/__snapshots__/jsfmt.spec.js.snap create mode 100644 tests/stylefmt/vendor-prefix/jsfmt.spec.js create mode 100644 tests/stylefmt/vendor-prefix/vendor-prefix.css diff --git a/.gitignore b/.gitignore index da4200be0..19e023302 100644 --- a/.gitignore +++ b/.gitignore @@ -2,4 +2,6 @@ npm-debug.log /errors /test.js +/test.ts +/test.css /.vscode diff --git a/bin/prettier.js b/bin/prettier.js index c1f4b7efb..b8d2278f7 100755 --- a/bin/prettier.js +++ b/bin/prettier.js @@ -90,7 +90,12 @@ function getParserOption() { return "flow"; } - if (value === "flow" || value === "babylon" || value === "typescript") { + if ( + value === "flow" || + value === "babylon" || + value === "typescript" || + value === "postcss" + ) { return value; } diff --git a/index.js b/index.js index a17da9591..7ed976467 100644 --- a/index.js +++ b/index.js @@ -29,6 +29,10 @@ function attachComments(text, ast, opts) { } function ensureAllCommentsPrinted(astComments) { + if (!astComments) { + return; + } + for (let i = 0; i < astComments.length; ++i) { if (astComments[i].value.trim() === "prettier-ignore") { // If there's a prettier-ignore, we're not printing that sub-tree so we diff --git a/package.json b/package.json index 2ba129ba3..7efcb600c 100644 --- a/package.json +++ b/package.json @@ -28,6 +28,11 @@ "eslint-plugin-prettier": "^2.1.1", "jest": "20.0.0", "mkdirp": "^0.5.1", + "postcss": "^6.0.1", + "postcss-less": "^1.0.0", + "postcss-media-query-parser": "^0.2.3", + "postcss-selector-parser": "^2.2.3", + "postcss-values-parser": "^1.2.1", "prettier": "^1.3.1", "rimraf": "^2.6.1", "rollup": "0.41.1", diff --git a/src/clean-ast.js b/src/clean-ast.js index 6e1828bc0..6df8a6109 100644 --- a/src/clean-ast.js +++ b/src/clean-ast.js @@ -42,11 +42,25 @@ function massageAST(ast) { "start", "end", "tokens", - "flags" + "flags", + "raws", + "sourceIndex", + "id", + "source", + "before", + "after" ].forEach(name => { delete newObj[name]; }); + if ( + ast.type === "media-query" || + ast.type === "media-query-list" || + ast.type === "media-feature-expression" + ) { + delete newObj.value; + } + // We convert
to
if (ast.type === "JSXOpeningElement") { delete newObj.selfClosing; diff --git a/src/parser.js b/src/parser.js index 7c02a897d..8c9764463 100644 --- a/src/parser.js +++ b/src/parser.js @@ -14,6 +14,8 @@ function parse(text, opts) { parseFunction = parseWithFlow; } else if (opts.parser === "typescript") { parseFunction = parseWithTypeScript; + } else if (opts.parser === "postcss") { + parseFunction = parseWithPostCSS; } else { parseFunction = parseWithBabylon; } @@ -138,4 +140,170 @@ function isProbablyJsx(text) { ).test(text); } +function parseSelector(selector) { + const r = require; + const selectorParser = r("postcss-selector-parser"); + let result; + selectorParser(result_ => { + result = result_; + }).process(selector); + return addTypePrefix(result, "selector-"); +} + +function parseValueNodes(nodes) { + let parenGroup = { + open: null, + close: null, + groups: [], + type: "paren_group" + }; + const parenGroupStack = [parenGroup]; + const rootParenGroup = parenGroup; + let commaGroup = { + groups: [], + type: "comma_group" + }; + const commaGroupStack = [commaGroup]; + + for (let i = 0; i < nodes.length; ++i) { + if (nodes[i].type === "paren" && nodes[i].value === "(") { + parenGroup = { + open: nodes[i], + close: null, + groups: [], + type: "paren_group" + }; + parenGroupStack.push(parenGroup); + + commaGroup = { + groups: [], + type: "comma_group" + }; + commaGroupStack.push(commaGroup); + } else if (nodes[i].type === "paren" && nodes[i].value === ")") { + if (commaGroup.groups.length) { + parenGroup.groups.push(commaGroup); + } + parenGroup.close = nodes[i]; + + if (commaGroupStack.length === 1) { + throw new Error("Unbalanced parenthesis"); + } + + commaGroupStack.pop(); + commaGroup = commaGroupStack[commaGroupStack.length - 1]; + commaGroup.groups.push(parenGroup); + + parenGroupStack.pop(); + parenGroup = parenGroupStack[parenGroupStack.length - 1]; + } else if (nodes[i].type === "comma") { + parenGroup.groups.push(commaGroup); + commaGroup = { + groups: [], + type: "comma_group" + }; + commaGroupStack[commaGroupStack.length - 1] = commaGroup; + } else { + commaGroup.groups.push(nodes[i]); + } + } + if (commaGroup.groups.length > 0) { + parenGroup.groups.push(commaGroup); + } + return rootParenGroup; +} + +function addTypePrefix(node, prefix) { + if (node && typeof node === "object") { + delete node.parent; + for (const key in node) { + addTypePrefix(node[key], prefix); + if (key === "type" && typeof node[key] === "string") { + if (!node[key].startsWith(prefix)) { + node[key] = prefix + node[key]; + } + } + } + } + return node; +} + +function addMissingType(node) { + if (node && typeof node === "object") { + delete node.parent; + for (const key in node) { + addMissingType(node[key]); + } + if (!Array.isArray(node) && node.value && !node.type) { + node.type = "unknown"; + } + } + return node; +} + +function parseNestedValue(node) { + if (node && typeof node === "object") { + delete node.parent; + for (const key in node) { + parseNestedValue(node[key]); + if (key === "nodes") { + node.group = parseValueNodes(node[key]); + delete node[key]; + } + } + } + return node; +} + +function parseValue(value) { + const r = require; + const valueParser = r("postcss-values-parser"); + const result = valueParser(value).parse(); + const parsedResult = parseNestedValue(result); + return addTypePrefix(parsedResult, "value-"); +} + +function parseMediaQuery(value) { + const r = require; + const mediaParser = r("postcss-media-query-parser").default; + const result = addMissingType(mediaParser(value)); + return addTypePrefix(result, "media-"); +} + +function parseNestedCSS(node) { + if (node && typeof node === "object") { + delete node.parent; + for (const key in node) { + parseNestedCSS(node[key]); + } + if (typeof node.selector === "string") { + node.selector = parseSelector(node.selector); + } + if (typeof node.value === "string") { + node.value = parseValue(node.value); + } + if (node.type === "css-atrule" && typeof node.params === "string") { + node.params = parseMediaQuery(node.params); + } + } + return node; +} + +function parseWithPostCSS(text) { + const r = require; + const parser = r("postcss-less"); + try { + const result = parser.parse(text); + const prefixedResult = addTypePrefix(result, "css-"); + const parsedResult = parseNestedCSS(prefixedResult); + // console.log(JSON.stringify(parsedResult, null, 2)); + return parsedResult; + } catch (e) { + if (typeof e.line !== "number") { + throw e; + } + throw createError(e.name + " " + e.reason, e.line, e.column); + } +} + module.exports = { parse }; diff --git a/src/printer.js b/src/printer.js index 449e03b6a..e740a876d 100644 --- a/src/printer.js +++ b/src/printer.js @@ -2411,40 +2411,245 @@ function genericPrintNoParens(path, options, print, args) { return path.call(bodyPath => { return printStatementSequence(bodyPath, options, print); }, "body"); - case "ClassHeritage": // TODO - case "ComprehensionBlock": // TODO - case "ComprehensionExpression": // TODO - case "Glob": // TODO - case "GeneratorExpression": // TODO - case "LetStatement": // TODO - case "LetExpression": // TODO - case "GraphExpression": // TODO - // XML types that nobody cares about or needs to print. (fallthrough) - case "GraphIndexExpression": - case "XMLDefaultDeclaration": - case "XMLAnyName": - case "XMLQualifiedIdentifier": - case "XMLFunctionQualifiedIdentifier": - case "XMLAttributeSelector": - case "XMLFilterExpression": - case "XML": - case "XMLElement": - case "XMLList": - case "XMLEscape": - case "XMLText": - case "XMLStartTag": - case "XMLEndTag": - case "XMLPointTag": - case "XMLName": - case "XMLAttribute": - case "XMLCdata": - case "XMLComment": - case "XMLProcessingInstruction": + // postcss + case "css-root": { + return concat([printNodeSequence(path, options, print), hardline]); + } + case "css-comment": { + return n.raws.content; + } + case "css-rule": { + return concat([ + path.call(print, "selector"), + n.nodes + ? concat([ + " {", + n.nodes.length > 0 + ? indent( + concat([hardline, printNodeSequence(path, options, print)]) + ) + : "", + hardline, + "}" + ]) + : ";" + ]); + } + case "css-decl": { + return concat([ + n.raws.before.trimLeft(), + n.prop, + ": ", + path.call(print, "value"), + n.important ? " !important" : "", + ";" + ]); + } + case "css-atrule": { + return concat([ + "@", + n.name, + " ", + path.call(print, "params"), + n.nodes + ? concat([ + " {", + indent( + concat([softline, printNodeSequence(path, options, print)]) + ), + softline, + "}" + ]) + : ";" + ]); + } + case "css-import": { + return concat(["@", n.name, " ", n.importPath, ";"]); + } + // postcss-media-query-parser + case "media-query-list": { + return join(", ", path.map(print, "nodes")); + } + case "media-query": { + return join(" ", path.map(print, "nodes")); + } + case "media-type": { + return n.value; + } + case "media-feature-expression": { + if (!n.nodes) { + return n.value; + } + return concat(["(", concat(path.map(print, "nodes")), ")"]); + } + case "media-feature": { + return n.value; + } + case "media-colon": { + return concat([n.value, " "]); + } + case "media-value": { + return n.value; + } + case "media-keyword": { + return concat([" ", n.value, " "]); + } + case "media-unknown": { + return n.value; + } + // postcss-selector-parser + case "selector-root": { + return group(join(concat([",", line]), path.map(print, "nodes"))); + } + case "selector-tag": { + return n.value; + } + case "selector-id": { + return concat(["#", n.value]); + } + case "selector-class": { + return concat([".", n.value]); + } + case "selector-attribute": { + return concat([ + "[", + n.attribute, + n.operator ? n.operator : "", + n.value ? n.value : "", + "]" + ]); + } + case "selector-combinator": { + if (n.value === "+" || n.value === ">") { + return concat([" ", n.value, " "]); + } + return n.value; + } + case "selector-universal": { + return n.value; + } + case "selector-selector": { + return concat(path.map(print, "nodes")); + } + case "selector-pseudo": { + return concat([ + n.value, + n.nodes && n.nodes.length > 0 + ? concat(["(", concat(path.map(print, "nodes")), ")"]) + : "" + ]); + } + case "selector-nesting": { + return printValue(n.value); + } + // postcss-values-parser + case "value-root": { + return path.call(print, "group"); + } + case "value-comma_group": { + const printed = path.map(print, "groups"); + const parts = []; + for (let i = 0; i < n.groups.length; ++i) { + parts.push(printed[i]); + if (i === 0 && n.groups[i].type === "value-operator") { + continue; + } + if (i !== n.groups.length - 1) { + parts.push(line); + } + } + + return group(concat(parts)); + } + case "value-paren_group": { + if (!n.open) { + return join(concat([",", line]), path.map(print, "groups")); + } + + return group( + concat([ + n.open ? path.call(print, "open") : "", + indent( + concat([ + softline, + join(concat([",", line]), path.map(print, "groups")) + ]) + ), + softline, + n.close ? path.call(print, "close") : "" + ]) + ); + } + case "value-value": { + return path.call(print, "group"); + } + case "value-func": { + return concat([n.value, path.call(print, "group")]); + } + case "value-paren": { + return n.value; + } + case "value-number": { + return concat([n.value, n.unit]); + } + case "value-operator": { + return n.value; + } + case "value-word": { + return n.value; + } + case "value-comma": { + return concat([n.value, " "]); + } + case "value-string": { + return concat([ + n.quoted ? n.raws.quote : "", + n.value, + n.quoted ? n.raws.quote : "" + ]); + } + case "value-atword": { + return concat(["@", n.value]); + } + default: throw new Error("unknown type: " + JSON.stringify(n.type)); } } +function printValue(value) { + return value; +} + +function printNodeSequence(path, options, print) { + const node = path.getValue(); + const parts = []; + let i = 0; + path.map(pathChild => { + parts.push(pathChild.call(print)); + if (i !== node.nodes.length - 1) { + if ( + node.nodes[i + 1].type === "css-comment" && + !util.hasNewline( + options.originalText, + util.locStart(node.nodes[i + 1]), + { backwards: true } + ) + ) { + parts.push(" "); + } else { + parts.push(hardline); + if (util.isNextLineEmpty(options.originalText, pathChild.getValue())) { + parts.push(hardline); + } + } + } + i++; + }, "nodes"); + + return concat(parts); +} + function printStatementSequence(path, options, print) { const printed = []; diff --git a/src/util.js b/src/util.js index 03acb8abe..e48913948 100644 --- a/src/util.js +++ b/src/util.js @@ -208,14 +208,36 @@ function locStart(node) { if (node.range) { return node.range[0]; } - return node.start; + if (typeof node.start === "number") { + return node.start; + } + if (node.source) { + return lineColumnToIndex(node.source.start, node.source.input.css) - 1; + } } function locEnd(node) { if (node.range) { return node.range[1]; } - return node.end; + if (typeof node.end === "number") { + return node.end; + } + if (node.source) { + return lineColumnToIndex(node.source.end, node.source.input.css); + } +} + +// Super inefficient, needs to be cached. +function lineColumnToIndex(lineColumn, text) { + let index = 0; + for (let i = 0; i < lineColumn.line - 1; ++i) { + index = text.indexOf("\n", index) + 1; + if (index === -1) { + return -1; + } + } + return index + lineColumn.column; } function setLocStart(node, index) { diff --git a/tests/css_atword/__snapshots__/jsfmt.spec.js.snap b/tests/css_atword/__snapshots__/jsfmt.spec.js.snap new file mode 100644 index 000000000..75c5aa527 --- /dev/null +++ b/tests/css_atword/__snapshots__/jsfmt.spec.js.snap @@ -0,0 +1,11 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`atword.css 1`] = ` +.test { @color: red; color: @color; } +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.test { + @color: red; + color: @color; +} + +`; diff --git a/tests/css_atword/atword.css b/tests/css_atword/atword.css new file mode 100644 index 000000000..1f6da7e58 --- /dev/null +++ b/tests/css_atword/atword.css @@ -0,0 +1 @@ +.test { @color: red; color: @color; } diff --git a/tests/css_atword/jsfmt.spec.js b/tests/css_atword/jsfmt.spec.js new file mode 100644 index 000000000..a7d303b6c --- /dev/null +++ b/tests/css_atword/jsfmt.spec.js @@ -0,0 +1 @@ +run_spec(__dirname, { parser: "postcss" }); diff --git a/tests/css_comments/__snapshots__/jsfmt.spec.js.snap b/tests/css_comments/__snapshots__/jsfmt.spec.js.snap new file mode 100644 index 000000000..a83693417 --- /dev/null +++ b/tests/css_comments/__snapshots__/jsfmt.spec.js.snap @@ -0,0 +1,40 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`block.css 1`] = ` +// Animation definitions cannot cross the shadow boundary, +// and thus need to be loaded directly into the atom-text-editor scope. +/* Kikoo */ +/** + * Kikoo + */ +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// Animation definitions cannot cross the shadow boundary, +// and thus need to be loaded directly into the atom-text-editor scope. +/* Kikoo */ +/** + * Kikoo + */ + +`; + +exports[`places.css 1`] = ` +div { + // a + + margin-left: -@leftMargin; // b +} // c + +// d +div {} +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +div { + // a + + margin-left: -@leftMargin; // b +} // c + +// d +div { +} + +`; diff --git a/tests/css_comments/block.css b/tests/css_comments/block.css new file mode 100644 index 000000000..dda1e6e97 --- /dev/null +++ b/tests/css_comments/block.css @@ -0,0 +1,6 @@ +// Animation definitions cannot cross the shadow boundary, +// and thus need to be loaded directly into the atom-text-editor scope. +/* Kikoo */ +/** + * Kikoo + */ diff --git a/tests/css_comments/jsfmt.spec.js b/tests/css_comments/jsfmt.spec.js new file mode 100644 index 000000000..a7d303b6c --- /dev/null +++ b/tests/css_comments/jsfmt.spec.js @@ -0,0 +1 @@ +run_spec(__dirname, { parser: "postcss" }); diff --git a/tests/css_comments/places.css b/tests/css_comments/places.css new file mode 100644 index 000000000..be67f48df --- /dev/null +++ b/tests/css_comments/places.css @@ -0,0 +1,8 @@ +div { + // a + + margin-left: -@leftMargin; // b +} // c + +// d +div {} diff --git a/tests/css_empty/__snapshots__/jsfmt.spec.js.snap b/tests/css_empty/__snapshots__/jsfmt.spec.js.snap new file mode 100644 index 000000000..f9663c969 --- /dev/null +++ b/tests/css_empty/__snapshots__/jsfmt.spec.js.snap @@ -0,0 +1,14 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`empty.css 1`] = ` +.ui-syntax-color(); + +details[open] { +} +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.ui-syntax-color(); + +details[open] { +} + +`; diff --git a/tests/css_empty/empty.css b/tests/css_empty/empty.css new file mode 100644 index 000000000..fac060959 --- /dev/null +++ b/tests/css_empty/empty.css @@ -0,0 +1,4 @@ +.ui-syntax-color(); + +details[open] { +} diff --git a/tests/css_empty/jsfmt.spec.js b/tests/css_empty/jsfmt.spec.js new file mode 100644 index 000000000..a7d303b6c --- /dev/null +++ b/tests/css_empty/jsfmt.spec.js @@ -0,0 +1 @@ +run_spec(__dirname, { parser: "postcss" }); diff --git a/tests/css_important/__snapshots__/jsfmt.spec.js.snap b/tests/css_important/__snapshots__/jsfmt.spec.js.snap new file mode 100644 index 000000000..2f4b86d4a --- /dev/null +++ b/tests/css_important/__snapshots__/jsfmt.spec.js.snap @@ -0,0 +1,8 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`important.css 1`] = ` +max-height: none !important; +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +max-height: none !important; + +`; diff --git a/tests/css_important/important.css b/tests/css_important/important.css new file mode 100644 index 000000000..56e380e05 --- /dev/null +++ b/tests/css_important/important.css @@ -0,0 +1 @@ +max-height: none !important; diff --git a/tests/css_important/jsfmt.spec.js b/tests/css_important/jsfmt.spec.js new file mode 100644 index 000000000..a7d303b6c --- /dev/null +++ b/tests/css_important/jsfmt.spec.js @@ -0,0 +1 @@ +run_spec(__dirname, { parser: "postcss" }); diff --git a/tests/css_long_rule/__snapshots__/jsfmt.spec.js.snap b/tests/css_long_rule/__snapshots__/jsfmt.spec.js.snap new file mode 100644 index 000000000..58aae3676 --- /dev/null +++ b/tests/css_long_rule/__snapshots__/jsfmt.spec.js.snap @@ -0,0 +1,14 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`long_rule.css 1`] = ` +.nuclide-resize-sensitive-container-sensor, +.nuclide-resize-sensitive-container-expand, +.nuclide-resize-sensitive-container-shrink { +} +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.nuclide-resize-sensitive-container-sensor, +.nuclide-resize-sensitive-container-expand, +.nuclide-resize-sensitive-container-shrink { +} + +`; diff --git a/tests/css_long_rule/jsfmt.spec.js b/tests/css_long_rule/jsfmt.spec.js new file mode 100644 index 000000000..a7d303b6c --- /dev/null +++ b/tests/css_long_rule/jsfmt.spec.js @@ -0,0 +1 @@ +run_spec(__dirname, { parser: "postcss" }); diff --git a/tests/css_long_rule/long_rule.css b/tests/css_long_rule/long_rule.css new file mode 100644 index 000000000..c306d900a --- /dev/null +++ b/tests/css_long_rule/long_rule.css @@ -0,0 +1,4 @@ +.nuclide-resize-sensitive-container-sensor, +.nuclide-resize-sensitive-container-expand, +.nuclide-resize-sensitive-container-shrink { +} diff --git a/tests/css_prefix/__snapshots__/jsfmt.spec.js.snap b/tests/css_prefix/__snapshots__/jsfmt.spec.js.snap new file mode 100644 index 000000000..8cc17be87 --- /dev/null +++ b/tests/css_prefix/__snapshots__/jsfmt.spec.js.snap @@ -0,0 +1,14 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`prefix.css 1`] = ` +div { + margin-left: -@leftMargin; + transform: translateY(-@offset); +} +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +div { + margin-left: -@leftMargin; + transform: translateY(-@offset); +} + +`; diff --git a/tests/css_prefix/jsfmt.spec.js b/tests/css_prefix/jsfmt.spec.js new file mode 100644 index 000000000..a7d303b6c --- /dev/null +++ b/tests/css_prefix/jsfmt.spec.js @@ -0,0 +1 @@ +run_spec(__dirname, { parser: "postcss" }); diff --git a/tests/css_prefix/prefix.css b/tests/css_prefix/prefix.css new file mode 100644 index 000000000..bda48ccae --- /dev/null +++ b/tests/css_prefix/prefix.css @@ -0,0 +1,4 @@ +div { + margin-left: -@leftMargin; + transform: translateY(-@offset); +} diff --git a/tests/css_pseudo_call/__snapshots__/jsfmt.spec.js.snap b/tests/css_pseudo_call/__snapshots__/jsfmt.spec.js.snap new file mode 100644 index 000000000..758ca08f0 --- /dev/null +++ b/tests/css_pseudo_call/__snapshots__/jsfmt.spec.js.snap @@ -0,0 +1,10 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`pseudo_call.css 1`] = ` +div:not(:last-child) { +} +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +div:not(:last-child) { +} + +`; diff --git a/tests/css_pseudo_call/jsfmt.spec.js b/tests/css_pseudo_call/jsfmt.spec.js new file mode 100644 index 000000000..a7d303b6c --- /dev/null +++ b/tests/css_pseudo_call/jsfmt.spec.js @@ -0,0 +1 @@ +run_spec(__dirname, { parser: "postcss" }); diff --git a/tests/css_pseudo_call/pseudo_call.css b/tests/css_pseudo_call/pseudo_call.css new file mode 100644 index 000000000..7fa5c7c01 --- /dev/null +++ b/tests/css_pseudo_call/pseudo_call.css @@ -0,0 +1,2 @@ +div:not(:last-child) { +} diff --git a/tests/stylefmt/at-apply/__snapshots__/jsfmt.spec.js.snap b/tests/stylefmt/at-apply/__snapshots__/jsfmt.spec.js.snap new file mode 100644 index 000000000..06a476602 --- /dev/null +++ b/tests/stylefmt/at-apply/__snapshots__/jsfmt.spec.js.snap @@ -0,0 +1,11 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`at-apply.css 1`] = ` +.toolbar{@apply --toolbar-theme ; +} +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.toolbar { + @apply --toolbar-theme; +} + +`; diff --git a/tests/stylefmt/at-apply/at-apply.css b/tests/stylefmt/at-apply/at-apply.css new file mode 100644 index 000000000..fa0188522 --- /dev/null +++ b/tests/stylefmt/at-apply/at-apply.css @@ -0,0 +1,2 @@ +.toolbar{@apply --toolbar-theme ; +} diff --git a/tests/stylefmt/at-apply/jsfmt.spec.js b/tests/stylefmt/at-apply/jsfmt.spec.js new file mode 100644 index 000000000..a7d303b6c --- /dev/null +++ b/tests/stylefmt/at-apply/jsfmt.spec.js @@ -0,0 +1 @@ +run_spec(__dirname, { parser: "postcss" }); diff --git a/tests/stylefmt/at-media/__snapshots__/jsfmt.spec.js.snap b/tests/stylefmt/at-media/__snapshots__/jsfmt.spec.js.snap new file mode 100644 index 000000000..b0ca3d5ef --- /dev/null +++ b/tests/stylefmt/at-media/__snapshots__/jsfmt.spec.js.snap @@ -0,0 +1,43 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`at-media.css 1`] = ` +@media ( max-width:600px ) {} +@media ( min-width:700px) and ( orientation: landscape){} +@media (min-width: 700px), handheld and (orientation: landscape) {} +@media not all and ( monochrome ) {} +@media ( not all ) and ( monochrome ) {} +@media ( not ( screen and ( color ) ) ) , print and ( color ){} +@media screen and ( device-aspect-ratio: 16/9 ), screen and (device-aspect-ratio:16/10 ) {} + +@media ( -webkit-min-device-pixel-ratio:2), + (min--moz-device-pixel-ratio: 2 ), + (min-resolution: 2dppx), + (min-resolution: 192dpi ){} +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +@media (max-width: 600px) { + +} +@media (min-width: 700px) and (orientation: landscape) { + +} +@media (min-width: 700px), handheld and (orientation: landscape) { + +} +@media not all and (monochrome) { + +} +@media (not all) and (monochrome) { + +} +@media (not ( screen and ( color ) )), print and (color) { + +} +@media screen and (device-aspect-ratio: 16/9), screen and (device-aspect-ratio: 16/10) { + +} + +@media (-webkit-min-device-pixel-ratio: 2), (min--moz-device-pixel-ratio: 2), (min-resolution: 2dppx), (min-resolution: 192dpi) { + +} + +`; diff --git a/tests/stylefmt/at-media/at-media.css b/tests/stylefmt/at-media/at-media.css new file mode 100644 index 000000000..a6dd304aa --- /dev/null +++ b/tests/stylefmt/at-media/at-media.css @@ -0,0 +1,12 @@ +@media ( max-width:600px ) {} +@media ( min-width:700px) and ( orientation: landscape){} +@media (min-width: 700px), handheld and (orientation: landscape) {} +@media not all and ( monochrome ) {} +@media ( not all ) and ( monochrome ) {} +@media ( not ( screen and ( color ) ) ) , print and ( color ){} +@media screen and ( device-aspect-ratio: 16/9 ), screen and (device-aspect-ratio:16/10 ) {} + +@media ( -webkit-min-device-pixel-ratio:2), + (min--moz-device-pixel-ratio: 2 ), + (min-resolution: 2dppx), + (min-resolution: 192dpi ){} diff --git a/tests/stylefmt/at-media/jsfmt.spec.js b/tests/stylefmt/at-media/jsfmt.spec.js new file mode 100644 index 000000000..a7d303b6c --- /dev/null +++ b/tests/stylefmt/at-media/jsfmt.spec.js @@ -0,0 +1 @@ +run_spec(__dirname, { parser: "postcss" }); diff --git a/tests/stylefmt/attr-selector/__snapshots__/jsfmt.spec.js.snap b/tests/stylefmt/attr-selector/__snapshots__/jsfmt.spec.js.snap new file mode 100644 index 000000000..65ee1da14 --- /dev/null +++ b/tests/stylefmt/attr-selector/__snapshots__/jsfmt.spec.js.snap @@ -0,0 +1,19 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`attr-selector.css 1`] = ` +[ data-sizes~="m:0" ] { + color:pink; +} + +[ class*="test" ]{ + color: silver} +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +[ data-sizes~="m:0" ] { + color: pink; +} + +[ class*="test" ] { + color: silver; +} + +`; diff --git a/tests/stylefmt/attr-selector/attr-selector.css b/tests/stylefmt/attr-selector/attr-selector.css new file mode 100644 index 000000000..beb3aadb8 --- /dev/null +++ b/tests/stylefmt/attr-selector/attr-selector.css @@ -0,0 +1,6 @@ +[ data-sizes~="m:0" ] { + color:pink; +} + +[ class*="test" ]{ + color: silver} diff --git a/tests/stylefmt/attr-selector/jsfmt.spec.js b/tests/stylefmt/attr-selector/jsfmt.spec.js new file mode 100644 index 000000000..a7d303b6c --- /dev/null +++ b/tests/stylefmt/attr-selector/jsfmt.spec.js @@ -0,0 +1 @@ +run_spec(__dirname, { parser: "postcss" }); diff --git a/tests/stylefmt/charset-2/__snapshots__/jsfmt.spec.js.snap b/tests/stylefmt/charset-2/__snapshots__/jsfmt.spec.js.snap new file mode 100644 index 000000000..139f58f3f --- /dev/null +++ b/tests/stylefmt/charset-2/__snapshots__/jsfmt.spec.js.snap @@ -0,0 +1,8 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`charset-2.css 1`] = ` +@charset "utf-8" ; +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +@charset "utf-8"; + +`; diff --git a/tests/stylefmt/charset-2/charset-2.css b/tests/stylefmt/charset-2/charset-2.css new file mode 100644 index 000000000..caa4fb4bf --- /dev/null +++ b/tests/stylefmt/charset-2/charset-2.css @@ -0,0 +1 @@ +@charset "utf-8" ; diff --git a/tests/stylefmt/charset-2/jsfmt.spec.js b/tests/stylefmt/charset-2/jsfmt.spec.js new file mode 100644 index 000000000..a7d303b6c --- /dev/null +++ b/tests/stylefmt/charset-2/jsfmt.spec.js @@ -0,0 +1 @@ +run_spec(__dirname, { parser: "postcss" }); diff --git a/tests/stylefmt/charset/__snapshots__/jsfmt.spec.js.snap b/tests/stylefmt/charset/__snapshots__/jsfmt.spec.js.snap new file mode 100644 index 000000000..6f49de4f5 --- /dev/null +++ b/tests/stylefmt/charset/__snapshots__/jsfmt.spec.js.snap @@ -0,0 +1,8 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`charset.css 1`] = ` +@charset "utf-8"; +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +@charset "utf-8"; + +`; diff --git a/tests/stylefmt/charset/charset.css b/tests/stylefmt/charset/charset.css new file mode 100644 index 000000000..e63c05cc5 --- /dev/null +++ b/tests/stylefmt/charset/charset.css @@ -0,0 +1 @@ +@charset "utf-8"; diff --git a/tests/stylefmt/charset/jsfmt.spec.js b/tests/stylefmt/charset/jsfmt.spec.js new file mode 100644 index 000000000..a7d303b6c --- /dev/null +++ b/tests/stylefmt/charset/jsfmt.spec.js @@ -0,0 +1 @@ +run_spec(__dirname, { parser: "postcss" }); diff --git a/tests/stylefmt/color-hex-lowercase/__snapshots__/jsfmt.spec.js.snap b/tests/stylefmt/color-hex-lowercase/__snapshots__/jsfmt.spec.js.snap new file mode 100644 index 000000000..92f312313 --- /dev/null +++ b/tests/stylefmt/color-hex-lowercase/__snapshots__/jsfmt.spec.js.snap @@ -0,0 +1,10 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`color-hex-lowercase.css 1`] = ` +.foo{color:#ABCDEF} +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.foo { + color: #ABCDEF; +} + +`; diff --git a/tests/stylefmt/color-hex-lowercase/color-hex-lowercase.css b/tests/stylefmt/color-hex-lowercase/color-hex-lowercase.css new file mode 100644 index 000000000..1a0c60972 --- /dev/null +++ b/tests/stylefmt/color-hex-lowercase/color-hex-lowercase.css @@ -0,0 +1 @@ +.foo{color:#ABCDEF} diff --git a/tests/stylefmt/color-hex-lowercase/jsfmt.spec.js b/tests/stylefmt/color-hex-lowercase/jsfmt.spec.js new file mode 100644 index 000000000..a7d303b6c --- /dev/null +++ b/tests/stylefmt/color-hex-lowercase/jsfmt.spec.js @@ -0,0 +1 @@ +run_spec(__dirname, { parser: "postcss" }); diff --git a/tests/stylefmt/comment-in-rules/__snapshots__/jsfmt.spec.js.snap b/tests/stylefmt/comment-in-rules/__snapshots__/jsfmt.spec.js.snap new file mode 100644 index 000000000..b560f195f --- /dev/null +++ b/tests/stylefmt/comment-in-rules/__snapshots__/jsfmt.spec.js.snap @@ -0,0 +1,33 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`comment-in-rules.css 1`] = ` +.class +{display: inline-block; +/* comment */ +float: left;} + +#id { + font-size: 12px; + + /* colors */ + + color: pink; + background: #fff; +} +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.class { + display: inline-block; + /* comment */ + float: left; +} + +#id { + font-size: 12px; + + /* colors */ + + color: pink; + background: #fff; +} + +`; diff --git a/tests/stylefmt/comment-in-rules/comment-in-rules.css b/tests/stylefmt/comment-in-rules/comment-in-rules.css new file mode 100644 index 000000000..e5a9356d4 --- /dev/null +++ b/tests/stylefmt/comment-in-rules/comment-in-rules.css @@ -0,0 +1,13 @@ +.class +{display: inline-block; +/* comment */ +float: left;} + +#id { + font-size: 12px; + + /* colors */ + + color: pink; + background: #fff; +} diff --git a/tests/stylefmt/comment-in-rules/jsfmt.spec.js b/tests/stylefmt/comment-in-rules/jsfmt.spec.js new file mode 100644 index 000000000..a7d303b6c --- /dev/null +++ b/tests/stylefmt/comment-in-rules/jsfmt.spec.js @@ -0,0 +1 @@ +run_spec(__dirname, { parser: "postcss" }); diff --git a/tests/stylefmt/comment/__snapshots__/jsfmt.spec.js.snap b/tests/stylefmt/comment/__snapshots__/jsfmt.spec.js.snap new file mode 100644 index 000000000..a625e3c16 --- /dev/null +++ b/tests/stylefmt/comment/__snapshots__/jsfmt.spec.js.snap @@ -0,0 +1,70 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`comment.css 1`] = ` +/** + * comment + */ + +.class +{ + padding:10px; } +/*comment*/ + + +.foo{color:red +} + + +/* + at rule + */ + + +@media only screen { + /* inner at rule comment */ + .foo { display: none; } + + /* + * another comment + */ + /* in a row */ + +.bar { + color:yellow; +} +} +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +/** + * comment + */ + +.class { + padding: 10px; +} +/*comment*/ + +.foo { + color: red; +} + +/* + at rule + */ + +@media only screen { + /* inner at rule comment */ + .foo { + display: none; + } + + /* + * another comment + */ + /* in a row */ + + .bar { + color: yellow; + } +} + +`; diff --git a/tests/stylefmt/comment/comment.css b/tests/stylefmt/comment/comment.css new file mode 100644 index 000000000..961d3cfbc --- /dev/null +++ b/tests/stylefmt/comment/comment.css @@ -0,0 +1,32 @@ +/** + * comment + */ + +.class +{ + padding:10px; } +/*comment*/ + + +.foo{color:red +} + + +/* + at rule + */ + + +@media only screen { + /* inner at rule comment */ + .foo { display: none; } + + /* + * another comment + */ + /* in a row */ + +.bar { + color:yellow; +} +} diff --git a/tests/stylefmt/comment/jsfmt.spec.js b/tests/stylefmt/comment/jsfmt.spec.js new file mode 100644 index 000000000..a7d303b6c --- /dev/null +++ b/tests/stylefmt/comment/jsfmt.spec.js @@ -0,0 +1 @@ +run_spec(__dirname, { parser: "postcss" }); diff --git a/tests/stylefmt/content/__snapshots__/jsfmt.spec.js.snap b/tests/stylefmt/content/__snapshots__/jsfmt.spec.js.snap new file mode 100644 index 000000000..09a195414 --- /dev/null +++ b/tests/stylefmt/content/__snapshots__/jsfmt.spec.js.snap @@ -0,0 +1,12 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`content.css 1`] = ` + div {content: " test 1/2 "; content:' test 1+2'; +} +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +div { + content: " test 1/2 "; + content: ' test 1+2'; +} + +`; diff --git a/tests/stylefmt/content/content.css b/tests/stylefmt/content/content.css new file mode 100644 index 000000000..8df36ffe8 --- /dev/null +++ b/tests/stylefmt/content/content.css @@ -0,0 +1,2 @@ + div {content: " test 1/2 "; content:' test 1+2'; +} diff --git a/tests/stylefmt/content/jsfmt.spec.js b/tests/stylefmt/content/jsfmt.spec.js new file mode 100644 index 000000000..a7d303b6c --- /dev/null +++ b/tests/stylefmt/content/jsfmt.spec.js @@ -0,0 +1 @@ +run_spec(__dirname, { parser: "postcss" }); diff --git a/tests/stylefmt/cssnext-example/__snapshots__/jsfmt.spec.js.snap b/tests/stylefmt/cssnext-example/__snapshots__/jsfmt.spec.js.snap new file mode 100644 index 000000000..0d2ff7b5d --- /dev/null +++ b/tests/stylefmt/cssnext-example/__snapshots__/jsfmt.spec.js.snap @@ -0,0 +1,106 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`cssnext-example.css 1`] = ` +/* custom properties */ +:root{--fontSize: 1rem; + --mainColor :#12345678; +--highlightColor:hwb(190, 35%, 20%); +} + +/* custom media queries */ +@custom-media + +--viewport-medium(width<=50rem); + +/* some var() & calc() */ +body{color:var(--mainColor); + font-size:var(--fontSize); + line-height: calc(var(--fontSize) * 1.5); +padding: calc((var(--fontSize) / 2) + 1px)} + +/* custom media query usage */ +@media (--viewport-medium) { +body {font-size: calc(var(--fontSize) * 1.2); } +} +/* custom selectors */ +@custom-selector :--heading h1,h2,h3, h4,h5,h6; +:--heading { margin-top:0 } + +/* colors stuff */ +a{ +color:var(--highlightColor); + transition:color 1s; +} +a:hover{color :gray(255,50%) } +a:active{color : rebeccapurple } +a:any-link { color:color(var(--highlightColor) blackness(+20%)) } + +/* font stuff */ +h2 {font-variant-caps:small-caps; +}table{font-variant-numeric: lining-nums; +} +/* filters */ +.blur{filter:blur(4px)}.sepia{ +filter: sepia(.8);} +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +/* custom properties */ +:root { + --fontSize: 1rem; + --mainColor: #12345678; + --highlightColor: hwb(190, 35%, 20%); +} + +/* custom media queries */ +@custom-media --viewport-medium(width<=50rem); + +/* some var() & calc() */ +body { + color: var(--mainColor); + font-size: var(--fontSize); + line-height: calc(var(--fontSize) * 1.5); + padding: calc((var(--fontSize) / 2) + 1px); +} + +/* custom media query usage */ +@media (--viewport-medium) { + body { + font-size: calc(var(--fontSize) * 1.2); + } +} +/* custom selectors */ +@custom-selector :--heading h1, h2, h3, h4, h5, h6; +:--heading { + margin-top: 0; +} + +/* colors stuff */ +a { + color: var(--highlightColor); + transition: color 1s; +} +a:hover { + color: gray(255, 50%); +} +a:active { + color: rebeccapurple; +} +a:any-link { + color: color(var(--highlightColor) blackness(+20%)); +} + +/* font stuff */ +h2 { + font-variant-caps: small-caps; +} +table { + font-variant-numeric: lining-nums; +} +/* filters */ +.blur { + filter: blur(4px); +} +.sepia { + filter: sepia(.8); +} + +`; diff --git a/tests/stylefmt/cssnext-example/cssnext-example.css b/tests/stylefmt/cssnext-example/cssnext-example.css new file mode 100644 index 000000000..b41aa6398 --- /dev/null +++ b/tests/stylefmt/cssnext-example/cssnext-example.css @@ -0,0 +1,41 @@ +/* custom properties */ +:root{--fontSize: 1rem; + --mainColor :#12345678; +--highlightColor:hwb(190, 35%, 20%); +} + +/* custom media queries */ +@custom-media + +--viewport-medium(width<=50rem); + +/* some var() & calc() */ +body{color:var(--mainColor); + font-size:var(--fontSize); + line-height: calc(var(--fontSize) * 1.5); +padding: calc((var(--fontSize) / 2) + 1px)} + +/* custom media query usage */ +@media (--viewport-medium) { +body {font-size: calc(var(--fontSize) * 1.2); } +} +/* custom selectors */ +@custom-selector :--heading h1,h2,h3, h4,h5,h6; +:--heading { margin-top:0 } + +/* colors stuff */ +a{ +color:var(--highlightColor); + transition:color 1s; +} +a:hover{color :gray(255,50%) } +a:active{color : rebeccapurple } +a:any-link { color:color(var(--highlightColor) blackness(+20%)) } + +/* font stuff */ +h2 {font-variant-caps:small-caps; +}table{font-variant-numeric: lining-nums; +} +/* filters */ +.blur{filter:blur(4px)}.sepia{ +filter: sepia(.8);} diff --git a/tests/stylefmt/cssnext-example/jsfmt.spec.js b/tests/stylefmt/cssnext-example/jsfmt.spec.js new file mode 100644 index 000000000..a7d303b6c --- /dev/null +++ b/tests/stylefmt/cssnext-example/jsfmt.spec.js @@ -0,0 +1 @@ +run_spec(__dirname, { parser: "postcss" }); diff --git a/tests/stylefmt/custom-media-queries/__snapshots__/jsfmt.spec.js.snap b/tests/stylefmt/custom-media-queries/__snapshots__/jsfmt.spec.js.snap new file mode 100644 index 000000000..bffc8b478 --- /dev/null +++ b/tests/stylefmt/custom-media-queries/__snapshots__/jsfmt.spec.js.snap @@ -0,0 +1,21 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`custom-media-queries.css 1`] = ` +@custom-media --small-viewport ( max-width:30em ) + + +; + +@media ( --small-viewport ){ +.rule{color:blue;} +} +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +@custom-media --small-viewport (max-width: 30em); + +@media (--small-viewport) { + .rule { + color: blue; + } +} + +`; diff --git a/tests/stylefmt/custom-media-queries/custom-media-queries.css b/tests/stylefmt/custom-media-queries/custom-media-queries.css new file mode 100644 index 000000000..1fa560748 --- /dev/null +++ b/tests/stylefmt/custom-media-queries/custom-media-queries.css @@ -0,0 +1,8 @@ +@custom-media --small-viewport ( max-width:30em ) + + +; + +@media ( --small-viewport ){ +.rule{color:blue;} +} diff --git a/tests/stylefmt/custom-media-queries/jsfmt.spec.js b/tests/stylefmt/custom-media-queries/jsfmt.spec.js new file mode 100644 index 000000000..a7d303b6c --- /dev/null +++ b/tests/stylefmt/custom-media-queries/jsfmt.spec.js @@ -0,0 +1 @@ +run_spec(__dirname, { parser: "postcss" }); diff --git a/tests/stylefmt/custom-properties/__snapshots__/jsfmt.spec.js.snap b/tests/stylefmt/custom-properties/__snapshots__/jsfmt.spec.js.snap new file mode 100644 index 000000000..169084216 --- /dev/null +++ b/tests/stylefmt/custom-properties/__snapshots__/jsfmt.spec.js.snap @@ -0,0 +1,14 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`custom-properties.css 1`] = ` +:root{--mainColor:#123456} +a{color:var ( --mainColor ) ; } +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +:root { + --mainColor: #123456; +} +a { + color: var (--mainColor); +} + +`; diff --git a/tests/stylefmt/custom-properties/custom-properties.css b/tests/stylefmt/custom-properties/custom-properties.css new file mode 100644 index 000000000..b8a2ed8f7 --- /dev/null +++ b/tests/stylefmt/custom-properties/custom-properties.css @@ -0,0 +1,2 @@ +:root{--mainColor:#123456} +a{color:var ( --mainColor ) ; } diff --git a/tests/stylefmt/custom-properties/jsfmt.spec.js b/tests/stylefmt/custom-properties/jsfmt.spec.js new file mode 100644 index 000000000..a7d303b6c --- /dev/null +++ b/tests/stylefmt/custom-properties/jsfmt.spec.js @@ -0,0 +1 @@ +run_spec(__dirname, { parser: "postcss" }); diff --git a/tests/stylefmt/custom-selectors/__snapshots__/jsfmt.spec.js.snap b/tests/stylefmt/custom-selectors/__snapshots__/jsfmt.spec.js.snap new file mode 100644 index 000000000..aab8a4a68 --- /dev/null +++ b/tests/stylefmt/custom-selectors/__snapshots__/jsfmt.spec.js.snap @@ -0,0 +1,22 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`custom-selectors.css 1`] = ` +@custom-selector :--button button,.button; +@custom-selector :--enter :hover,:focus ; + +:--button {display: inline-block; +}:--button:--enter{ + text-decoration:underline; +} +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +@custom-selector :--button button, .button; +@custom-selector :--enter :hover, :focus; + +:--button { + display: inline-block; +} +:--button:--enter { + text-decoration: underline; +} + +`; diff --git a/tests/stylefmt/custom-selectors/custom-selectors.css b/tests/stylefmt/custom-selectors/custom-selectors.css new file mode 100644 index 000000000..b2e59a4f6 --- /dev/null +++ b/tests/stylefmt/custom-selectors/custom-selectors.css @@ -0,0 +1,7 @@ +@custom-selector :--button button,.button; +@custom-selector :--enter :hover,:focus ; + +:--button {display: inline-block; +}:--button:--enter{ + text-decoration:underline; +} diff --git a/tests/stylefmt/custom-selectors/jsfmt.spec.js b/tests/stylefmt/custom-selectors/jsfmt.spec.js new file mode 100644 index 000000000..a7d303b6c --- /dev/null +++ b/tests/stylefmt/custom-selectors/jsfmt.spec.js @@ -0,0 +1 @@ +run_spec(__dirname, { parser: "postcss" }); diff --git a/tests/stylefmt/data-url/__snapshots__/jsfmt.spec.js.snap b/tests/stylefmt/data-url/__snapshots__/jsfmt.spec.js.snap new file mode 100644 index 000000000..389d6d5a1 --- /dev/null +++ b/tests/stylefmt/data-url/__snapshots__/jsfmt.spec.js.snap @@ -0,0 +1,12 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`data-url.css 1`] = ` +div { + background-image: url(data:image/png;base64,iVBORw0KGg); +} +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +div { + background-image: url(data:image/png;base64,iVBORw0KGg); +} + +`; diff --git a/tests/stylefmt/data-url/data-url.css b/tests/stylefmt/data-url/data-url.css new file mode 100644 index 000000000..863cb686f --- /dev/null +++ b/tests/stylefmt/data-url/data-url.css @@ -0,0 +1,3 @@ +div { + background-image: url(data:image/png;base64,iVBORw0KGg); +} diff --git a/tests/stylefmt/data-url/jsfmt.spec.js b/tests/stylefmt/data-url/jsfmt.spec.js new file mode 100644 index 000000000..a7d303b6c --- /dev/null +++ b/tests/stylefmt/data-url/jsfmt.spec.js @@ -0,0 +1 @@ +run_spec(__dirname, { parser: "postcss" }); diff --git a/tests/stylefmt/font-face/__snapshots__/jsfmt.spec.js.snap b/tests/stylefmt/font-face/__snapshots__/jsfmt.spec.js.snap new file mode 100644 index 000000000..db3ff6988 --- /dev/null +++ b/tests/stylefmt/font-face/__snapshots__/jsfmt.spec.js.snap @@ -0,0 +1,17 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`font-face.css 1`] = ` + @font-face {font-family:'HelveticaNeueW02-45Ligh';src:url("/fonts/pictos-web.eot");src:local("☺"),url("/fonts/pictos-web.woff") format("woff"),url("/fonts/pictos-web.ttf") format("truetype"),url("/fonts/pictos-web.svg#webfontIyfZbseF") format("svg");font-weight:normal;font-style:normal;} +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +@font-face { + font-family: 'HelveticaNeueW02-45Ligh'; + src: url("/fonts/pictos-web.eot"); + src: local("☺"), + url("/fonts/pictos-web.woff") format("woff"), + url("/fonts/pictos-web.ttf") format("truetype"), + url("/fonts/pictos-web.svg#webfontIyfZbseF") format("svg"); + font-weight: normal; + font-style: normal; +} + +`; diff --git a/tests/stylefmt/font-face/font-face.css b/tests/stylefmt/font-face/font-face.css new file mode 100644 index 000000000..1f6b13ea8 --- /dev/null +++ b/tests/stylefmt/font-face/font-face.css @@ -0,0 +1 @@ + @font-face {font-family:'HelveticaNeueW02-45Ligh';src:url("/fonts/pictos-web.eot");src:local("☺"),url("/fonts/pictos-web.woff") format("woff"),url("/fonts/pictos-web.ttf") format("truetype"),url("/fonts/pictos-web.svg#webfontIyfZbseF") format("svg");font-weight:normal;font-style:normal;} diff --git a/tests/stylefmt/font-face/jsfmt.spec.js b/tests/stylefmt/font-face/jsfmt.spec.js new file mode 100644 index 000000000..a7d303b6c --- /dev/null +++ b/tests/stylefmt/font-face/jsfmt.spec.js @@ -0,0 +1 @@ +run_spec(__dirname, { parser: "postcss" }); diff --git a/tests/stylefmt/font-shorthand/__snapshots__/jsfmt.spec.js.snap b/tests/stylefmt/font-shorthand/__snapshots__/jsfmt.spec.js.snap new file mode 100644 index 000000000..8ee60f0fd --- /dev/null +++ b/tests/stylefmt/font-shorthand/__snapshots__/jsfmt.spec.js.snap @@ -0,0 +1,15 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`font-shorthand.css 1`] = ` +.class { + font: normal normal 24px/1 "myfont";font: normal normal normal 12px/20px myfont; + font:normal 300 0.875em/1.3 "myfont", sans-serif; +} +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.class { + font: normal normal 24px / 1 "myfont"; + font: normal normal normal 12px / 20px myfont; + font: normal 300 0.875em / 1.3 "myfont", sans-serif; +} + +`; diff --git a/tests/stylefmt/font-shorthand/font-shorthand.css b/tests/stylefmt/font-shorthand/font-shorthand.css new file mode 100644 index 000000000..be02a9f4a --- /dev/null +++ b/tests/stylefmt/font-shorthand/font-shorthand.css @@ -0,0 +1,4 @@ +.class { + font: normal normal 24px/1 "myfont";font: normal normal normal 12px/20px myfont; + font:normal 300 0.875em/1.3 "myfont", sans-serif; +} diff --git a/tests/stylefmt/font-shorthand/jsfmt.spec.js b/tests/stylefmt/font-shorthand/jsfmt.spec.js new file mode 100644 index 000000000..a7d303b6c --- /dev/null +++ b/tests/stylefmt/font-shorthand/jsfmt.spec.js @@ -0,0 +1 @@ +run_spec(__dirname, { parser: "postcss" }); diff --git a/tests/stylefmt/ie-hacks/__snapshots__/jsfmt.spec.js.snap b/tests/stylefmt/ie-hacks/__snapshots__/jsfmt.spec.js.snap new file mode 100644 index 000000000..6645505e4 --- /dev/null +++ b/tests/stylefmt/ie-hacks/__snapshots__/jsfmt.spec.js.snap @@ -0,0 +1,27 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`ie-hacks.css 1`] = ` +* html p {font-size: 5em; } +.class { +*zoom: 1;_width: 200px; ++color:red; +*+color:red; +color:red\\9; +color:red\\0; +color:red\\9\\0; +} +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +* html p { + font-size: 5em; +} +.class { + *zoom: 1; + _width: 200px; + +color: red; + *+color: red; + color: red\\9; + color: red\\0; + color: red\\9\\0; +} + +`; diff --git a/tests/stylefmt/ie-hacks/ie-hacks.css b/tests/stylefmt/ie-hacks/ie-hacks.css new file mode 100644 index 000000000..3753df97d --- /dev/null +++ b/tests/stylefmt/ie-hacks/ie-hacks.css @@ -0,0 +1,9 @@ +* html p {font-size: 5em; } +.class { +*zoom: 1;_width: 200px; ++color:red; +*+color:red; +color:red\9; +color:red\0; +color:red\9\0; +} diff --git a/tests/stylefmt/ie-hacks/jsfmt.spec.js b/tests/stylefmt/ie-hacks/jsfmt.spec.js new file mode 100644 index 000000000..a7d303b6c --- /dev/null +++ b/tests/stylefmt/ie-hacks/jsfmt.spec.js @@ -0,0 +1 @@ +run_spec(__dirname, { parser: "postcss" }); diff --git a/tests/stylefmt/import/__snapshots__/jsfmt.spec.js.snap b/tests/stylefmt/import/__snapshots__/jsfmt.spec.js.snap new file mode 100644 index 000000000..a8183a055 --- /dev/null +++ b/tests/stylefmt/import/__snapshots__/jsfmt.spec.js.snap @@ -0,0 +1,19 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`import.css 1`] = ` + @import "./settings" ; + + +@import "./components" ;@import "./themes"; +.class{float: left; +} +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +@import "./settings"; + +@import "./components"; +@import "./themes"; +.class { + float: left; +} + +`; diff --git a/tests/stylefmt/import/import.css b/tests/stylefmt/import/import.css new file mode 100644 index 000000000..fe65fab3c --- /dev/null +++ b/tests/stylefmt/import/import.css @@ -0,0 +1,6 @@ + @import "./settings" ; + + +@import "./components" ;@import "./themes"; +.class{float: left; +} diff --git a/tests/stylefmt/import/jsfmt.spec.js b/tests/stylefmt/import/jsfmt.spec.js new file mode 100644 index 000000000..a7d303b6c --- /dev/null +++ b/tests/stylefmt/import/jsfmt.spec.js @@ -0,0 +1 @@ +run_spec(__dirname, { parser: "postcss" }); diff --git a/tests/stylefmt/important/__snapshots__/jsfmt.spec.js.snap b/tests/stylefmt/important/__snapshots__/jsfmt.spec.js.snap new file mode 100644 index 000000000..932d35878 --- /dev/null +++ b/tests/stylefmt/important/__snapshots__/jsfmt.spec.js.snap @@ -0,0 +1,12 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`important.css 1`] = ` +.class { + color: red ! important; +} +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.class { + color: red !important; +} + +`; diff --git a/tests/stylefmt/important/important.css b/tests/stylefmt/important/important.css new file mode 100644 index 000000000..c682d9d97 --- /dev/null +++ b/tests/stylefmt/important/important.css @@ -0,0 +1,3 @@ +.class { + color: red ! important; +} diff --git a/tests/stylefmt/important/jsfmt.spec.js b/tests/stylefmt/important/jsfmt.spec.js new file mode 100644 index 000000000..a7d303b6c --- /dev/null +++ b/tests/stylefmt/important/jsfmt.spec.js @@ -0,0 +1 @@ +run_spec(__dirname, { parser: "postcss" }); diff --git a/tests/stylefmt/inline-comment/__snapshots__/jsfmt.spec.js.snap b/tests/stylefmt/inline-comment/__snapshots__/jsfmt.spec.js.snap new file mode 100644 index 000000000..57cac46ef --- /dev/null +++ b/tests/stylefmt/inline-comment/__snapshots__/jsfmt.spec.js.snap @@ -0,0 +1,17 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`inline-comment.css 1`] = ` + + // inline comments + + + + .class {color: red;} +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// inline comments + +.class { + color: red; +} + +`; diff --git a/tests/stylefmt/inline-comment/inline-comment.css b/tests/stylefmt/inline-comment/inline-comment.css new file mode 100644 index 000000000..af8867ae0 --- /dev/null +++ b/tests/stylefmt/inline-comment/inline-comment.css @@ -0,0 +1,6 @@ + + // inline comments + + + + .class {color: red;} diff --git a/tests/stylefmt/inline-comment/jsfmt.spec.js b/tests/stylefmt/inline-comment/jsfmt.spec.js new file mode 100644 index 000000000..a7d303b6c --- /dev/null +++ b/tests/stylefmt/inline-comment/jsfmt.spec.js @@ -0,0 +1 @@ +run_spec(__dirname, { parser: "postcss" }); diff --git a/tests/stylefmt/lowercase/__snapshots__/jsfmt.spec.js.snap b/tests/stylefmt/lowercase/__snapshots__/jsfmt.spec.js.snap new file mode 100644 index 000000000..a84f5ef5e --- /dev/null +++ b/tests/stylefmt/lowercase/__snapshots__/jsfmt.spec.js.snap @@ -0,0 +1,105 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`lowercase.css 1`] = ` +@charset "UTF-8"; + +$myVar: TRANSLATEX(0); +$myVar2: RGB(255,255,255); +$myVar3: MAROON; +$myVar4: HSLA(120,100%,50%,0.3); +$myVar5: RGBA(0,0,0,0.5); +$myVar6: HSL(120,100%,50%); +$myVar7: linear-gradient(to right, RGBA(0,0,0,0.5), RGB(255,255,255)); + +.class-1 { + BACKGROUND: HSL(120, 100%, 50%); + BACKGROUND: linear-gradient(to right, $myVar2, RGB(255,255,255)); + COLOR: RGB(0, 0, 0); + TRANSFORM: TRANSLATE(0,0) TRANSLATEX(0) TRANSLATEY(0) TRANSLATEZ(0) TRANSLATE3D(0,0,0) MATRIX(1,1,1,1); + TRANSFORM: TRANSLATE(0,0); + TRANSFORM: TRANSLATEX(0); + TRANSFORM: TRANSLATEY(0); + TRANSFORM: TRANSLATE3D(0,0,0); + TRANSFORM: MATRIX(1,1,1,1); + transform: translateY(0) $myVar; + animation: textAnimation 0.1s; + animation: tAnimation 0.1s; +} + +.class-2 { + BACKGROUND-COLOR: INDIGO; + BACKGROUND: HSLA(120, 100%, 50%, 0.3); + COLOR: RGBA(0, 0, 0, 0.5); + TRANSFORM: ROTATE(1deg) ROTATEX(1deg) ROTATEY(1deg) ROTATEZ(1deg) ROTATE3D(0,0,1,1deg) SKEW(1deg) SKEWX(1deg) SKEWY(1deg) SCALE(1, 1) SCALEX(1) SCALEY(1); + TRANSFORM: ROTATE(1deg); + TRANSFORM: ROTATEX(1deg); + TRANSFORM: ROTATEY(1deg); + TRANSFORM: ROTATEZ(1deg); + TRANSFORM: ROTATE3D(0,0,1,1deg); + TRANSFORM: SKEW(1deg); + TRANSFORM: SKEWX(1deg); + TRANSFORM: SKEWY(1deg); + TRANSFORM: SCALE(1, 1); + TRANSFORM: SCALEX(1); + TRANSFORM: SCALEY(1); +} +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +@charset "UTF-8"; + +$myVar: TRANSLATEX(0); +$myVar2: RGB(255, 255, 255); +$myVar3: MAROON; +$myVar4: HSLA(120, 100%, 50%, 0.3); +$myVar5: RGBA(0, 0, 0, 0.5); +$myVar6: HSL(120, 100%, 50%); +$myVar7: linear-gradient(to right, RGBA(0, 0, 0, 0.5), RGB(255, 255, 255)); + +.class-1 { + BACKGROUND: HSL(120, 100%, 50%); + BACKGROUND: linear-gradient(to right, $myVar2, RGB(255, 255, 255)); + COLOR: RGB(0, 0, 0); + TRANSFORM: TRANSLATE(0, 0) + TRANSLATEX(0) + TRANSLATEY(0) + TRANSLATEZ(0) + TRANSLATE3D(0, 0, 0) + MATRIX(1, 1, 1, 1); + TRANSFORM: TRANSLATE(0, 0); + TRANSFORM: TRANSLATEX(0); + TRANSFORM: TRANSLATEY(0); + TRANSFORM: TRANSLATE3D(0, 0, 0); + TRANSFORM: MATRIX(1, 1, 1, 1); + transform: translateY(0) $myVar; + animation: textAnimation 0.1s; + animation: tAnimation 0.1s; +} + +.class-2 { + BACKGROUND-COLOR: INDIGO; + BACKGROUND: HSLA(120, 100%, 50%, 0.3); + COLOR: RGBA(0, 0, 0, 0.5); + TRANSFORM: ROTATE(1deg) + ROTATEX(1deg) + ROTATEY(1deg) + ROTATEZ(1deg) + ROTATE3D(0, 0, 1, 1deg) + SKEW(1deg) + SKEWX(1deg) + SKEWY(1deg) + SCALE(1, 1) + SCALEX(1) + SCALEY(1); + TRANSFORM: ROTATE(1deg); + TRANSFORM: ROTATEX(1deg); + TRANSFORM: ROTATEY(1deg); + TRANSFORM: ROTATEZ(1deg); + TRANSFORM: ROTATE3D(0, 0, 1, 1deg); + TRANSFORM: SKEW(1deg); + TRANSFORM: SKEWX(1deg); + TRANSFORM: SKEWY(1deg); + TRANSFORM: SCALE(1, 1); + TRANSFORM: SCALEX(1); + TRANSFORM: SCALEY(1); +} + +`; diff --git a/tests/stylefmt/lowercase/jsfmt.spec.js b/tests/stylefmt/lowercase/jsfmt.spec.js new file mode 100644 index 000000000..a7d303b6c --- /dev/null +++ b/tests/stylefmt/lowercase/jsfmt.spec.js @@ -0,0 +1 @@ +run_spec(__dirname, { parser: "postcss" }); diff --git a/tests/stylefmt/lowercase/lowercase.css b/tests/stylefmt/lowercase/lowercase.css new file mode 100644 index 000000000..50f5cb2ba --- /dev/null +++ b/tests/stylefmt/lowercase/lowercase.css @@ -0,0 +1,42 @@ +@charset "UTF-8"; + +$myVar: TRANSLATEX(0); +$myVar2: RGB(255,255,255); +$myVar3: MAROON; +$myVar4: HSLA(120,100%,50%,0.3); +$myVar5: RGBA(0,0,0,0.5); +$myVar6: HSL(120,100%,50%); +$myVar7: linear-gradient(to right, RGBA(0,0,0,0.5), RGB(255,255,255)); + +.class-1 { + BACKGROUND: HSL(120, 100%, 50%); + BACKGROUND: linear-gradient(to right, $myVar2, RGB(255,255,255)); + COLOR: RGB(0, 0, 0); + TRANSFORM: TRANSLATE(0,0) TRANSLATEX(0) TRANSLATEY(0) TRANSLATEZ(0) TRANSLATE3D(0,0,0) MATRIX(1,1,1,1); + TRANSFORM: TRANSLATE(0,0); + TRANSFORM: TRANSLATEX(0); + TRANSFORM: TRANSLATEY(0); + TRANSFORM: TRANSLATE3D(0,0,0); + TRANSFORM: MATRIX(1,1,1,1); + transform: translateY(0) $myVar; + animation: textAnimation 0.1s; + animation: tAnimation 0.1s; +} + +.class-2 { + BACKGROUND-COLOR: INDIGO; + BACKGROUND: HSLA(120, 100%, 50%, 0.3); + COLOR: RGBA(0, 0, 0, 0.5); + TRANSFORM: ROTATE(1deg) ROTATEX(1deg) ROTATEY(1deg) ROTATEZ(1deg) ROTATE3D(0,0,1,1deg) SKEW(1deg) SKEWX(1deg) SKEWY(1deg) SCALE(1, 1) SCALEX(1) SCALEY(1); + TRANSFORM: ROTATE(1deg); + TRANSFORM: ROTATEX(1deg); + TRANSFORM: ROTATEY(1deg); + TRANSFORM: ROTATEZ(1deg); + TRANSFORM: ROTATE3D(0,0,1,1deg); + TRANSFORM: SKEW(1deg); + TRANSFORM: SKEWX(1deg); + TRANSFORM: SKEWY(1deg); + TRANSFORM: SCALE(1, 1); + TRANSFORM: SCALEX(1); + TRANSFORM: SCALEY(1); +} diff --git a/tests/stylefmt/media-indent-with-import/__snapshots__/jsfmt.spec.js.snap b/tests/stylefmt/media-indent-with-import/__snapshots__/jsfmt.spec.js.snap new file mode 100644 index 000000000..77ec9bb3f --- /dev/null +++ b/tests/stylefmt/media-indent-with-import/__snapshots__/jsfmt.spec.js.snap @@ -0,0 +1,19 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`media-indent-with-import.css 1`] = ` +@import "foo";@import "bar"; +.wrapper { +@media (min-width: 1025px) { +max-width: 600px; +} +} +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +@import "foo"; +@import "bar"; +.wrapper { + @media (min-width: 1025px) { + max-width: 600px; + } +} + +`; diff --git a/tests/stylefmt/media-indent-with-import/jsfmt.spec.js b/tests/stylefmt/media-indent-with-import/jsfmt.spec.js new file mode 100644 index 000000000..a7d303b6c --- /dev/null +++ b/tests/stylefmt/media-indent-with-import/jsfmt.spec.js @@ -0,0 +1 @@ +run_spec(__dirname, { parser: "postcss" }); diff --git a/tests/stylefmt/media-indent-with-import/media-indent-with-import.css b/tests/stylefmt/media-indent-with-import/media-indent-with-import.css new file mode 100644 index 000000000..693f0b304 --- /dev/null +++ b/tests/stylefmt/media-indent-with-import/media-indent-with-import.css @@ -0,0 +1,6 @@ +@import "foo";@import "bar"; +.wrapper { +@media (min-width: 1025px) { +max-width: 600px; +} +} diff --git a/tests/stylefmt/media-indent/__snapshots__/jsfmt.spec.js.snap b/tests/stylefmt/media-indent/__snapshots__/jsfmt.spec.js.snap new file mode 100644 index 000000000..ebb3a17e9 --- /dev/null +++ b/tests/stylefmt/media-indent/__snapshots__/jsfmt.spec.js.snap @@ -0,0 +1,17 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`media-indent.css 1`] = ` +.foo { + @media(max-width:1000px) + { + display: none; + } + } +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.foo { + @media (max-width: 1000px) { + display: none; + } +} + +`; diff --git a/tests/stylefmt/media-indent/jsfmt.spec.js b/tests/stylefmt/media-indent/jsfmt.spec.js new file mode 100644 index 000000000..a7d303b6c --- /dev/null +++ b/tests/stylefmt/media-indent/jsfmt.spec.js @@ -0,0 +1 @@ +run_spec(__dirname, { parser: "postcss" }); diff --git a/tests/stylefmt/media-indent/media-indent.css b/tests/stylefmt/media-indent/media-indent.css new file mode 100644 index 000000000..6ccf5d553 --- /dev/null +++ b/tests/stylefmt/media-indent/media-indent.css @@ -0,0 +1,6 @@ +.foo { + @media(max-width:1000px) + { + display: none; + } + } diff --git a/tests/stylefmt/media-queries-ranges/__snapshots__/jsfmt.spec.js.snap b/tests/stylefmt/media-queries-ranges/__snapshots__/jsfmt.spec.js.snap new file mode 100644 index 000000000..80767293b --- /dev/null +++ b/tests/stylefmt/media-queries-ranges/__snapshots__/jsfmt.spec.js.snap @@ -0,0 +1,23 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`media-queries-ranges.css 1`] = ` +@media (width >= 500px) and (width <= 1200px) { + .rule {color:red;} +} +@custom-media --only-medium-screen ( width >=500px ) and (width<= 1200px ) ; +@media ( --only-medium-screen ){ + .rule{color:blue;}} +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +@media (width >= 500px) and (width <= 1200px) { + .rule { + color: red; + } +} +@custom-media --only-medium-screen (width >=500px) and (width<= 1200px); +@media (--only-medium-screen) { + .rule { + color: blue; + } +} + +`; diff --git a/tests/stylefmt/media-queries-ranges/jsfmt.spec.js b/tests/stylefmt/media-queries-ranges/jsfmt.spec.js new file mode 100644 index 000000000..a7d303b6c --- /dev/null +++ b/tests/stylefmt/media-queries-ranges/jsfmt.spec.js @@ -0,0 +1 @@ +run_spec(__dirname, { parser: "postcss" }); diff --git a/tests/stylefmt/media-queries-ranges/media-queries-ranges.css b/tests/stylefmt/media-queries-ranges/media-queries-ranges.css new file mode 100644 index 000000000..bb0860cad --- /dev/null +++ b/tests/stylefmt/media-queries-ranges/media-queries-ranges.css @@ -0,0 +1,6 @@ +@media (width >= 500px) and (width <= 1200px) { + .rule {color:red;} +} +@custom-media --only-medium-screen ( width >=500px ) and (width<= 1200px ) ; +@media ( --only-medium-screen ){ + .rule{color:blue;}} diff --git a/tests/stylefmt/nested-2/__snapshots__/jsfmt.spec.js.snap b/tests/stylefmt/nested-2/__snapshots__/jsfmt.spec.js.snap new file mode 100644 index 000000000..6593a22f6 --- /dev/null +++ b/tests/stylefmt/nested-2/__snapshots__/jsfmt.spec.js.snap @@ -0,0 +1,43 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`nested-2.css 1`] = ` +.btn {&:hover { + color: red; + }&:active { +color:blue;} &:nth-child(5n+1) { + color:blue; + } + &:nth-child(-n+3) { color: green;} +> li > a { color: red} >li>li { + color: blue; + } +> p + p { + color: green; + } + } +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.btn { + &:hover { + color: red; + } + &:active { + color: blue; + } + &:nth-child(5n + 1) { + color: blue; + } + &:nth-child(-n + 3) { + color: green; + } + > li > a { + color: red; + } + > li > li { + color: blue; + } + > p + p { + color: green; + } +} + +`; diff --git a/tests/stylefmt/nested-2/jsfmt.spec.js b/tests/stylefmt/nested-2/jsfmt.spec.js new file mode 100644 index 000000000..a7d303b6c --- /dev/null +++ b/tests/stylefmt/nested-2/jsfmt.spec.js @@ -0,0 +1 @@ +run_spec(__dirname, { parser: "postcss" }); diff --git a/tests/stylefmt/nested-2/nested-2.css b/tests/stylefmt/nested-2/nested-2.css new file mode 100644 index 000000000..c6c192ffd --- /dev/null +++ b/tests/stylefmt/nested-2/nested-2.css @@ -0,0 +1,14 @@ +.btn {&:hover { + color: red; + }&:active { +color:blue;} &:nth-child(5n+1) { + color:blue; + } + &:nth-child(-n+3) { color: green;} +> li > a { color: red} >li>li { + color: blue; + } +> p + p { + color: green; + } + } diff --git a/tests/stylefmt/nested-atrule/__snapshots__/jsfmt.spec.js.snap b/tests/stylefmt/nested-atrule/__snapshots__/jsfmt.spec.js.snap new file mode 100644 index 000000000..b460cd202 --- /dev/null +++ b/tests/stylefmt/nested-atrule/__snapshots__/jsfmt.spec.js.snap @@ -0,0 +1,19 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`nested-atrule.css 1`] = ` +@media (min-width: 992px){@media (max-width: 1200px) { +.container + +{position: absolute + }} +} +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +@media (min-width: 992px) { + @media (max-width: 1200px) { + .container { + position: absolute; + } + } +} + +`; diff --git a/tests/stylefmt/nested-atrule/jsfmt.spec.js b/tests/stylefmt/nested-atrule/jsfmt.spec.js new file mode 100644 index 000000000..a7d303b6c --- /dev/null +++ b/tests/stylefmt/nested-atrule/jsfmt.spec.js @@ -0,0 +1 @@ +run_spec(__dirname, { parser: "postcss" }); diff --git a/tests/stylefmt/nested-atrule/nested-atrule.css b/tests/stylefmt/nested-atrule/nested-atrule.css new file mode 100644 index 000000000..ad41019c1 --- /dev/null +++ b/tests/stylefmt/nested-atrule/nested-atrule.css @@ -0,0 +1,6 @@ +@media (min-width: 992px){@media (max-width: 1200px) { +.container + +{position: absolute + }} +} diff --git a/tests/stylefmt/nested-indention-2/__snapshots__/jsfmt.spec.js.snap b/tests/stylefmt/nested-indention-2/__snapshots__/jsfmt.spec.js.snap new file mode 100644 index 000000000..703addcb5 --- /dev/null +++ b/tests/stylefmt/nested-indention-2/__snapshots__/jsfmt.spec.js.snap @@ -0,0 +1,44 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`nested-indention-2.css 1`] = ` +.y-photo-grid{ + display: flex; + width: 100%; + margin: 0; + padding: 0; + flex-direction: column; + align-items: stretch; + justify-content: flex-start; + + &__row, &__item, &__link, &__image{ + display: flex; + width: 100%; + margin: 0; + padding: 0; + flex-direction: row; + align-items: center; + justify-content: flex-start; + } +} +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.y-photo-grid { + display: flex; + width: 100%; + margin: 0; + padding: 0; + flex-direction: column; + align-items: stretch; + justify-content: flex-start; + + &__row, &__item, &__link, &__image { + display: flex; + width: 100%; + margin: 0; + padding: 0; + flex-direction: row; + align-items: center; + justify-content: flex-start; + } +} + +`; diff --git a/tests/stylefmt/nested-indention-2/jsfmt.spec.js b/tests/stylefmt/nested-indention-2/jsfmt.spec.js new file mode 100644 index 000000000..a7d303b6c --- /dev/null +++ b/tests/stylefmt/nested-indention-2/jsfmt.spec.js @@ -0,0 +1 @@ +run_spec(__dirname, { parser: "postcss" }); diff --git a/tests/stylefmt/nested-indention-2/nested-indention-2.css b/tests/stylefmt/nested-indention-2/nested-indention-2.css new file mode 100644 index 000000000..f1f55e538 --- /dev/null +++ b/tests/stylefmt/nested-indention-2/nested-indention-2.css @@ -0,0 +1,19 @@ +.y-photo-grid{ + display: flex; + width: 100%; + margin: 0; + padding: 0; + flex-direction: column; + align-items: stretch; + justify-content: flex-start; + + &__row, &__item, &__link, &__image{ + display: flex; + width: 100%; + margin: 0; + padding: 0; + flex-direction: row; + align-items: center; + justify-content: flex-start; + } +} diff --git a/tests/stylefmt/nested-indention/__snapshots__/jsfmt.spec.js.snap b/tests/stylefmt/nested-indention/__snapshots__/jsfmt.spec.js.snap new file mode 100644 index 000000000..7e40d3fbe --- /dev/null +++ b/tests/stylefmt/nested-indention/__snapshots__/jsfmt.spec.js.snap @@ -0,0 +1,92 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`nested-indention.css 1`] = ` +.y-photo-grid +{ + display: flex; + width: 100%; + margin: 0; + padding: 0; + flex-direction: column; + align-items: stretch; + justify-content: flex-start; + + &__row + { + display: flex; + width: 100%; + margin: 0; + padding: 0; + flex-direction: row; + align-items: center; + justify-content: flex-start; + } + + &__item + { + display: block; + margin: 0; + background: #eee; + + &:first-child + { + margin-left: 0; + } + } + + &__link + { + display: block; + height: 100%; + width: 100%; + } + + &__image + { + width: 100%; + height: 100%; + } +} +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.y-photo-grid { + display: flex; + width: 100%; + margin: 0; + padding: 0; + flex-direction: column; + align-items: stretch; + justify-content: flex-start; + + &__row { + display: flex; + width: 100%; + margin: 0; + padding: 0; + flex-direction: row; + align-items: center; + justify-content: flex-start; + } + + &__item { + display: block; + margin: 0; + background: #eee; + + &:first-child { + margin-left: 0; + } + } + + &__link { + display: block; + height: 100%; + width: 100%; + } + + &__image { + width: 100%; + height: 100%; + } +} + +`; diff --git a/tests/stylefmt/nested-indention/jsfmt.spec.js b/tests/stylefmt/nested-indention/jsfmt.spec.js new file mode 100644 index 000000000..a7d303b6c --- /dev/null +++ b/tests/stylefmt/nested-indention/jsfmt.spec.js @@ -0,0 +1 @@ +run_spec(__dirname, { parser: "postcss" }); diff --git a/tests/stylefmt/nested-indention/nested-indention.css b/tests/stylefmt/nested-indention/nested-indention.css new file mode 100644 index 000000000..c7fbf642a --- /dev/null +++ b/tests/stylefmt/nested-indention/nested-indention.css @@ -0,0 +1,46 @@ +.y-photo-grid +{ + display: flex; + width: 100%; + margin: 0; + padding: 0; + flex-direction: column; + align-items: stretch; + justify-content: flex-start; + + &__row + { + display: flex; + width: 100%; + margin: 0; + padding: 0; + flex-direction: row; + align-items: center; + justify-content: flex-start; + } + + &__item + { + display: block; + margin: 0; + background: #eee; + + &:first-child + { + margin-left: 0; + } + } + + &__link + { + display: block; + height: 100%; + width: 100%; + } + + &__image + { + width: 100%; + height: 100%; + } +} diff --git a/tests/stylefmt/nested-mixin-2/__snapshots__/jsfmt.spec.js.snap b/tests/stylefmt/nested-mixin-2/__snapshots__/jsfmt.spec.js.snap new file mode 100644 index 000000000..b5033f20e --- /dev/null +++ b/tests/stylefmt/nested-mixin-2/__snapshots__/jsfmt.spec.js.snap @@ -0,0 +1,37 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`nested-mixin-2.css 1`] = ` +@mixin test() { + $values: blue red; +@each $val in $values { + color : $val; + @for $i from 2 through 10 { + background: $i; + } +} +@for $i from 2 through 10 { + color: $i; +} + @while $k > 0 { + color: $k; +} + +} +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +@mixin test() { + $values: blue red; + @each $val in $values { + color: $val; + @for $i from 2 through 10 { + background: $i; + } + } + @for $i from 2 through 10 { + color: $i; + } + @while $k > 0 { + color: $k; + } +} + +`; diff --git a/tests/stylefmt/nested-mixin-2/jsfmt.spec.js b/tests/stylefmt/nested-mixin-2/jsfmt.spec.js new file mode 100644 index 000000000..a7d303b6c --- /dev/null +++ b/tests/stylefmt/nested-mixin-2/jsfmt.spec.js @@ -0,0 +1 @@ +run_spec(__dirname, { parser: "postcss" }); diff --git a/tests/stylefmt/nested-mixin-2/nested-mixin-2.css b/tests/stylefmt/nested-mixin-2/nested-mixin-2.css new file mode 100644 index 000000000..d3dfa2ba9 --- /dev/null +++ b/tests/stylefmt/nested-mixin-2/nested-mixin-2.css @@ -0,0 +1,16 @@ +@mixin test() { + $values: blue red; +@each $val in $values { + color : $val; + @for $i from 2 through 10 { + background: $i; + } +} +@for $i from 2 through 10 { + color: $i; +} + @while $k > 0 { + color: $k; +} + +} diff --git a/tests/stylefmt/nested-mixin/__snapshots__/jsfmt.spec.js.snap b/tests/stylefmt/nested-mixin/__snapshots__/jsfmt.spec.js.snap new file mode 100644 index 000000000..7e3a25fc5 --- /dev/null +++ b/tests/stylefmt/nested-mixin/__snapshots__/jsfmt.spec.js.snap @@ -0,0 +1,30 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`nested-mixin.css 1`] = ` +@mixin test() { + $values: blue red; + @each $val in $values { + color: $val; + @for $i from 2 through 10 { + background: $i; + } + } + @for $i from 2 through 10 { + color: $i; + } +} +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +@mixin test() { + $values: blue red; + @each $val in $values { + color: $val; + @for $i from 2 through 10 { + background: $i; + } + } + @for $i from 2 through 10 { + color: $i; + } +} + +`; diff --git a/tests/stylefmt/nested-mixin/jsfmt.spec.js b/tests/stylefmt/nested-mixin/jsfmt.spec.js new file mode 100644 index 000000000..a7d303b6c --- /dev/null +++ b/tests/stylefmt/nested-mixin/jsfmt.spec.js @@ -0,0 +1 @@ +run_spec(__dirname, { parser: "postcss" }); diff --git a/tests/stylefmt/nested-mixin/nested-mixin.css b/tests/stylefmt/nested-mixin/nested-mixin.css new file mode 100644 index 000000000..400a7a9e0 --- /dev/null +++ b/tests/stylefmt/nested-mixin/nested-mixin.css @@ -0,0 +1,12 @@ +@mixin test() { + $values: blue red; + @each $val in $values { + color: $val; + @for $i from 2 through 10 { + background: $i; + } + } + @for $i from 2 through 10 { + color: $i; + } +} diff --git a/tests/stylefmt/nested/__snapshots__/jsfmt.spec.js.snap b/tests/stylefmt/nested/__snapshots__/jsfmt.spec.js.snap new file mode 100644 index 000000000..e7e20437d --- /dev/null +++ b/tests/stylefmt/nested/__snapshots__/jsfmt.spec.js.snap @@ -0,0 +1,34 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`nested.css 1`] = ` + .foo {font-size :12px ; + + + >.nested-1 + + { +padding: 10px; .nested-2-1{ + color : red ; + } + + .nested-2-2 { + color:blue; }} + + + +} +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.foo { + font-size: 12px; + + > .nested-1 { + padding: 10px; + .nested-2-1 { + color: red; + } + + .nested-2-2 { + color: blue; + } + } +} + +`; diff --git a/tests/stylefmt/nested/jsfmt.spec.js b/tests/stylefmt/nested/jsfmt.spec.js new file mode 100644 index 000000000..a7d303b6c --- /dev/null +++ b/tests/stylefmt/nested/jsfmt.spec.js @@ -0,0 +1 @@ +run_spec(__dirname, { parser: "postcss" }); diff --git a/tests/stylefmt/nested/nested.css b/tests/stylefmt/nested/nested.css new file mode 100644 index 000000000..037795ff2 --- /dev/null +++ b/tests/stylefmt/nested/nested.css @@ -0,0 +1,15 @@ + .foo {font-size :12px ; + + + >.nested-1 + + { +padding: 10px; .nested-2-1{ + color : red ; + } + + .nested-2-2 { + color:blue; }} + + + +} diff --git a/tests/stylefmt/non-nested-combinator/__snapshots__/jsfmt.spec.js.snap b/tests/stylefmt/non-nested-combinator/__snapshots__/jsfmt.spec.js.snap new file mode 100644 index 000000000..ca7328d1a --- /dev/null +++ b/tests/stylefmt/non-nested-combinator/__snapshots__/jsfmt.spec.js.snap @@ -0,0 +1,26 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`non-nested-combinator.css 1`] = ` +.card-meta { + @include padding(null 1rem 1rem);background-color: $card-base-background-color; + color: $meta-font-color; + .card-content--with-image+& + {padding-top: 1rem; + }a { + color: inherit; + } +} +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.card-meta { + @include padding(null 1rem 1rem); + background-color: $card-base-background-color; + color: $meta-font-color; + .card-content--with-image + & { + padding-top: 1rem; + } + a { + color: inherit; + } +} + +`; diff --git a/tests/stylefmt/non-nested-combinator/jsfmt.spec.js b/tests/stylefmt/non-nested-combinator/jsfmt.spec.js new file mode 100644 index 000000000..a7d303b6c --- /dev/null +++ b/tests/stylefmt/non-nested-combinator/jsfmt.spec.js @@ -0,0 +1 @@ +run_spec(__dirname, { parser: "postcss" }); diff --git a/tests/stylefmt/non-nested-combinator/non-nested-combinator.css b/tests/stylefmt/non-nested-combinator/non-nested-combinator.css new file mode 100644 index 000000000..4a359f664 --- /dev/null +++ b/tests/stylefmt/non-nested-combinator/non-nested-combinator.css @@ -0,0 +1,9 @@ +.card-meta { + @include padding(null 1rem 1rem);background-color: $card-base-background-color; + color: $meta-font-color; + .card-content--with-image+& + {padding-top: 1rem; + }a { + color: inherit; + } +} diff --git a/tests/stylefmt/pseudo-element/__snapshots__/jsfmt.spec.js.snap b/tests/stylefmt/pseudo-element/__snapshots__/jsfmt.spec.js.snap new file mode 100644 index 000000000..80dac9fe3 --- /dev/null +++ b/tests/stylefmt/pseudo-element/__snapshots__/jsfmt.spec.js.snap @@ -0,0 +1,15 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`pseudo-element.css 1`] = ` +a:after { content:"" } +a::before { content:"" } + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +a:after { + content: ""; +} +a::before { + content: ""; +} + +`; diff --git a/tests/stylefmt/pseudo-element/jsfmt.spec.js b/tests/stylefmt/pseudo-element/jsfmt.spec.js new file mode 100644 index 000000000..a7d303b6c --- /dev/null +++ b/tests/stylefmt/pseudo-element/jsfmt.spec.js @@ -0,0 +1 @@ +run_spec(__dirname, { parser: "postcss" }); diff --git a/tests/stylefmt/pseudo-element/pseudo-element.css b/tests/stylefmt/pseudo-element/pseudo-element.css new file mode 100644 index 000000000..c07004bc3 --- /dev/null +++ b/tests/stylefmt/pseudo-element/pseudo-element.css @@ -0,0 +1,3 @@ +a:after { content:"" } +a::before { content:"" } + diff --git a/tests/stylefmt/readme/__snapshots__/jsfmt.spec.js.snap b/tests/stylefmt/readme/__snapshots__/jsfmt.spec.js.snap new file mode 100644 index 000000000..53e0877b7 --- /dev/null +++ b/tests/stylefmt/readme/__snapshots__/jsfmt.spec.js.snap @@ -0,0 +1,62 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`readme.css 1`] = ` +// mixin for clearfix + @mixin clearfix () { &:before, + &:after { + content:" "; + display : table; } + + &:after {clear: both;} + }.class +{ + padding:10px;@include clearfix();} + .base { color: red; } // placeholder + +%base +{ + + +padding: 12px +} + +.foo{ +@extend .base;} + +.bar + { @extend %base; + +} +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// mixin for clearfix +@mixin clearfix () { + &:before, &:after { + content: " "; + display: table; + } + + &:after { + clear: both; + } +} +.class { + padding: 10px; + @include clearfix(); +} +.base { + color: red; +} // placeholder + +%base { + padding: 12px; +} + +.foo { + @extend .base; +} + +.bar { + @extend %base; +} + +`; diff --git a/tests/stylefmt/readme/jsfmt.spec.js b/tests/stylefmt/readme/jsfmt.spec.js new file mode 100644 index 000000000..a7d303b6c --- /dev/null +++ b/tests/stylefmt/readme/jsfmt.spec.js @@ -0,0 +1 @@ +run_spec(__dirname, { parser: "postcss" }); diff --git a/tests/stylefmt/readme/readme.css b/tests/stylefmt/readme/readme.css new file mode 100644 index 000000000..6d5c55333 --- /dev/null +++ b/tests/stylefmt/readme/readme.css @@ -0,0 +1,26 @@ +// mixin for clearfix + @mixin clearfix () { &:before, + &:after { + content:" "; + display : table; } + + &:after {clear: both;} + }.class +{ + padding:10px;@include clearfix();} + .base { color: red; } // placeholder + +%base +{ + + +padding: 12px +} + +.foo{ +@extend .base;} + +.bar + { @extend %base; + +} diff --git a/tests/stylefmt/shorthand-with-sass-variables/__snapshots__/jsfmt.spec.js.snap b/tests/stylefmt/shorthand-with-sass-variables/__snapshots__/jsfmt.spec.js.snap new file mode 100644 index 000000000..fcf8fd762 --- /dev/null +++ b/tests/stylefmt/shorthand-with-sass-variables/__snapshots__/jsfmt.spec.js.snap @@ -0,0 +1,11 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`shorthand-with-sass-variables.css 1`] = ` +.class{border:1px solid $color; +} +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.class { + border: 1px solid $color; +} + +`; diff --git a/tests/stylefmt/shorthand-with-sass-variables/jsfmt.spec.js b/tests/stylefmt/shorthand-with-sass-variables/jsfmt.spec.js new file mode 100644 index 000000000..a7d303b6c --- /dev/null +++ b/tests/stylefmt/shorthand-with-sass-variables/jsfmt.spec.js @@ -0,0 +1 @@ +run_spec(__dirname, { parser: "postcss" }); diff --git a/tests/stylefmt/shorthand-with-sass-variables/shorthand-with-sass-variables.css b/tests/stylefmt/shorthand-with-sass-variables/shorthand-with-sass-variables.css new file mode 100644 index 000000000..4cda0ba38 --- /dev/null +++ b/tests/stylefmt/shorthand-with-sass-variables/shorthand-with-sass-variables.css @@ -0,0 +1,2 @@ +.class{border:1px solid $color; +} diff --git a/tests/stylefmt/values/__snapshots__/jsfmt.spec.js.snap b/tests/stylefmt/values/__snapshots__/jsfmt.spec.js.snap new file mode 100644 index 000000000..33d3b435a --- /dev/null +++ b/tests/stylefmt/values/__snapshots__/jsfmt.spec.js.snap @@ -0,0 +1,24 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`values.css 1`] = ` +.class { + background:linear-gradient(to bottom right,white,hsla(0,0%,100%,.8)); + border: 1px solid rgba(0,0,0,.3); + font-family: Arial , sans-serif; + color: rgba(0, 0, 0, 1); + margin: 0 20px 0 -24px; + background-position:20% -26px; + transform-style: preserve-3d; +} +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.class { + background: linear-gradient(to bottom right, white, hsla(0, 0%, 100%, .8)); + border: 1px solid rgba(0, 0, 0, .3); + font-family: Arial, sans-serif; + color: rgba(0, 0, 0, 1); + margin: 0 20px 0 -24px; + background-position: 20% -26px; + transform-style: preserve-3d; +} + +`; diff --git a/tests/stylefmt/values/jsfmt.spec.js b/tests/stylefmt/values/jsfmt.spec.js new file mode 100644 index 000000000..a7d303b6c --- /dev/null +++ b/tests/stylefmt/values/jsfmt.spec.js @@ -0,0 +1 @@ +run_spec(__dirname, { parser: "postcss" }); diff --git a/tests/stylefmt/values/values.css b/tests/stylefmt/values/values.css new file mode 100644 index 000000000..be4b40a7a --- /dev/null +++ b/tests/stylefmt/values/values.css @@ -0,0 +1,9 @@ +.class { + background:linear-gradient(to bottom right,white,hsla(0,0%,100%,.8)); + border: 1px solid rgba(0,0,0,.3); + font-family: Arial , sans-serif; + color: rgba(0, 0, 0, 1); + margin: 0 20px 0 -24px; + background-position:20% -26px; + transform-style: preserve-3d; +} diff --git a/tests/stylefmt/var-notation/__snapshots__/jsfmt.spec.js.snap b/tests/stylefmt/var-notation/__snapshots__/jsfmt.spec.js.snap new file mode 100644 index 000000000..2e05ca29d --- /dev/null +++ b/tests/stylefmt/var-notation/__snapshots__/jsfmt.spec.js.snap @@ -0,0 +1,11 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`var-notation.css 1`] = ` +.foo {margin:var ( --n-gutterSize) 0 var ( --gutterSize ) var( --n-gutterSize ); +} +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.foo { + margin: var (--n-gutterSize) 0 var (--gutterSize) var(--n-gutterSize); +} + +`; diff --git a/tests/stylefmt/var-notation/jsfmt.spec.js b/tests/stylefmt/var-notation/jsfmt.spec.js new file mode 100644 index 000000000..a7d303b6c --- /dev/null +++ b/tests/stylefmt/var-notation/jsfmt.spec.js @@ -0,0 +1 @@ +run_spec(__dirname, { parser: "postcss" }); diff --git a/tests/stylefmt/var-notation/var-notation.css b/tests/stylefmt/var-notation/var-notation.css new file mode 100644 index 000000000..1e4982b8a --- /dev/null +++ b/tests/stylefmt/var-notation/var-notation.css @@ -0,0 +1,2 @@ +.foo {margin:var ( --n-gutterSize) 0 var ( --gutterSize ) var( --n-gutterSize ); +} diff --git a/tests/stylefmt/vendor-prefix/__snapshots__/jsfmt.spec.js.snap b/tests/stylefmt/vendor-prefix/__snapshots__/jsfmt.spec.js.snap new file mode 100644 index 000000000..5087e07c4 --- /dev/null +++ b/tests/stylefmt/vendor-prefix/__snapshots__/jsfmt.spec.js.snap @@ -0,0 +1,15 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`vendor-prefix.css 1`] = ` +.class +{-webkit-box-sizing:border-box;box-sizing:border-box + + +} +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.class { + -webkit-box-sizing: border-box; + box-sizing: border-box; +} + +`; diff --git a/tests/stylefmt/vendor-prefix/jsfmt.spec.js b/tests/stylefmt/vendor-prefix/jsfmt.spec.js new file mode 100644 index 000000000..a7d303b6c --- /dev/null +++ b/tests/stylefmt/vendor-prefix/jsfmt.spec.js @@ -0,0 +1 @@ +run_spec(__dirname, { parser: "postcss" }); diff --git a/tests/stylefmt/vendor-prefix/vendor-prefix.css b/tests/stylefmt/vendor-prefix/vendor-prefix.css new file mode 100644 index 000000000..b4e55a3df --- /dev/null +++ b/tests/stylefmt/vendor-prefix/vendor-prefix.css @@ -0,0 +1,5 @@ +.class +{-webkit-box-sizing:border-box;box-sizing:border-box + + +} diff --git a/tests_config/run_spec.js b/tests_config/run_spec.js index f5835f954..77730173a 100644 --- a/tests_config/run_spec.js +++ b/tests_config/run_spec.js @@ -15,7 +15,7 @@ const ALL_PARSERS = process.env["ALL_PARSERS"] function run_spec(dirname, options, additionalParsers) { fs.readdirSync(dirname).forEach(filename => { const extension = extname(filename); - if (/^\.[jt]sx?$/.test(extension) && filename !== "jsfmt.spec.js") { + if (/^\.([jt]sx?|css)$/.test(extension) && filename !== "jsfmt.spec.js") { const path = dirname + "/" + filename; let rangeStart = 0; let rangeEnd = Infinity; diff --git a/yarn.lock b/yarn.lock index a1ded6383..a6f48753d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -23,8 +23,8 @@ acorn@^3.0.4: resolved "https://registry.yarnpkg.com/acorn/-/acorn-3.3.0.tgz#45e37fb39e8da3f25baee3ff5369e2bb5f22017a" acorn@^4.0.1, acorn@^4.0.4: - version "4.0.11" - resolved "https://registry.yarnpkg.com/acorn/-/acorn-4.0.11.tgz#edcda3bd937e7556410d42ed5860f67399c794c0" + version "4.0.13" + resolved "https://registry.yarnpkg.com/acorn/-/acorn-4.0.13.tgz#105495ae5361d697bd195c825192e1ad7f253787" acorn@^5.0.1: version "5.0.3" @@ -57,7 +57,7 @@ ansi-escapes@^1.1.0, ansi-escapes@^1.4.0: version "1.4.0" resolved "https://registry.yarnpkg.com/ansi-escapes/-/ansi-escapes-1.4.0.tgz#d3a8a83b319aa67793662b13e761c7911422306e" -ansi-regex@^2.0.0: +ansi-regex@^2.0.0, ansi-regex@^2.1.1: version "2.1.1" resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-2.1.1.tgz#c3b33ab5ee360d86e0e628f0468ae7ef27d654df" @@ -151,8 +151,8 @@ async@^1.4.0: resolved "https://registry.yarnpkg.com/async/-/async-1.5.2.tgz#ec6a61ae56480c0c3cb241c95618e20892f9672a" async@^2.1.4: - version "2.4.0" - resolved "https://registry.yarnpkg.com/async/-/async-2.4.0.tgz#4990200f18ea5b837c2cc4f8c031a6985c385611" + version "2.4.1" + resolved "https://registry.yarnpkg.com/async/-/async-2.4.1.tgz#62a56b279c98a11d0987096a01cc3eeb8eb7bbd7" dependencies: lodash "^4.14.0" @@ -220,13 +220,13 @@ babel-helpers@^6.24.1: babel-runtime "^6.22.0" babel-template "^6.24.1" -babel-jest@^20.0.0: - version "20.0.0" - resolved "https://registry.yarnpkg.com/babel-jest/-/babel-jest-20.0.0.tgz#05ae371102ee8e30c9d61ffdf3f61c738a87741f" +babel-jest@^20.0.3: + version "20.0.3" + resolved "https://registry.yarnpkg.com/babel-jest/-/babel-jest-20.0.3.tgz#e4a03b13dc10389e140fc645d09ffc4ced301671" dependencies: babel-core "^6.0.0" babel-plugin-istanbul "^4.0.0" - babel-preset-jest "^20.0.0" + babel-preset-jest "^20.0.3" babel-messages@^6.23.0: version "6.23.0" @@ -242,15 +242,15 @@ babel-plugin-istanbul@^4.0.0: istanbul-lib-instrument "^1.7.1" test-exclude "^4.1.0" -babel-plugin-jest-hoist@^20.0.0: - version "20.0.0" - resolved "https://registry.yarnpkg.com/babel-plugin-jest-hoist/-/babel-plugin-jest-hoist-20.0.0.tgz#d2afe94fa6aea3b8bfa5d61d8028f633c898d86d" +babel-plugin-jest-hoist@^20.0.3: + version "20.0.3" + resolved "https://registry.yarnpkg.com/babel-plugin-jest-hoist/-/babel-plugin-jest-hoist-20.0.3.tgz#afedc853bd3f8dc3548ea671fbe69d03cc2c1767" -babel-preset-jest@^20.0.0: - version "20.0.0" - resolved "https://registry.yarnpkg.com/babel-preset-jest/-/babel-preset-jest-20.0.0.tgz#16b992c9351c2525e87a19fd36ba14e47df51bad" +babel-preset-jest@^20.0.3: + version "20.0.3" + resolved "https://registry.yarnpkg.com/babel-preset-jest/-/babel-preset-jest-20.0.3.tgz#cbacaadecb5d689ca1e1de1360ebfc66862c178a" dependencies: - babel-plugin-jest-hoist "^20.0.0" + babel-plugin-jest-hoist "^20.0.3" babel-register@^6.24.1: version "6.24.1" @@ -313,8 +313,8 @@ babylon@7.0.0-beta.8: resolved "https://registry.yarnpkg.com/babylon/-/babylon-7.0.0-beta.8.tgz#2bdc5ae366041442c27e068cce6f0d7c06ea9949" babylon@^6.11.0, babylon@^6.13.0, babylon@^6.15.0: - version "6.17.0" - resolved "https://registry.yarnpkg.com/babylon/-/babylon-6.17.0.tgz#37da948878488b9c4e3c4038893fa3314b3fc932" + version "6.17.1" + resolved "https://registry.yarnpkg.com/babylon/-/babylon-6.17.1.tgz#17f14fddf361b695981fe679385e4f1c01ebd86f" balanced-match@^0.4.1: version "0.4.2" @@ -336,7 +336,7 @@ boom@2.x.x: dependencies: hoek "2.x.x" -brace-expansion@^1.0.0: +brace-expansion@^1.1.7: version "1.1.7" resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.7.tgz#3effc3c50e000531fb720eaff80f0ae8ef23cf59" dependencies: @@ -481,7 +481,7 @@ ci-info@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/ci-info/-/ci-info-1.0.0.tgz#dc5285f2b4e251821683681c381c3388f46ec534" -cipher-base@^1.0.0, cipher-base@^1.0.1: +cipher-base@^1.0.0, cipher-base@^1.0.1, cipher-base@^1.0.3: version "1.0.3" resolved "https://registry.yarnpkg.com/cipher-base/-/cipher-base-1.0.3.tgz#eeabf194419ce900da3018c207d212f2a6df0a07" dependencies: @@ -576,21 +576,25 @@ create-ecdh@^4.0.0: bn.js "^4.1.0" elliptic "^6.0.0" -create-hash@^1.1.0, create-hash@^1.1.1: - version "1.1.2" - resolved "https://registry.yarnpkg.com/create-hash/-/create-hash-1.1.2.tgz#51210062d7bb7479f6c65bb41a92208b1d61abad" +create-hash@^1.1.0, create-hash@^1.1.1, create-hash@^1.1.2: + version "1.1.3" + resolved "https://registry.yarnpkg.com/create-hash/-/create-hash-1.1.3.tgz#606042ac8b9262750f483caddab0f5819172d8fd" dependencies: cipher-base "^1.0.1" inherits "^2.0.1" - ripemd160 "^1.0.0" - sha.js "^2.3.6" + ripemd160 "^2.0.0" + sha.js "^2.4.0" -create-hmac@^1.1.0, create-hmac@^1.1.2: - version "1.1.4" - resolved "https://registry.yarnpkg.com/create-hmac/-/create-hmac-1.1.4.tgz#d3fb4ba253eb8b3f56e39ea2fbcb8af747bd3170" +create-hmac@^1.1.0, create-hmac@^1.1.2, create-hmac@^1.1.4: + version "1.1.6" + resolved "https://registry.yarnpkg.com/create-hmac/-/create-hmac-1.1.6.tgz#acb9e221a4e17bdb076e90657c42b93e3726cf06" dependencies: + cipher-base "^1.0.3" create-hash "^1.1.0" inherits "^2.0.1" + ripemd160 "^2.0.0" + safe-buffer "^5.0.1" + sha.js "^2.4.8" cross-spawn@^5.1.0: version "5.1.0" @@ -644,10 +648,10 @@ dashdash@^1.12.0: assert-plus "^1.0.0" debug@^2.1.1, debug@^2.2.0, debug@^2.6.3: - version "2.6.6" - resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.6.tgz#a9fa6fbe9ca43cf1e79f73b75c0189cbb7d6db5a" + version "2.6.8" + resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.8.tgz#e731531ca2ede27d188222427da17821d68ff4fc" dependencies: - ms "0.7.3" + ms "2.0.0" decamelize@^1.0.0, decamelize@^1.1.1: version "1.2.0" @@ -742,8 +746,8 @@ error-ex@^1.2.0: is-arrayish "^0.2.1" es5-ext@^0.10.14, es5-ext@^0.10.9, es5-ext@~0.10.14: - version "0.10.20" - resolved "https://registry.yarnpkg.com/es5-ext/-/es5-ext-0.10.20.tgz#72a9b4fd5832797ba1bb65dceb2e25c04241c492" + version "0.10.21" + resolved "https://registry.yarnpkg.com/es5-ext/-/es5-ext-0.10.21.tgz#19a725f9e51d0300bbc1e8e821109fd9daf55925" dependencies: es6-iterator "2" es6-symbol "~3.1" @@ -1042,6 +1046,10 @@ flat-cache@^1.2.1: graceful-fs "^4.1.2" write "^0.2.1" +flatten@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/flatten/-/flatten-1.0.2.tgz#dae46a9d78fbe25292258cc1e780a41d95c03782" + flow-parser@0.45.0: version "0.45.0" resolved "https://registry.yarnpkg.com/flow-parser/-/flow-parser-0.45.0.tgz#aa29d4ae27f06aa02817772bba0fcbefef7e62f0" @@ -1144,8 +1152,8 @@ growly@^1.3.0: resolved "https://registry.yarnpkg.com/growly/-/growly-1.3.0.tgz#f10748cbe76af964b7c96c93c6bcc28af120c081" handlebars@^4.0.3: - version "4.0.8" - resolved "https://registry.yarnpkg.com/handlebars/-/handlebars-4.0.8.tgz#22b875cd3f0e6cbea30314f144e82bc7a72ff420" + version "4.0.10" + resolved "https://registry.yarnpkg.com/handlebars/-/handlebars-4.0.10.tgz#3d30c718b09a3d96f23ea4cc1f403c4d3ba9ff4f" dependencies: async "^1.4.0" optimist "^0.6.1" @@ -1174,6 +1182,12 @@ has-flag@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-1.0.0.tgz#9d9e793165ce017a00f00418c43f942a7b1d11fa" +hash-base@^2.0.0: + version "2.0.2" + resolved "https://registry.yarnpkg.com/hash-base/-/hash-base-2.0.2.tgz#66ea1d856db4e8a5470cadf6fce23ae5244ef2e1" + dependencies: + inherits "^2.0.1" + hash.js@^1.0.0, hash.js@^1.0.3: version "1.0.3" resolved "https://registry.yarnpkg.com/hash.js/-/hash.js-1.0.3.tgz#1332ff00156c0a0ffdd8236013d07b77a0451573" @@ -1238,6 +1252,10 @@ imurmurhash@^0.1.4: version "0.1.4" resolved "https://registry.yarnpkg.com/imurmurhash/-/imurmurhash-0.1.4.tgz#9218b9b2b928a238b13dc4fb6b6d576f231453ea" +indexes-of@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/indexes-of/-/indexes-of-1.0.1.tgz#f30f716c8e2bd346c7b67d3df3915566a7c05607" + inflight@^1.0.4: version "1.0.6" resolved "https://registry.yarnpkg.com/inflight/-/inflight-1.0.6.tgz#49bd6331d7d02d0c09bc910a1075ba8165b56df9" @@ -1479,13 +1497,13 @@ istanbul-reports@^1.1.0: dependencies: handlebars "^4.0.3" -jest-changed-files@^20.0.0: - version "20.0.0" - resolved "https://registry.yarnpkg.com/jest-changed-files/-/jest-changed-files-20.0.0.tgz#2ad82870a815b40ce3f4bf4555581d387b21022c" +jest-changed-files@^20.0.3: + version "20.0.3" + resolved "https://registry.yarnpkg.com/jest-changed-files/-/jest-changed-files-20.0.3.tgz#9394d5cc65c438406149bef1bf4d52b68e03e3f8" jest-cli@^20.0.0: - version "20.0.0" - resolved "https://registry.yarnpkg.com/jest-cli/-/jest-cli-20.0.0.tgz#72664e0723bd099a0bade5bd4bf960fd54876069" + version "20.0.4" + resolved "https://registry.yarnpkg.com/jest-cli/-/jest-cli-20.0.4.tgz#e532b19d88ae5bc6c417e8b0593a6fe954b1dc93" dependencies: ansi-escapes "^1.4.0" callsites "^2.0.0" @@ -1496,18 +1514,18 @@ jest-cli@^20.0.0: istanbul-lib-coverage "^1.0.1" istanbul-lib-instrument "^1.4.2" istanbul-lib-source-maps "^1.1.0" - jest-changed-files "^20.0.0" - jest-config "^20.0.0" - jest-docblock "^20.0.0" - jest-environment-jsdom "^20.0.0" - jest-haste-map "^20.0.0" - jest-jasmine2 "^20.0.0" - jest-message-util "^20.0.0" - jest-regex-util "^20.0.0" - jest-resolve-dependencies "^20.0.0" - jest-runtime "^20.0.0" - jest-snapshot "^20.0.0" - jest-util "^20.0.0" + jest-changed-files "^20.0.3" + jest-config "^20.0.4" + jest-docblock "^20.0.3" + jest-environment-jsdom "^20.0.3" + jest-haste-map "^20.0.4" + jest-jasmine2 "^20.0.4" + jest-message-util "^20.0.3" + jest-regex-util "^20.0.3" + jest-resolve-dependencies "^20.0.3" + jest-runtime "^20.0.4" + jest-snapshot "^20.0.3" + jest-util "^20.0.3" micromatch "^2.3.11" node-notifier "^5.0.2" pify "^2.3.0" @@ -1518,70 +1536,71 @@ jest-cli@^20.0.0: worker-farm "^1.3.1" yargs "^7.0.2" -jest-config@^20.0.0: - version "20.0.0" - resolved "https://registry.yarnpkg.com/jest-config/-/jest-config-20.0.0.tgz#295fe937a377f79a8eea240ad29546bf43acbbec" +jest-config@^20.0.4: + version "20.0.4" + resolved "https://registry.yarnpkg.com/jest-config/-/jest-config-20.0.4.tgz#e37930ab2217c913605eff13e7bd763ec48faeea" dependencies: chalk "^1.1.3" glob "^7.1.1" - jest-environment-jsdom "^20.0.0" - jest-environment-node "^20.0.0" - jest-jasmine2 "^20.0.0" - jest-regex-util "^20.0.0" - jest-resolve "^20.0.0" - jest-validate "^20.0.0" - pretty-format "^20.0.0" + jest-environment-jsdom "^20.0.3" + jest-environment-node "^20.0.3" + jest-jasmine2 "^20.0.4" + jest-matcher-utils "^20.0.3" + jest-regex-util "^20.0.3" + jest-resolve "^20.0.4" + jest-validate "^20.0.3" + pretty-format "^20.0.3" -jest-diff@^20.0.0: - version "20.0.0" - resolved "https://registry.yarnpkg.com/jest-diff/-/jest-diff-20.0.0.tgz#d6e9190b57e0333c6706ef28d62b1cb23042d7eb" +jest-diff@^20.0.3: + version "20.0.3" + resolved "https://registry.yarnpkg.com/jest-diff/-/jest-diff-20.0.3.tgz#81f288fd9e675f0fb23c75f1c2b19445fe586617" dependencies: chalk "^1.1.3" diff "^3.2.0" - jest-matcher-utils "^20.0.0" - pretty-format "^20.0.0" + jest-matcher-utils "^20.0.3" + pretty-format "^20.0.3" -jest-docblock@^20.0.0, jest-docblock@^20.0.1: +jest-docblock@^20.0.1, jest-docblock@^20.0.3: version "20.0.3" resolved "https://registry.yarnpkg.com/jest-docblock/-/jest-docblock-20.0.3.tgz#17bea984342cc33d83c50fbe1545ea0efaa44712" -jest-environment-jsdom@^20.0.0: - version "20.0.0" - resolved "https://registry.yarnpkg.com/jest-environment-jsdom/-/jest-environment-jsdom-20.0.0.tgz#a688499d817e33cdea6400c502d8d5f4aa01c808" +jest-environment-jsdom@^20.0.3: + version "20.0.3" + resolved "https://registry.yarnpkg.com/jest-environment-jsdom/-/jest-environment-jsdom-20.0.3.tgz#048a8ac12ee225f7190417713834bb999787de99" dependencies: - jest-mock "^20.0.0" - jest-util "^20.0.0" + jest-mock "^20.0.3" + jest-util "^20.0.3" jsdom "^9.12.0" -jest-environment-node@^20.0.0: - version "20.0.0" - resolved "https://registry.yarnpkg.com/jest-environment-node/-/jest-environment-node-20.0.0.tgz#7016d8d1270cbc1ed71a10f242c78324297e1db8" +jest-environment-node@^20.0.3: + version "20.0.3" + resolved "https://registry.yarnpkg.com/jest-environment-node/-/jest-environment-node-20.0.3.tgz#d488bc4612af2c246e986e8ae7671a099163d403" dependencies: - jest-mock "^20.0.0" - jest-util "^20.0.0" + jest-mock "^20.0.3" + jest-util "^20.0.3" -jest-haste-map@^20.0.0: - version "20.0.0" - resolved "https://registry.yarnpkg.com/jest-haste-map/-/jest-haste-map-20.0.0.tgz#3b8d9255dfe2a6a96e516fe71dafd415e1b5d65f" +jest-haste-map@^20.0.4: + version "20.0.4" + resolved "https://registry.yarnpkg.com/jest-haste-map/-/jest-haste-map-20.0.4.tgz#653eb55c889ce3c021f7b94693f20a4159badf03" dependencies: fb-watchman "^2.0.0" graceful-fs "^4.1.11" - jest-docblock "^20.0.0" + jest-docblock "^20.0.3" micromatch "^2.3.11" sane "~1.6.0" worker-farm "^1.3.1" -jest-jasmine2@^20.0.0: - version "20.0.0" - resolved "https://registry.yarnpkg.com/jest-jasmine2/-/jest-jasmine2-20.0.0.tgz#2a0aba92ed36ec132901cfc2a552fd7cee6fde3d" +jest-jasmine2@^20.0.4: + version "20.0.4" + resolved "https://registry.yarnpkg.com/jest-jasmine2/-/jest-jasmine2-20.0.4.tgz#fcc5b1411780d911d042902ef1859e852e60d5e1" dependencies: chalk "^1.1.3" graceful-fs "^4.1.11" - jest-diff "^20.0.0" - jest-matcher-utils "^20.0.0" - jest-matchers "^20.0.0" - jest-message-util "^20.0.0" - jest-snapshot "^20.0.0" + jest-diff "^20.0.3" + jest-matcher-utils "^20.0.3" + jest-matchers "^20.0.3" + jest-message-util "^20.0.3" + jest-snapshot "^20.0.3" once "^1.4.0" p-map "^1.1.1" @@ -1592,92 +1611,92 @@ jest-matcher-utils@^19.0.0: chalk "^1.1.3" pretty-format "^19.0.0" -jest-matcher-utils@^20.0.0: - version "20.0.0" - resolved "https://registry.yarnpkg.com/jest-matcher-utils/-/jest-matcher-utils-20.0.0.tgz#2c5d9dd11670c5418ffc78baecf9094db9e91e09" +jest-matcher-utils@^20.0.0, jest-matcher-utils@^20.0.3: + version "20.0.3" + resolved "https://registry.yarnpkg.com/jest-matcher-utils/-/jest-matcher-utils-20.0.3.tgz#b3a6b8e37ca577803b0832a98b164f44b7815612" dependencies: chalk "^1.1.3" - pretty-format "^20.0.0" + pretty-format "^20.0.3" -jest-matchers@^20.0.0: - version "20.0.0" - resolved "https://registry.yarnpkg.com/jest-matchers/-/jest-matchers-20.0.0.tgz#55498637bbb58f164d97c73610fb8d016dfac770" +jest-matchers@^20.0.3: + version "20.0.3" + resolved "https://registry.yarnpkg.com/jest-matchers/-/jest-matchers-20.0.3.tgz#ca69db1c32db5a6f707fa5e0401abb55700dfd60" dependencies: - jest-diff "^20.0.0" - jest-matcher-utils "^20.0.0" - jest-message-util "^20.0.0" - jest-regex-util "^20.0.0" + jest-diff "^20.0.3" + jest-matcher-utils "^20.0.3" + jest-message-util "^20.0.3" + jest-regex-util "^20.0.3" -jest-message-util@^20.0.0: - version "20.0.0" - resolved "https://registry.yarnpkg.com/jest-message-util/-/jest-message-util-20.0.0.tgz#060bac1980bd5e11134e8e1c19c94863d937c727" +jest-message-util@^20.0.3: + version "20.0.3" + resolved "https://registry.yarnpkg.com/jest-message-util/-/jest-message-util-20.0.3.tgz#6aec2844306fcb0e6e74d5796c1006d96fdd831c" dependencies: chalk "^1.1.3" micromatch "^2.3.11" slash "^1.0.0" -jest-mock@^20.0.0: - version "20.0.0" - resolved "https://registry.yarnpkg.com/jest-mock/-/jest-mock-20.0.0.tgz#3c54b94fe502ed57f2e602fab22ab196a7aa4b95" +jest-mock@^20.0.3: + version "20.0.3" + resolved "https://registry.yarnpkg.com/jest-mock/-/jest-mock-20.0.3.tgz#8bc070e90414aa155c11a8d64c869a0d5c71da59" -jest-regex-util@^20.0.0: - version "20.0.0" - resolved "https://registry.yarnpkg.com/jest-regex-util/-/jest-regex-util-20.0.0.tgz#7f6051e9d00fdcccca52bade50aabdd9919bcfd2" +jest-regex-util@^20.0.3: + version "20.0.3" + resolved "https://registry.yarnpkg.com/jest-regex-util/-/jest-regex-util-20.0.3.tgz#85bbab5d133e44625b19faf8c6aa5122d085d762" -jest-resolve-dependencies@^20.0.0: - version "20.0.0" - resolved "https://registry.yarnpkg.com/jest-resolve-dependencies/-/jest-resolve-dependencies-20.0.0.tgz#616c6976c52e49d13e6420b1bcc8f380e701408f" +jest-resolve-dependencies@^20.0.3: + version "20.0.3" + resolved "https://registry.yarnpkg.com/jest-resolve-dependencies/-/jest-resolve-dependencies-20.0.3.tgz#6e14a7b717af0f2cb3667c549de40af017b1723a" dependencies: - jest-regex-util "^20.0.0" + jest-regex-util "^20.0.3" -jest-resolve@^20.0.0: - version "20.0.0" - resolved "https://registry.yarnpkg.com/jest-resolve/-/jest-resolve-20.0.0.tgz#f9bfdfa31109aee2decfc3a07c2c354608cc5e1d" +jest-resolve@^20.0.4: + version "20.0.4" + resolved "https://registry.yarnpkg.com/jest-resolve/-/jest-resolve-20.0.4.tgz#9448b3e8b6bafc15479444c6499045b7ffe597a5" dependencies: browser-resolve "^1.11.2" is-builtin-module "^1.0.0" resolve "^1.3.2" -jest-runtime@^20.0.0: - version "20.0.0" - resolved "https://registry.yarnpkg.com/jest-runtime/-/jest-runtime-20.0.0.tgz#4c78c08573ffaeba9b8ceb096f705b75d5fb54a1" +jest-runtime@^20.0.4: + version "20.0.4" + resolved "https://registry.yarnpkg.com/jest-runtime/-/jest-runtime-20.0.4.tgz#a2c802219c4203f754df1404e490186169d124d8" dependencies: babel-core "^6.0.0" - babel-jest "^20.0.0" + babel-jest "^20.0.3" babel-plugin-istanbul "^4.0.0" chalk "^1.1.3" convert-source-map "^1.4.0" graceful-fs "^4.1.11" - jest-config "^20.0.0" - jest-haste-map "^20.0.0" - jest-regex-util "^20.0.0" - jest-resolve "^20.0.0" - jest-util "^20.0.0" + jest-config "^20.0.4" + jest-haste-map "^20.0.4" + jest-regex-util "^20.0.3" + jest-resolve "^20.0.4" + jest-util "^20.0.3" json-stable-stringify "^1.0.1" micromatch "^2.3.11" strip-bom "3.0.0" yargs "^7.0.2" -jest-snapshot@^20.0.0: - version "20.0.0" - resolved "https://registry.yarnpkg.com/jest-snapshot/-/jest-snapshot-20.0.0.tgz#fbe51d94ed1c6cd23808bb7ef82e58ca12a0ccf7" +jest-snapshot@^20.0.3: + version "20.0.3" + resolved "https://registry.yarnpkg.com/jest-snapshot/-/jest-snapshot-20.0.3.tgz#5b847e1adb1a4d90852a7f9f125086e187c76566" dependencies: chalk "^1.1.3" - jest-diff "^20.0.0" - jest-matcher-utils "^20.0.0" - jest-util "^20.0.0" + jest-diff "^20.0.3" + jest-matcher-utils "^20.0.3" + jest-util "^20.0.3" natural-compare "^1.4.0" - pretty-format "^20.0.0" + pretty-format "^20.0.3" -jest-util@^20.0.0: - version "20.0.0" - resolved "https://registry.yarnpkg.com/jest-util/-/jest-util-20.0.0.tgz#5421322f196e884e962bc8b8bac4b009733caed9" +jest-util@^20.0.3: + version "20.0.3" + resolved "https://registry.yarnpkg.com/jest-util/-/jest-util-20.0.3.tgz#0c07f7d80d82f4e5a67c6f8b9c3fe7f65cfd32ad" dependencies: chalk "^1.1.3" graceful-fs "^4.1.11" - jest-message-util "^20.0.0" - jest-mock "^20.0.0" - jest-validate "^20.0.0" + jest-message-util "^20.0.3" + jest-mock "^20.0.3" + jest-validate "^20.0.3" leven "^2.1.0" mkdirp "^0.5.1" @@ -1690,7 +1709,7 @@ jest-validate@19.0.0: leven "^2.0.0" pretty-format "^19.0.0" -jest-validate@20.0.0, jest-validate@^20.0.0: +jest-validate@20.0.0: version "20.0.0" resolved "https://registry.yarnpkg.com/jest-validate/-/jest-validate-20.0.0.tgz#c0832e8210190b6d5b39a46b8df536083131a7d7" dependencies: @@ -1699,6 +1718,15 @@ jest-validate@20.0.0, jest-validate@^20.0.0: leven "^2.1.0" pretty-format "^20.0.0" +jest-validate@^20.0.3: + version "20.0.3" + resolved "https://registry.yarnpkg.com/jest-validate/-/jest-validate-20.0.3.tgz#d0cfd1de4f579f298484925c280f8f1d94ec3cab" + dependencies: + chalk "^1.1.3" + jest-matcher-utils "^20.0.3" + leven "^2.1.0" + pretty-format "^20.0.3" + jest@20.0.0: version "20.0.0" resolved "https://registry.yarnpkg.com/jest/-/jest-20.0.0.tgz#58cf6abf328f2a2e3c4203890131cbe89d3b0769" @@ -1711,13 +1739,17 @@ jodid25519@^1.0.0: dependencies: jsbn "~0.1.0" +js-base64@^2.1.9: + version "2.1.9" + resolved "https://registry.yarnpkg.com/js-base64/-/js-base64-2.1.9.tgz#f0e80ae039a4bd654b5f281fc93f04a914a7fcce" + js-tokens@^3.0.0: version "3.0.1" resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-3.0.1.tgz#08e9f132484a2c45a30907e9dc4d5567b7f114d7" js-yaml@^3.5.1, js-yaml@^3.7.0: - version "3.8.3" - resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.8.3.tgz#33a05ec481c850c8875929166fe1beb61c728766" + version "3.8.4" + resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.8.4.tgz#520b4564f86573ba96662af85a8cafa7b4b5a6f6" dependencies: argparse "^1.0.7" esprima "^3.1.1" @@ -1790,8 +1822,8 @@ jsprim@^1.2.2: verror "1.3.6" kind-of@^3.0.2: - version "3.2.0" - resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-3.2.0.tgz#b58abe4d5c044ad33726a8c1525b48cf891bff07" + version "3.2.2" + resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-3.2.2.tgz#31ea21a734bab9bbb0f32466d893aea51e4a3c64" dependencies: is-buffer "^1.1.5" @@ -1865,8 +1897,8 @@ magic-string@^0.16.0: vlq "^0.2.1" magic-string@^0.19.0: - version "0.19.0" - resolved "https://registry.yarnpkg.com/magic-string/-/magic-string-0.19.0.tgz#198948217254e3e0b93080e01146b7c73b2a06b2" + version "0.19.1" + resolved "https://registry.yarnpkg.com/magic-string/-/magic-string-0.19.1.tgz#14d768013caf2ec8fdea16a49af82fc377e75201" dependencies: vlq "^0.2.1" @@ -1924,10 +1956,10 @@ minimalistic-crypto-utils@^1.0.0, minimalistic-crypto-utils@^1.0.1: resolved "https://registry.yarnpkg.com/minimalistic-crypto-utils/-/minimalistic-crypto-utils-1.0.1.tgz#f6c00c1c0b082246e5c4d99dfb8c7c083b2b582a" minimatch@^3.0.2, minimatch@^3.0.3: - version "3.0.3" - resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.3.tgz#2a4e4090b96b2db06a9d7df01055a62a77c9b774" + version "3.0.4" + resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.4.tgz#5166e286457f03306064be5497e8dbb0c3d32083" dependencies: - brace-expansion "^1.0.0" + brace-expansion "^1.1.7" minimist@0.0.8, minimist@~0.0.1: version "0.0.8" @@ -1943,9 +1975,9 @@ mkdirp@^0.5.0, mkdirp@^0.5.1: dependencies: minimist "0.0.8" -ms@0.7.3: - version "0.7.3" - resolved "https://registry.yarnpkg.com/ms/-/ms-0.7.3.tgz#708155a5e44e33f5fd0fc53e81d0d40a91be1fff" +ms@2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/ms/-/ms-2.0.0.tgz#5608aeadfc00be6c2901df5f9861788de0d597c8" mute-stream@0.0.5: version "0.0.5" @@ -1988,8 +2020,8 @@ number-is-nan@^1.0.0: resolved "https://registry.yarnpkg.com/number-is-nan/-/number-is-nan-1.0.1.tgz#097b602b53422a522c1afb8790318336941a011d" "nwmatcher@>= 1.3.9 < 2.0.0": - version "1.3.9" - resolved "https://registry.yarnpkg.com/nwmatcher/-/nwmatcher-1.3.9.tgz#8bab486ff7fa3dfd086656bbe8b17116d3692d2a" + version "1.4.0" + resolved "https://registry.yarnpkg.com/nwmatcher/-/nwmatcher-1.4.0.tgz#b4389362170e7ef9798c3c7716d80ebc0106fccf" oauth-sign@~0.8.1: version "0.8.2" @@ -2122,10 +2154,14 @@ path-type@^1.0.0: pinkie-promise "^2.0.0" pbkdf2@^3.0.3: - version "3.0.9" - resolved "https://registry.yarnpkg.com/pbkdf2/-/pbkdf2-3.0.9.tgz#f2c4b25a600058b3c3773c086c37dbbee1ffe693" + version "3.0.12" + resolved "https://registry.yarnpkg.com/pbkdf2/-/pbkdf2-3.0.12.tgz#be36785c5067ea48d806ff923288c5f750b6b8a2" dependencies: - create-hmac "^1.1.2" + create-hash "^1.1.2" + create-hmac "^1.1.4" + ripemd160 "^2.0.1" + safe-buffer "^5.0.1" + sha.js "^2.4.8" performance-now@^0.2.0: version "0.2.0" @@ -2149,6 +2185,49 @@ pluralize@^1.2.1: version "1.2.1" resolved "https://registry.yarnpkg.com/pluralize/-/pluralize-1.2.1.tgz#d1a21483fd22bb41e58a12fa3421823140897c45" +postcss-less@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/postcss-less/-/postcss-less-1.0.0.tgz#2a11bae898a969d598340d249679e90865c455fb" + dependencies: + postcss "^5.2.16" + +postcss-media-query-parser@^0.2.3: + version "0.2.3" + resolved "https://registry.yarnpkg.com/postcss-media-query-parser/-/postcss-media-query-parser-0.2.3.tgz#27b39c6f4d94f81b1a73b8f76351c609e5cef244" + +postcss-selector-parser@^2.2.3: + version "2.2.3" + resolved "https://registry.yarnpkg.com/postcss-selector-parser/-/postcss-selector-parser-2.2.3.tgz#f9437788606c3c9acee16ffe8d8b16297f27bb90" + dependencies: + flatten "^1.0.2" + indexes-of "^1.0.1" + uniq "^1.0.1" + +postcss-values-parser@^1.2.1: + version "1.2.2" + resolved "https://registry.yarnpkg.com/postcss-values-parser/-/postcss-values-parser-1.2.2.tgz#f5eebdd7f6fe310e2e448b9cc03bfed8726ca271" + dependencies: + flatten "^1.0.2" + indexes-of "^1.0.1" + uniq "^1.0.1" + +postcss@^5.2.16: + version "5.2.17" + resolved "https://registry.yarnpkg.com/postcss/-/postcss-5.2.17.tgz#cf4f597b864d65c8a492b2eabe9d706c879c388b" + dependencies: + chalk "^1.1.3" + js-base64 "^2.1.9" + source-map "^0.5.6" + supports-color "^3.2.3" + +postcss@^6.0.1: + version "6.0.1" + resolved "https://registry.yarnpkg.com/postcss/-/postcss-6.0.1.tgz#000dbd1f8eef217aa368b9a212c5fc40b2a8f3f2" + dependencies: + chalk "^1.1.3" + source-map "^0.5.6" + supports-color "^3.2.3" + prelude-ls@~1.1.2: version "1.1.2" resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.1.2.tgz#21932a549f5e52ffd9a827f570e04be62a97da54" @@ -2178,10 +2257,11 @@ pretty-format@^19.0.0: dependencies: ansi-styles "^3.0.0" -pretty-format@^20.0.0: - version "20.0.0" - resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-20.0.0.tgz#bd100f330e707e4f49fef3f234d6e915242a6e7e" +pretty-format@^20.0.0, pretty-format@^20.0.3: + version "20.0.3" + resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-20.0.3.tgz#020e350a560a1fe1a98dc3beb6ccffb386de8b14" dependencies: + ansi-regex "^2.1.1" ansi-styles "^3.0.0" private@^0.1.6: @@ -2382,9 +2462,12 @@ rimraf@^2.2.8, rimraf@^2.6.1: dependencies: glob "^7.0.5" -ripemd160@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/ripemd160/-/ripemd160-1.0.1.tgz#93a4bbd4942bc574b69a8fa57c71de10ecca7d6e" +ripemd160@^2.0.0, ripemd160@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/ripemd160/-/ripemd160-2.0.1.tgz#0f4584295c53a3628af7e6d79aca21ce57d1c6e7" + dependencies: + hash-base "^2.0.0" + inherits "^2.0.1" rollup-plugin-commonjs@7.0.0: version "7.0.0" @@ -2480,7 +2563,7 @@ set-blocking@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/set-blocking/-/set-blocking-2.0.0.tgz#045f9782d011ae9a6803ddd382b24392b3d890f7" -sha.js@^2.3.6: +sha.js@^2.4.0, sha.js@^2.4.8: version "2.4.8" resolved "https://registry.yarnpkg.com/sha.js/-/sha.js-2.4.8.tgz#37068c2c476b6baf402d14a49c67f597921f634f" dependencies: @@ -2632,7 +2715,7 @@ supports-color@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-2.0.0.tgz#535d045ce6b6363fa40117084629995e9df324c7" -supports-color@^3.1.2: +supports-color@^3.1.2, supports-color@^3.2.3: version "3.2.3" resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-3.2.3.tgz#65ac0504b3954171d8a64946b2ae3cbb8a5f54f6" dependencies: @@ -2733,8 +2816,8 @@ typescript@2.3.2: resolved "https://registry.yarnpkg.com/typescript/-/typescript-2.3.2.tgz#f0f045e196f69a72f06b25fd3bd39d01c3ce9984" uglify-js@^2.6: - version "2.8.22" - resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-2.8.22.tgz#d54934778a8da14903fa29a326fb24c0ab51a1a0" + version "2.8.27" + resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-2.8.27.tgz#47787f912b0f242e5b984343be8e35e95f694c9c" dependencies: source-map "~0.5.1" yargs "~3.10.0" @@ -2745,6 +2828,10 @@ uglify-to-browserify@~1.0.0: version "1.0.2" resolved "https://registry.yarnpkg.com/uglify-to-browserify/-/uglify-to-browserify-1.0.2.tgz#6e0924d6bda6b5afe349e39a6d632850a0f882b7" +uniq@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/uniq/-/uniq-1.0.1.tgz#b31c5ae8254844a3a8281541ce2b04b865a734ff" + user-home@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/user-home/-/user-home-2.0.0.tgz#9c70bfd8169bc1dcbf48604e0f04b8b49cde9e9f" @@ -2801,8 +2888,8 @@ whatwg-encoding@^1.0.1: iconv-lite "0.4.13" whatwg-url@^4.3.0: - version "4.7.1" - resolved "https://registry.yarnpkg.com/whatwg-url/-/whatwg-url-4.7.1.tgz#df4dc2e3f25a63b1fa5b32ed6d6c139577d690de" + version "4.8.0" + resolved "https://registry.yarnpkg.com/whatwg-url/-/whatwg-url-4.8.0.tgz#d2981aa9148c1e00a41c5a6131166ab4683bbcc0" dependencies: tr46 "~0.0.3" webidl-conversions "^3.0.0" @@ -2821,14 +2908,10 @@ window-size@0.1.0: version "0.1.0" resolved "https://registry.yarnpkg.com/window-size/-/window-size-0.1.0.tgz#5438cd2ea93b202efa3a19fe8887aee7c94f9c9d" -wordwrap@0.0.2: +wordwrap@0.0.2, wordwrap@~0.0.2: version "0.0.2" resolved "https://registry.yarnpkg.com/wordwrap/-/wordwrap-0.0.2.tgz#b79669bb42ecb409f83d583cad52ca17eaa1643f" -wordwrap@~0.0.2: - version "0.0.3" - resolved "https://registry.yarnpkg.com/wordwrap/-/wordwrap-0.0.3.tgz#a3d5da6cd5c0bc0008d37234bbaf1bed63059107" - wordwrap@~1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/wordwrap/-/wordwrap-1.0.0.tgz#27584810891456a4171c8d0226441ade90cbcaeb"