From 87ea9b141e236d41d34885a25c7942ec04d0ec28 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Aleksander=20=C5=81ukasz?= Date: Thu, 24 Oct 2013 10:27:18 +0200 Subject: [PATCH] smartxml: testing emition of the nodeTagChange event --- src/smartxml/smartxml.test.js | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/smartxml/smartxml.test.js b/src/smartxml/smartxml.test.js index 86f16de..10610c4 100644 --- a/src/smartxml/smartxml.test.js +++ b/src/smartxml/smartxml.test.js @@ -1,7 +1,8 @@ define([ 'libs/chai', + 'libs/sinon', './smartxml.js' -], function(chai, smartxml) { +], function(chai, sinon, smartxml) { 'use strict'; /*jshint expr:true */ @@ -84,6 +85,19 @@ describe('smartxml', function() { expect(node.getTagName()).to.equal('span'); }); + it('emits nodeTagChange event', function() { + var node = elementNodeFromXML('
'), + 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 -- 2.20.1