Skip to content

Commit

Permalink
Add, rename, and reoder tests
Browse files Browse the repository at this point in the history
  • Loading branch information
travco committed Jun 21, 2016
1 parent bed3a65 commit 65d24cb
Show file tree
Hide file tree
Showing 10 changed files with 107 additions and 58 deletions.
76 changes: 38 additions & 38 deletions index.js

Large diffs are not rendered by default.

11 changes: 11 additions & 0 deletions test/fixtures/BEM-emptytargets.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
.Component--modifier {

}
.Component-descendant {

}

.ClonedComponent {
@extend .Component-descendant;
@extend .Component--modifier;
}
6 changes: 6 additions & 0 deletions test/fixtures/BEM-emptytargets.expected.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.Component--modifier, .ClonedComponent {

}
.Component-descendant, .ClonedComponent {

}
File renamed without changes.
15 changes: 15 additions & 0 deletions test/fixtures/recursion-silenthop.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
%foo {
color: blue;
}
%bar {
font-size: 12px;
}
%baz {
@extend %bar;
background: red;
}

.bam {
@extend %foo;
@extend %baz;
}
9 changes: 9 additions & 0 deletions test/fixtures/recursion-silenthop.expected.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
.bam {
color: blue;
}
.bam {
font-size: 12px;
}
.bam {
background: red;
}
5 changes: 5 additions & 0 deletions test/fixtures/silent-emplaced.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.hide,
[hidden],
%hide { display: none !important; }

.foo { @extend %hide; }
1 change: 1 addition & 0 deletions test/fixtures/silent-emplaced.expected.css
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.hide, [hidden], .foo { display: none !important; }
42 changes: 22 additions & 20 deletions test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,28 +34,15 @@ function p(css) {
return postcss(extend).process(css).css;
}




test('extending into special character selectors', function(t) {
compareFixtures(t, 'specialchars-placeholder');
t.end();
});









test('@define-placeholder basically works', function(t) {
compareFixtures(t, 'basic');
t.end();
});

// specialchars define reserved
test('@define-placeholder with special characters works', function(t) {
compareFixtures(t, 'specialchars-placeholder');
t.end();
});

test('@define-placeholder works with several added selectors', function(t) {
compareFixtures(t, 'several-additions');
Expand Down Expand Up @@ -157,6 +144,11 @@ test('%placeholder works even in an anti-pattern', function(t) {
t.end();
});

test('silent placeholders work even when emplaced among other selectors', function(t) {
compareFixtures(t, 'silent-emplaced');
t.end();
});

test('direct extensions work even in an anti-pattern', function(t) {
compareFixtures(t, 'antipattern-direct');
t.end();
Expand All @@ -167,8 +159,9 @@ test('removes duplicate selectors automatically', function(t) {
t.end();
});

test('bidirectionally recursive behavior on direct extensions', function(t) {
compareFixtures(t, 'bidirectionally-recursive');

test('happily extending style-less components ', function(t) {
compareFixtures(t, 'BEM-emptytargets');
t.end();
});

Expand Down Expand Up @@ -212,7 +205,6 @@ test('extending in media doesn\'t utilize existing rules in-scope', function(t)
t.end();
});


test('extending in media will create sub rules (in-scope) for targets out of scope', function(t) {
compareFixtures(t, 'media-advanced-sub');
t.end();
Expand All @@ -238,11 +230,21 @@ test('has predicatable, logical ordering of selectors', function(t) {
t.end();
});

test('bidirectionally recursive behavior on direct extensions', function(t) {
compareFixtures(t, 'recursion-bidirectional');
t.end();
});

test('full recursion even in badly-formed CSS', function(t) {
compareFixtures(t, 'recursion-full');
t.end();
});

test('properly handled recursion among silent placeholders', function(t) {
compareFixtures(t, 'recursion-silenthop');
t.end();
});

test('full recursion even with placeholders in badly-formed CSS', function(t) {
compareFixtures(t, 'recursion-infinite-placeholders');
t.end();
Expand Down

0 comments on commit 65d24cb

Please sign in to comment.