Skip to content

Commit

Permalink
✅ Add shorthand-values Sass tests sasstools#166
Browse files Browse the repository at this point in the history
  • Loading branch information
DanPurdy committed Sep 14, 2015
1 parent cf631e8 commit e32c7a1
Show file tree
Hide file tree
Showing 2 changed files with 257 additions and 1 deletion.
147 changes: 146 additions & 1 deletion tests/rules/shorthand-values.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ var lint = require('./_lint');

var file = lint.file('shorthand-values.scss');

describe('shorthand values', function () {
describe('shorthand values - scss', function () {
it('[default]', function (done) {
lint.test(file, {
'shorthand-values': 1
Expand Down Expand Up @@ -146,3 +146,148 @@ describe('shorthand values', function () {
});
});
});

// Sass

describe('shorthand values - sass', function () {
it('[default]', function (done) {
lint.test(lint.file('shorthand-values.sass'), {
'shorthand-values': 1
}, function (data) {
lint.assert.equal(44, data.warningCount);
done();
});
});

it('[allowed: 1]', function (done) {
lint.test(lint.file('shorthand-values.sass'), {
'shorthand-values': [
1,
{
'allowed-shorthands': [
1
]
}
]
}, function (data) {
lint.assert.equal(19, data.warningCount);
done();
});
});

it('[allowed: 2]', function (done) {
lint.test(lint.file('shorthand-values.sass'), {
'shorthand-values': [
1,
{
'allowed-shorthands': [
2
]
}
]
}, function (data) {
lint.assert.equal(20, data.warningCount);
done();
});
});

it('[allowed: 3]', function (done) {
lint.test(lint.file('shorthand-values.sass'), {
'shorthand-values': [
1,
{
'allowed-shorthands': [
3
]
}
]
}, function (data) {
lint.assert.equal(26, data.warningCount);
done();
});
});

it('[allowed: none]', function (done) {
lint.test(lint.file('shorthand-values.sass'), {
'shorthand-values': [
1,
{
'allowed-shorthands': [
]
}
]
}, function (data) {
lint.assert.equal(0, data.warningCount);
done();
});
});

it('[allowed: 1, 2]', function (done) {
lint.test(lint.file('shorthand-values.sass'), {
'shorthand-values': [
1,
{
'allowed-shorthands': [
1,
2
]
}
]
}, function (data) {
lint.assert.equal(32, data.warningCount);
done();
});
});

it('[allowed: 1, 3]', function (done) {
lint.test(lint.file('shorthand-values.sass'), {
'shorthand-values': [
1,
{
'allowed-shorthands': [
1,
3
]
}
]
}, function (data) {
lint.assert.equal(38, data.warningCount);
done();
});
});

it('[allowed: 2, 3]', function (done) {
lint.test(lint.file('shorthand-values.sass'), {
'shorthand-values': [
1,
{
'allowed-shorthands': [
2,
3
]
}
]
}, function (data) {
lint.assert.equal(32, data.warningCount);
done();
});
});

it('[allowed: 1, 2, 3] - as default', function (done) {
lint.test(lint.file('shorthand-values.sass'), {
'shorthand-values': [
1,
{
'allowed-shorthands': [
1,
2,
3
]
}
]
}, function (data) {
lint.assert.equal(44, data.warningCount);
done();
});
});
});
111 changes: 111 additions & 0 deletions tests/sass/shorthand-values.sass
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
.value-one
border-color: red
border-radius: 1px/1rem
border-style: dashed
border-width: inherit
margin: 1rem
padding: 1px

.value-two-ident
border-color: red red
border-radius: 1px/1rem 1px/1rem
border-style: dashed dashed
border-width: inherit inherit
margin: 1rem 1rem
padding: 1px 1px

.value-two-diff
border-color: red blue
border-radius: 1px/1rem 2px/2rem
border-style: dashed dotted
border-width: inherit 2em
margin: 1rem 2rem
padding: 1px 2px

.value-three-ident
border-color: red red red
border-radius: 1px/1rem 1px/1rem 1px/1rem
border-style: dashed dashed dashed
border-width: inherit inherit inherit
margin: 1rem 1rem 1rem
padding: 1px 1px 1px

.value-three-diff-one
border-color: blue red red
border-radius: 2px/2rem 1px/1rem 1px/1rem
border-style: dotted dashed dashed
border-width: 10px inherit inherit
margin: 2rem 1rem 1rem
padding: 2px 1px 1px

.value-three-diff-two
border-color: red blue red
border-radius: 1px/1rem 2px/2rem 1px/1rem
border-style: dashed dotted dashed
border-width: inherit 10px inherit
margin: 1rem 2rem 1rem
padding: 1px 2px 1px

.value-three-diff-three
border-color: red red blue
border-radius: 1px/1rem 1px/1rem 2px/2rem
border-style: dashed dashed dotted
border-width: inherit inherit 10px
margin: 1rem 1rem 2rem
padding: 1px 1px 2px

.value-four-ident
border-color: red red red red
border-radius: 1px/1rem 1px/1rem 1px/1rem 1px/1rem
border-style: dashed dashed dashed dashed
border-width: inherit inherit inherit inherit
margin: 1rem 1rem 1rem 1rem
padding: 1px 1px 1px 1px

.value-four-diff-one
border-color: blue red red red
border-radius: 2px/2rem 1px/1rem 1px/1rem 1px/1rem
border-style: dotted dashed dashed dashed
border-width: 10px inherit inherit inherit
margin: 2rem 1rem 1rem 1rem
padding: 2px 1px 1px 1px

.value-four-diff-two
border-color: red blue red red
border-radius: 1px/1rem 2px/2rem 1px/1rem 1px/1rem
border-style: dashed dotted dashed dashed
border-width: inherit 10px inherit inherit
margin: 1rem 2rem 1rem 1rem
padding: 1px 2px 1px 1px

.value-four-diff-three
border-color: red red blue red
border-radius: 1px/1rem 1px/1rem 2px/2rem 1px/1rem
border-style: dashed dashed dotted dashed
border-width: inherit inherit 10px inherit
margin: 1rem 1rem 2rem 1rem
padding: 1px 1px 2px 1px

.value-four-diff-four
border-color: red red red blue
border-radius: 1px/1rem 1px/1rem 1px/1rem 2px/2rem
border-style: dashed dashed dashed dotted
border-width: inherit inherit inherit 10px
margin: 1rem 1rem 1rem 2rem
padding: 1px 1px 1px 2px

.value-four-diff-five
border-color: red blue red blue
border-radius: 1px/1rem 2px/2rem 1px/1rem 2px/2rem
border-style: dashed dotted dashed dotted
border-width: inherit 10px inherit 10px
margin: 1rem 2rem 1rem 2rem
padding: 1px 2px 1px 2px

.value-four-ident
border-color: $red $red $red $red
border-radius: $one $two $one $two
border-style: $one $two $three $one
border-width: $one $two $three $four
margin: $one $two $one $three
padding: $one $one $one $two

0 comments on commit e32c7a1

Please sign in to comment.