UNPKG

canonical

Version:

Canonical code style linter and formatter for JavaScript, SCSS, CSS and JSON.

144 lines (130 loc) 3.16 kB
'use strict'; 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(7, data.warningCount); done(); }); }); it('[convention: camelcase]', function (done) { lint.test(file, { 'variable-name-format': [ 1, { 'convention': 'camelcase' } ] }, function (data) { lint.assert.equal(8, data.warningCount); done(); }); }); it('[convention: snakecase]', function (done) { lint.test(file, { 'variable-name-format': [ 1, { 'convention': 'snakecase' } ] }, function (data) { lint.assert.equal(7, 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(8, 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(8, 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(7, data.warningCount); done(); }); }); it('[convention: camelcase]', function (done) { lint.test(file, { 'variable-name-format': [ 1, { 'convention': 'camelcase' } ] }, function (data) { lint.assert.equal(8, data.warningCount); done(); }); }); it('[convention: snakecase]', function (done) { lint.test(file, { 'variable-name-format': [ 1, { 'convention': 'snakecase' } ] }, function (data) { lint.assert.equal(7, 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(8, 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(8, data.warningCount); done(); }); }); });