bem-js
Version:
A small jQuery library that helps to create CSS classes according to the BEM methodology.
23 lines (20 loc) • 745 B
JavaScript
describe('$.fn', function () {
describe('elementName method', function () {
it('should return the name of the element', function () {
// Arrange.
setFixtures('\
<div class="product__name product_name_is-selected"></div>\
');
// Act & Assert.
expect($('.product__name').elementName()).toEqual('name');
});
it('should return an empty string if the DOM-element does have a class', function () {
// Arrange.
setFixtures('\
<div id="product"></div>\
');
// Act & Assert.
expect($('#product').elementName()).toEqual('');
});
});
});