diff --git a/src/printer.js b/src/printer.js index e3f65303..173c5032 100644 --- a/src/printer.js +++ b/src/printer.js @@ -2612,7 +2612,7 @@ function genericPrintNoParens(path, options, print, args) { ]); } case "selector-combinator": { - if (n.value === "+" || n.value === ">") { + if (n.value === "+" || n.value === ">" || n.value === "~") { return concat([" ", n.value, " "]); } return n.value; diff --git a/tests/css_combinator/__snapshots__/jsfmt.spec.js.snap b/tests/css_combinator/__snapshots__/jsfmt.spec.js.snap new file mode 100644 index 00000000..4f4c6a4f --- /dev/null +++ b/tests/css_combinator/__snapshots__/jsfmt.spec.js.snap @@ -0,0 +1,10 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`combinator.css 1`] = ` +-Option/root .public/section ~ .public/section:before { +} +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +-Option/root .public/section ~ .public/section:before { +} + +`; diff --git a/tests/css_combinator/combinator.css b/tests/css_combinator/combinator.css new file mode 100644 index 00000000..db19558f --- /dev/null +++ b/tests/css_combinator/combinator.css @@ -0,0 +1,2 @@ +-Option/root .public/section ~ .public/section:before { +} diff --git a/tests/css_combinator/jsfmt.spec.js b/tests/css_combinator/jsfmt.spec.js new file mode 100644 index 00000000..a7d303b6 --- /dev/null +++ b/tests/css_combinator/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 index c74d6b16..ca7e51e1 100644 --- a/tests/stylefmt/custom-properties/__snapshots__/jsfmt.spec.js.snap +++ b/tests/stylefmt/custom-properties/__snapshots__/jsfmt.spec.js.snap @@ -2,7 +2,7 @@ exports[`custom-properties.css 1`] = ` :root{--mainColor:#123456} -a{color:var ( --mainColor ) ; } +a{color:var( --mainColor ) ; } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ :root { --mainColor: #123456; diff --git a/tests/stylefmt/var-notation/__snapshots__/jsfmt.spec.js.snap b/tests/stylefmt/var-notation/__snapshots__/jsfmt.spec.js.snap index efc3c0a0..c8d36718 100644 --- a/tests/stylefmt/var-notation/__snapshots__/jsfmt.spec.js.snap +++ b/tests/stylefmt/var-notation/__snapshots__/jsfmt.spec.js.snap @@ -1,7 +1,7 @@ // 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 ); } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .foo {