sass-lint
Version:
All Node Sass linter!
200 lines (182 loc) • 4.3 kB
JavaScript
;
var lint = require('./_lint');
describe('variable name format - scss', function () {
var file = lint.file('variable-name-format.scss');
it('[convention: hyphenatedlowercase]', function (done) {
lint.test(file, {
'variable-name-format': 1
}, function (data) {
lint.assert.equal(13, data.warningCount);
done();
});
});
it('[convention: camelcase]', function (done) {
lint.test(file, {
'variable-name-format': [
1,
{
'convention': 'camelcase'
}
]
}, function (data) {
lint.assert.equal(15, data.warningCount);
done();
});
});
it('[convention: snakecase]', function (done) {
lint.test(file, {
'variable-name-format': [
1,
{
'convention': 'snakecase'
}
]
}, function (data) {
lint.assert.equal(10, data.warningCount);
done();
});
});
it('[convention: strictbem]', function (done) {
lint.test(file, {
'variable-name-format': [
1,
{
'convention': 'strictbem'
}
]
}, function (data) {
lint.assert.equal(12, data.warningCount);
done();
});
});
it('[convention: hyphenatedbem]', function (done) {
lint.test(file, {
'variable-name-format': [
1,
{
'convention': 'hyphenatedbem'
}
]
}, function (data) {
lint.assert.equal(9, data.warningCount);
done();
});
});
it('[convention: RegExp ^[_A-Z]+$]', function (done) {
lint.test(file, {
'variable-name-format': [
1,
{
'convention': '^[_A-Z]+$',
'convention-explanation': 'Its bad and you should feel bad.'
}
]
}, function (data) {
lint.assert.equal(16, data.warningCount);
done();
});
});
it('[convention: allow-leading-underscore false]', function (done) {
lint.test(file, {
'variable-name-format': [
1,
{
'allow-leading-underscore': false
}
]
}, function (data) {
lint.assert.equal(14, data.warningCount);
done();
});
});
});
describe('variable name format - sass', function () {
var file = lint.file('variable-name-format.sass');
it('[convention: hyphenatedlowercase]', function (done) {
lint.test(file, {
'variable-name-format': 1
}, function (data) {
lint.assert.equal(13, data.warningCount);
done();
});
});
it('[convention: camelcase]', function (done) {
lint.test(file, {
'variable-name-format': [
1,
{
'convention': 'camelcase'
}
]
}, function (data) {
lint.assert.equal(15, data.warningCount);
done();
});
});
it('[convention: snakecase]', function (done) {
lint.test(file, {
'variable-name-format': [
1,
{
'convention': 'snakecase'
}
]
}, function (data) {
lint.assert.equal(10, data.warningCount);
done();
});
});
it('[convention: strictbem]', function (done) {
lint.test(file, {
'variable-name-format': [
1,
{
'convention': 'strictbem'
}
]
}, function (data) {
lint.assert.equal(12, data.warningCount);
done();
});
});
it('[convention: hyphenatedbem]', function (done) {
lint.test(file, {
'variable-name-format': [
1,
{
'convention': 'hyphenatedbem'
}
]
}, function (data) {
lint.assert.equal(9, data.warningCount);
done();
});
});
it('[convention: RegExp ^[_A-Z]+$]', function (done) {
lint.test(file, {
'variable-name-format': [
1,
{
'convention': '^[_A-Z]+$',
'convention-explanation': 'Its bad and you should feel bad.'
}
]
}, function (data) {
lint.assert.equal(16, data.warningCount);
done();
});
});
it('[convention: allow-leading-underscore false]', function (done) {
lint.test(file, {
'variable-name-format': [
1,
{
'allow-leading-underscore': false
}
]
}, function (data) {
lint.assert.equal(14, data.warningCount);
done();
});
});
});