define([
'libs/chai',
+ 'libs/sinon',
'./smartxml.js'
-], function(chai, smartxml) {
+], function(chai, sinon, smartxml) {
'use strict';
/*jshint expr:true */
expect(node.getTagName()).to.equal('span');
});
+ it('emits nodeTagChange event', function() {
+ var node = elementNodeFromXML('<div></div>'),
+ spy = sinon.spy();
+
+ node.document.on('change', spy);
+ node.setTag('span');
+ var event = spy.args[0][0];
+
+ expect(event.type).to.equal('nodeTagChange');
+ expect(event.meta.node.sameNode(node)).to.be.true;
+ expect(event.meta.oldTagName).to.equal('div');
+ });
+
describe('Implementation specific expectations', function() {
// DOM specifies ElementNode tag as a read-only property, so
// changing it in a seamless way is a little bit tricky. For this reason