-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
BEMHTML: support unquoted attributes (fix for #364)
- Loading branch information
1 parent
5ab2e2f
commit 42f8b8c
Showing
6 changed files
with
183 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
var utils = require('../lib/bemxjst/utils'); | ||
|
||
describe('Utils', function() { | ||
|
||
var attrCheck = function attrCheck(str) { | ||
return !!utils.isUnquotedAttr(str); | ||
}; | ||
describe('isUnquotedAttr()', function() { | ||
it('should return true with simple class', function() { | ||
attrCheck('b').should.equal(true); | ||
}); | ||
|
||
it('should return false with class with space', function() { | ||
attrCheck('block mixed').should.equal(false); | ||
}); | ||
|
||
it('should return true with class with hyphens', function() { | ||
attrCheck('b-page').should.equal(true); | ||
}); | ||
|
||
it('should return true with class with uppercase', function() { | ||
attrCheck('bPage').should.equal(true); | ||
}); | ||
|
||
it('should return true with class with period', function() { | ||
attrCheck('b.page').should.equal(true); | ||
}); | ||
|
||
it('should return true with class with underscores', function() { | ||
attrCheck('page__content').should.equal(true); | ||
}); | ||
|
||
it('should return true with class with colons', function() { | ||
attrCheck('test:test').should.equal(true); | ||
}); | ||
|
||
it('should return false with double quote', function() { | ||
attrCheck('"test').should.equal(false); | ||
}); | ||
|
||
it('should return true with class with digits', function() { | ||
attrCheck('color333').should.equal(true); | ||
}); | ||
|
||
it('should return true with class with combination of above', function() { | ||
attrCheck('b-page__content_test_100').should.equal(true); | ||
}); | ||
|
||
it('should return false with empty string', function() { | ||
attrCheck('').should.equal(false); | ||
}); | ||
}); | ||
}); |