Files
iD/test/spec/svg/icon.js
2017-04-24 10:27:29 -04:00

20 lines
717 B
JavaScript

describe('iD.svgIcon', function () {
var selection;
beforeEach(function () {
selection = d3.select(document.createElement('div'));
});
it('creates a generic SVG icon', function () {
selection.call(iD.svgIcon('#icon-bug'));
expect(selection.select('svg').classed('icon')).to.be.true;
expect(selection.select('use').attr('xlink:href')).to.eql('#icon-bug');
});
it('classes the \'svg\' and \'use\' elements', function () {
selection.call(iD.svgIcon('#icon-bug', 'svg-class', 'use-class'));
expect(selection.select('svg').classed('icon svg-class')).to.be.true;
expect(selection.select('use').classed('use-class')).to.be.true;
});
});