Skip to content

Commit

Permalink
Merge pull request ryanbahniuk#17 from ryanbahniuk/2.1.1
Browse files Browse the repository at this point in the history
2.1.1
  • Loading branch information
ryanbahniuk committed Nov 9, 2015
2 parents 0baa031 + 23792a7 commit 95a7710
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 5 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "sassaby",
"version": "2.1.0",
"version": "2.1.1",
"description": "A unit testing library for SASS",
"keywords": ["sass", "scss", "testing", "unit testing", "bdd", "tdd", "test"],
"author": "Ryan Bahniuk <ryan.bahniuk@gmail.com>",
Expand Down
7 changes: 4 additions & 3 deletions src/mixinResult.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,12 @@ function wrapOutput(type, css) {
}

function unwrapOutput(type, css) {
var unwrapped = css;
if (type === 'included') {
return css.replace('.test{', '').replace('}', '');
} else {
return css;
unwrapped = unwrapped.replace(/^.test{/g, '').replace(/\}$/g, '');
}

return unwrapped.replace(/;$/g, '');
}

function compileCss(file, type, call, args, block) {
Expand Down
6 changes: 6 additions & 0 deletions test/fixtures/sample.scss
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,12 @@
@include make-align-right($label);
}

@mixin test-included-mixin-include {
.test {
@include appearance(none);
}
}

@mixin prefixer($prefix, $property, $value) {
-#{$prefix}-#{$property}: $value;
}
Expand Down
15 changes: 15 additions & 0 deletions test/integrationTests.js
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,21 @@ describe('sample.scss', function() {
});
});

describe('test-included-mixin-include', function() {
beforeEach(function() {
mixin = sassaby.standaloneMixin('test-included-mixin-include');
compiled = mixin.called();
});

it('should create the correct selector', function() {
compiled.createsSelector('.test');
});

it('should call the correct mixin', function() {
compiled.calls('appearance(none)');
});
});

describe('animation', function() {
beforeEach(function() {
mixin = sassaby.includedMixin('animation');
Expand Down
4 changes: 3 additions & 1 deletion test/mixinResultTests.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ describe('MixinResult', function() {
var property = 'color';
var value = 'red';
var result = property + ':' + value;
var resultWithSemicolon = property + ':' + value + ';';
var wrappedResult = selector + '{' + result + '}';
var wrappedResultWithSemicolon = selector + '{' + resultWithSemicolon + '}';

var args = [1, 2, 'hello', true];
var argString = '1, 2, hello, true';
Expand Down Expand Up @@ -135,7 +137,7 @@ describe('MixinResult', function() {
});

it('unwraps the included output', function() {
assert.equal(MixinResult.unwrapOutput('included', wrappedResult), result);
assert.equal(MixinResult.unwrapOutput('included', wrappedResultWithSemicolon), result);
});
});

Expand Down

0 comments on commit 95a7710

Please sign in to comment.