Skip to content

Commit

Permalink
Add specs for :where()
Browse files Browse the repository at this point in the history
  • Loading branch information
jathak committed Apr 5, 2022
1 parent 126d17f commit 9becb82
Show file tree
Hide file tree
Showing 11 changed files with 489 additions and 24 deletions.
32 changes: 32 additions & 0 deletions spec/core_functions/selector/extend/no_op.hrx
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,21 @@ a {
b: .c:is(d);
}

<===>
================================================================================
<===> unification/subselector_of_target/where/options.yml
---
:ignore_for:
- libsass

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

<===> unification/subselector_of_target/where/output.css
a {
b: .c:where(d);
}

<===>
================================================================================
<===> unification/subselector_of_target/matches/input.scss
Expand All @@ -240,3 +255,20 @@ a {b: selector-extend(".c:matches(d)", ":matches(d)", "d.e")}
a {
b: .c:matches(d);
}

<===>
================================================================================
<===> unification/specificity_modification/where/options.yml
---
:ignore_for:
- libsass

<===> unification/specificity_modification/where/input.scss
a {
b: selector-extend(":where(.x)", ".x", ".x .y");
}

<===> unification/specificity_modification/where/output.css
a {
b: :where(.x, .x .y);
}
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,12 @@ a {

<===>
================================================================================
<===> not/is/list/options.yml
<===> not/is/options.yml
:todo:
- sass/libsass#3154

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

Expand Down Expand Up @@ -133,6 +135,46 @@ a {
b: :not(.c):not(.d:matches(.e, .f));
}

<===>
================================================================================
<===> not/where/options.yml
:ignore_for:
- libsass

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

<===> not/where/list/output.css
a {
b: :not(.c):not(.d):not(.e);
}

<===>
================================================================================
<===> not/where/list_of_complex/options.yml
:todo:
- sass/libsass#3154

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

<===> not/where/list_of_complex/output.css
a {
b: :not(.c):not(.d .e):not(.f .g);
}

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

<===> not/where/in_compound/output.css
a {
b: :not(.c):not(.d:where(.e, .f));
}

<===>
================================================================================
<===> not/not_in_extender/input.scss
Expand Down Expand Up @@ -184,6 +226,43 @@ a {
b: :is(.c, .d, .e);
}

<===>
================================================================================
<===> where/options.yml
---
:todo:
- sass/libsass#3154

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

<===> where/simple/output.css
a {
b: :where(.c, .d);
}

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

<===> where/list/output.css
a {
b: :where(.c, .d, .e);
}

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

<===> where/is_in_extender/output.css
a {
b: :where(.c, .d, .e);
}

<===>
================================================================================
<===> matches/simple/input.scss
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,46 @@ a {
b: :is(c d.e, f g);
}

<===>
================================================================================
<===> unprefixed/where/class/equal/input.scss
a {b: selector-extend(":where(c d.e, f g)", ":where(c d.e, f g)", "h")}

<===> unprefixed/where/class/equal/output.css
a {
b: :where(c d.e, f g), h;
}

<===>
================================================================================
<===> unprefixed/where/class/unequal/name/input.scss
a {b: selector-extend(":where(c d.e, f g)", ":-pfx-where(c d.e, f g)", "h")}

<===> unprefixed/where/class/unequal/name/output.css
a {
b: :where(c d.e, f g);
}

<===>
================================================================================
<===> unprefixed/where/class/unequal/argument/input.scss
a {b: selector-extend(":where(c d.e, f g)", ":where(d, g)", "h")}

<===> unprefixed/where/class/unequal/argument/output.css
a {
b: :where(c d.e, f g);
}

<===>
================================================================================
<===> unprefixed/where/class/unequal/has_argument/input.scss
a {b: selector-extend(":where(c d.e, f g)", ":where", "h")}

<===> unprefixed/where/class/unequal/has_argument/output.css
a {
b: :where(c d.e, f g);
}

<===>
================================================================================
<===> unprefixed/matches/class/equal/input.scss
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ In particular, we don't require that superselectors be detected when the
subselector contains `:is()` and the superselector does not (even though
`c` is semantically a superselector of `:is(c)`).

Most changes here should also be reflected in `matches.hrx`.
Most changes here should also be reflected in `where.hrx` and `matches.hrx`.

<===>
================================================================================
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ In particular, we don't require that superselectors be detected when the
subselector contains `:matches()` and the superselector does not (even though
`c` is semantically a superselector of `:matches(c)`).

Most changes here should also be reflected in `is.hrx`.
Most changes here should also be reflected in `is.hrx` and `where.hrx`.

<===>
================================================================================
Expand Down

0 comments on commit 9becb82

Please sign in to comment.