describe('getting elements by attribute', function () { var chai = require('chai'), assert = chai.assert; var DomParser = require('../index.js'), parser = new DomParser(); context('Dom', function(){ it('similar attribute names', function(){ var html = '
\n' + ' text\n' + ' text\n' + ' text\n' + '
\n' + ' example\n' + '
'; var dom = parser.parseFromString(html), elements = dom.getElementsByName('example'); assert.equal(elements.length, 1, 'html contains 1 elements with name "example"'); }); }); context('Dom', function(){ it('spaces and case', function(){ var html = '
\n' + ' text\n' + '
\n' + ' example\n' + '
\n' + '
' + ' ' + ' ' + '
\n' + ' \n' + '
'; var dom = parser.parseFromString(html), elements = dom.getElementsByName('example'); assert.equal(elements.length, 2, 'html contains 2 elements with name "example"'); }); }); });