Skip to content

Commit

Permalink
Merge pull request #281 from hannu/scoped-integration-tests
Browse files Browse the repository at this point in the history
Implement integration tests for scoped styles
  • Loading branch information
Juuso Backman committed Nov 27, 2014
2 parents 5508e63 + 0148d33 commit 8104d6b
Show file tree
Hide file tree
Showing 3 changed files with 70 additions and 0 deletions.
56 changes: 56 additions & 0 deletions test/integration/structure.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,62 @@ describe('styleguide_pseudo_styles.css', function() {
it('should exist', function() {
expect(styleguideFile).to.be.an('object');
});

it('should contain pseudo classes converted to normal class names', function() {
expect(styleguideFile.contents.toString()).to.contain('.section.pseudo-class-hover {');
expect(styleguideFile.contents.toString()).to.contain('.section.pseudo-class-active {');
});
});

describe('scoped_styleguide.css', function() {
var styleguideFile;
this.timeout(5000);

before(function(done) {
var files = [];
styleguideStream().pipe(
through.obj({objectMode: true}, collector(files), function(callback) {
styleguideFile = findFile(files, 'scoped_styleguide.css');
callback();
done();
})
);
});

it('should exist', function() {
expect(styleguideFile).to.be.an('object');
});

it('should contain styles prefixed with the ::content selector', function() {
expect(styleguideFile.contents.toString()).to.contain('::content .section1');
expect(styleguideFile.contents.toString()).to.contain('::content .section2');
expect(styleguideFile.contents.toString()).to.contain('::content .section3');
});
});

describe('scoped_styleguide_pseudo_styles.css', function() {
var styleguideFile;
this.timeout(5000);

before(function(done) {
var files = [];
styleguideStream().pipe(
through.obj({objectMode: true}, collector(files), function(callback) {
styleguideFile = findFile(files, 'scoped_styleguide_pseudo_styles.css');
callback();
done();
})
);
});

it('should exist', function() {
expect(styleguideFile).to.be.an('object');
});

it('should contain styles prefixed with the ::content selector', function() {
expect(styleguideFile.contents.toString()).to.contain('::content .section.pseudo-class-hover {');
expect(styleguideFile.contents.toString()).to.contain('::content .section.pseudo-class-active {');
});
});

describe('overview.html', function() {
Expand Down
7 changes: 7 additions & 0 deletions test/projects/less-project/source/styles/style.less
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,13 @@
.section {
color: @color-red;
}
.section:hover {
color: @color-green;
}
.section:active {
color: @color-blue;
}


// Section with modifiers
//
Expand Down
7 changes: 7 additions & 0 deletions test/projects/scss-project/source/styles/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,13 @@
.section {
color: $color-red;
}
.section:hover {
color: $color-green;
}
.section:active {
color: $color-blue;
}


// Section with modifiers
//
Expand Down

0 comments on commit 8104d6b

Please sign in to comment.