Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added initial tests for selector-functions #281

Merged
merged 2 commits into from
Mar 21, 2015
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
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
body { a: .foo.bar.baz; b: .a .foo.b .bar; c: .foo-suffix; d: .foo.bar, .foo-suffix; e: .foo--suffix; f: .foo.bar, .foo--suffix; }
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
body{a:.foo.bar.baz;b:.a .foo.b .bar;c:.foo-suffix;d:.foo.bar,.foo-suffix;e:.foo--suffix;f:.foo.bar,.foo--suffix}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
body {
a: .foo.bar.baz;
b: .a .foo.b .bar;
c: .foo-suffix;
d: .foo.bar, .foo-suffix;
e: .foo--suffix;
f: .foo.bar, .foo--suffix;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
body {
a: .foo.bar.baz;
b: .a .foo.b .bar;
c: .foo-suffix;
d: .foo.bar, .foo-suffix;
e: .foo--suffix;
f: .foo.bar, .foo--suffix; }
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
body {
a: selector-append(".foo", ".bar", ".baz");
b: selector-append(".a .foo", ".b .bar");
c: selector-append(".foo", "-suffix");
d: selector-append('.foo', '.bar, -suffix');
e: selector-append('.foo', '--suffix');
f: selector-append('.foo', '.bar, --suffix');
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.simple{a:.a .b,.a .foo .bar,.foo .a .bar;b:.foo .x,.foo .a .bar,.a .foo .bar;c:.foo .x,.foo .bang,.x.bar,.bar.bang;d:.y .x,.foo .x,.y .foo,.foo .foo;e:.foo .x,.foo .bar,.foo .bang;f:.foo.x,.foo}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
.simple {
a: .a .b, .a .foo .bar, .foo .a .bar;
b: .foo .x, .foo .a .bar, .a .foo .bar;
c: .foo .x, .foo .bang, .x.bar, .bar.bang;
d: .y .x, .foo .x, .y .foo, .foo .foo;
e: .foo .x, .foo .bar, .foo .bang;
f: .foo.x, .foo;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
.simple {
a: .a .b, .a .foo .bar, .foo .a .bar;
b: .foo .x, .foo .a .bar, .a .foo .bar;
c: .foo .x, .foo .bang, .x.bar, .bar.bang;
d: .y .x, .foo .x, .y .foo, .foo .foo;
e: .foo .x, .foo .bar, .foo .bang;
f: .foo.x, .foo; }
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
.simple {
a: selector-extend(".a .b", ".b", ".foo .bar");
b: selector-extend('.foo .x', '.x', '.a .bar');
c: selector-extend('.foo .x, .x.bar', '.x', '.bang');
d: selector-extend('.y .x', '.x, .y', '.foo');
e: selector-extend('.foo .x', '.x', '.bar, .bang');
f: selector-extend('.foo.x', '.x', '.foo');
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.where .qux.waldo .final { f: .where .qux.waldo .final foo, .where .qux.waldo .final .bar; }
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.where .qux.waldo .final{f:.where .qux.waldo .final foo,.where .qux.waldo .final .bar}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.where .qux.waldo .final {
f: .where .qux.waldo .final foo, .where .qux.waldo .final .bar;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.where .qux.waldo .final {
f: .where .qux.waldo .final foo, .where .qux.waldo .final .bar; }
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
.qux {
&.waldo {
.where & {
.final {
f: selector-extend(#{&} foo, 'foo', '.bar');
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// Makes sure that a 'is-superselector' call is not true, when the parameters are reversed
@function assert_strict_superselector($a, $b) {
@return is_superselector($a, $b) and not is_superselector($b, $a);
}

@function refute_superselector($a, $b) {
@return not is_superselector($a, $b);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
test { a: true; }
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
test{a:true}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
test {
a: true;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
test {
a: true; }
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
@import "../assert_helpers";

test {
a: refute_superselector(':-moz-any(.foo, .bar)', ':-s-any(.foo, .bar)');
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
test { a: true; b: true; }
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
test{a:true;b:true}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
test {
a: true;
b: true;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
test {
a: true;
b: true; }
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
@import "../assert_helpers";

test {
a: refute_superselector('.foo > .baz', '.foo > .bar > .baz');
b: refute_superselector('.foo > .baz', '.foo > .bar .baz');
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
test { a: true; b: true; c: true; d: true; }
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
test{a:true;b:true;c:true;d:true}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
test {
a: true;
b: true;
c: true;
d: true;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
test {
a: true;
b: true;
c: true;
d: true; }
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
@import "../assert_helpers";

test {
a : assert_strict_superselector('.bar', '.foo .bar');
b : assert_strict_superselector('.bar', '.foo > .bar');
c : assert_strict_superselector('.bar', '.foo + .bar');
d : assert_strict_superselector('.bar', '.foo ~ .bar');
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
test { a: true; b: true; c: true; d: true; }
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
test{a:true;b:true;c:true;d:true}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
test {
a: true;
b: true;
c: true;
d: true;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
test {
a: true;
b: true;
c: true;
d: true; }
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
@import "../assert_helpers";

test {
a : assert_strict_superselector('.foo', '.foo.bar');
b : assert_strict_superselector('.bar', '.foo.bar');
c : assert_strict_superselector('a', 'a#b');
d : assert_strict_superselector('#b', 'a#b');
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
test { a: true; }
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
test{a:true}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
test {
a: true;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
test {
a: true; }
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
@import "../assert_helpers";

test {
a: is-superselector(':current(.foo)', ':current(.foo)');
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
test { a: true; b: true; }
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
test{a:true;b:true}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
test {
a: true;
b: true;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
test {
a: true;
b: true; }
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
@import "../assert_helpers";

test {
a: not is-superselector(':current(.foo)', ':current(.foo.bar)');
b: not is-superselector(':current(.foo.bar)', ':current(.foo)')
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
test { a: true; b: true; c: true; }
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
test{a:true;b:true;c:true}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
test {
a: true;
b: true;
c: true;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
test {
a: true;
b: true;
c: true; }
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
@import "../assert_helpers";

test {
a: assert_strict_superselector('.foo .bar', '.foo > .bar.baz');
b: assert_strict_superselector('.foo .bar', '.foo.baz > .bar');
c: assert_strict_superselector('.foo .baz', '.foo > .bar > .baz');
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
test { a: true; b: true; }
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
test{a:true;b:true}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
test {
a: true;
b: true;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
test {
a: true;
b: true; }
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
@import "../assert_helpers";

test {
a: assert_strict_superselector('.foo ~ .bar', '.foo + .bar.baz');
b: assert_strict_superselector('.foo ~ .bar', '.foo.baz + .bar');
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
test { a: true; b: true; }
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
test{a:true;b:true}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
test {
a: true;
b: true;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
test {
a: true;
b: true; }
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
@import "../assert_helpers";

test {
a: refute_superselector('.foo + .baz', '.foo + .bar + .baz');
b: refute_superselector('.foo + .baz', '.foo + .bar .baz');
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
test { a: true; }
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
test{a:true}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
test {
a: true;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
test {
a: true; }
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
@import "../assert_helpers";

test {
a: assert_strict_superselector(':has(.foo, .bar, .baz)', ':has(.foo.bip, .baz.bang)');
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
test { a: false; }
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
test{a:false}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
test {
a: false;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
test {
a: false; }
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
@import "../assert_helpers";

test {
a: assert_strict_superselector(':has(.foo, .bar, .baz)', '.foo');
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
test { a: true; }
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
test{a:true}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
test {
a: true;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
test {
a: true; }
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
@import "../assert_helpers";

test {
a: assert_strict_superselector(':host-context(.foo, .bar, .baz)', ':host-context(.foo.bip, .baz.bang)');
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
test { a: false; }
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
test{a:false}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
test {
a: false;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
test {
a: false; }
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
@import "../assert_helpers";

test {
a: assert_strict_superselector(':host-context(.foo, .bar, .baz)', '.foo');
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
test { a: true; }
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
test{a:true}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
test {
a: true;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
test {
a: true; }
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
@import "../assert_helpers";

test {
a: assert_strict_superselector(':host(.foo, .bar, .baz)', ':host(.foo.bip, .baz.bang)');
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
test { a: false; }
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
test{a:false}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
test {
a: false;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
test {
a: false; }
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
@import "../assert_helpers";

test {
a: assert_strict_superselector(':host(.foo, .bar, .baz)', '.foo');
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
test { a: true; b: true; }
Loading