Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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