Skip to content

Commit

Permalink
Normalize selector function input/output format specs (#1521)
Browse files Browse the repository at this point in the history
Also add a missing named parameter spec for selector-extend()
  • Loading branch information
nex3 authored Mar 2, 2020
1 parent 0683abe commit 812c0d8
Show file tree
Hide file tree
Showing 4 changed files with 136 additions and 87 deletions.
42 changes: 34 additions & 8 deletions spec/core_functions/selector/append.hrx
Original file line number Diff line number Diff line change
Expand Up @@ -78,19 +78,45 @@ a {

<===>
================================================================================
<===> input/input.scss
// The full set of possible input formats is tested with `selector-parse()`;
// this spec just verifies one example for `selector-append()`.
a {b: selector-append((c, d e), (f, g h))}
<===> format/README.md
These specs verify that all the arguments to `selector-append()` can take the
parsed selector format, and that the function returns a selector in that format.
The full set of possible input formats is tested with `selector-parse()`; this
spec just verifies one example for each parameter.

<===> input/output.css
<===>
================================================================================
<===> format/input/initial/input.scss
a {b: selector-append((c, d e), f)}

<===> format/input/initial/output.css
a {
b: cf, d ef;
}

<===>
================================================================================
<===> format/input/later/input.scss
a {b: selector-append(c, (d, e f))}

<===> format/input/later/output.css
a {
b: cd, ce f;
}

<===>
================================================================================
<===> format/output/input.scss
$result: selector-append("c d, e f", "g");
a {
b: cf, cg h, d ef, d eg h;
result: $result;
structure: $result == ("c" "dg", "e" "fg");
}

<===> input/output-libsass.css
<===> format/output/output.css
a {
b: cf, d ef, cg h, d eg h;
result: c dg, e fg;
structure: true;
}

<===>
Expand Down
95 changes: 95 additions & 0 deletions spec/core_functions/selector/extend/format.hrx
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
<===> input/non_string/README.md
These specs verify that all the arguments to `selector-extend()` can take the
parsed selector format, and that the function returns a selector in that format.
The full set of possible input formats is tested with `selector-parse()`; this
spec just verifies one example for each parameter.

<===>
================================================================================
<===> input/non_string/selector/input.scss
a {b: selector-extend((c, d c), "c", "e")}

<===> input/non_string/selector/output.css
a {
b: c, e, d c;
}

<===>
================================================================================
<===> input/non_string/extendee/options.yml
---
:todo:
- sass/libsass#3068

<===> input/non_string/extendee/input.scss
a {b: selector-extend("c.d", (c, ".d"), ".e")}

<===> input/non_string/extendee/output.css
a {
b: c.d, .e;
}

<===>
================================================================================
<===> input/non_string/extender/input.scss
a {b: selector-extend("c", "c", (d, e f))}

<===> input/non_string/extender/output.css
a {
b: c, d, e f;
}

<===>
================================================================================
<===> input/multiple_extendees/compound/input.scss
a {b: selector-extend("c.d", "c.d", ".e")}

<===> input/multiple_extendees/compound/output.css
a {
b: c.d, .e;
}

<===>
================================================================================
<===> input/multiple_extendees/list/options.yml
---
:todo:
- sass/libsass#3067

<===> input/multiple_extendees/list/input.scss
a {b: selector-extend("c.d", "c, .d", ".e")}

<===> input/multiple_extendees/list/output.css
a {
b: c.d, .e;
}

<===>
================================================================================
<===> input/multiple_extendees/list_of_compound/options.yml
---
:todo:
- sass/libsass#3067

<===> input/multiple_extendees/list_of_compound/input.scss
a {b: selector-extend("c.d.e.f", "c.d, .e.f", ".g")}

<===> input/multiple_extendees/list_of_compound/output.css
a {
b: c.d.e.f, .g;
}

<===>
================================================================================
<===> output/input.scss
$result: selector-extend("c d, e f", "g", "g");
a {
result: $result;
structure: $result == ("c" "d", "e" "f");
}

<===> output/output.css
a {
result: c d, e f;
structure: true;
}
79 changes: 0 additions & 79 deletions spec/core_functions/selector/extend/input.hrx

This file was deleted.

7 changes: 7 additions & 0 deletions spec/core_functions/selector/extend/named.hrx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<===> input.scss
a {b: selector-extend($selector: "c.d", $extendee: "c", $extender: "e")}

<===> output.css
a {
b: c.d, e.d;
}

0 comments on commit 812c0d8

Please sign in to comment.