Skip to content

Commit

Permalink
Add specs for selector-unify()
Browse files Browse the repository at this point in the history
See #1001
  • Loading branch information
nex3 committed Mar 4, 2020
1 parent 94d83ec commit 48308df
Show file tree
Hide file tree
Showing 20 changed files with 2,022 additions and 0 deletions.
4 changes: 4 additions & 0 deletions spec/core_functions/selector/unify/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Simple selector unification generally relies heavily on superselector logic for
determining when one selector can be omitted. Since this logic is already
thoroughly tested in `is-superselector()`, it's not duplicated here, other than
a few test cases to ensure that superselector logic is working at all.
43 changes: 43 additions & 0 deletions spec/core_functions/selector/unify/chooses_superselector.hrx
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<===> README.md
These tests verify that, if one selector is a superselector of the other, the
subselector is returned (since it's more specific).

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

<===> whole_selector/selector1/output.css
a {
b: d c.e;
}

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

<===> whole_selector/selector2/output.css
a {
b: d c.e;
}

<===>
================================================================================
<===> parent/selector1/input.scss
a {b: selector-unify("c d", "c.e .f")}

<===> parent/selector1/output.css
a {
b: c.e d.f;
}

<===>
================================================================================
<===> parent/selector2/input.scss
a {b: selector-unify("c.e .f", "c d")}

<===> parent/selector2/output.css
a {
b: c.e d.f;
}
Loading

0 comments on commit 48308df

Please sign in to comment.