X-Git-Url: https://git.mdrn.pl/fnpeditor.git/blobdiff_plain/74635b9e0dd3069953072eab9de946b77d1b313e..2e14f0181735b7acd0da023eb4c9524b75a45b56:/src/editor/modules/documentCanvas/canvas/canvas.test.js diff --git a/src/editor/modules/documentCanvas/canvas/canvas.test.js b/src/editor/modules/documentCanvas/canvas/canvas.test.js index 4f954f1..63ef243 100644 --- a/src/editor/modules/documentCanvas/canvas/canvas.test.js +++ b/src/editor/modules/documentCanvas/canvas/canvas.test.js @@ -4,8 +4,9 @@ define([ 'libs/sinon', 'modules/documentCanvas/canvas/canvas', 'modules/documentCanvas/canvas/utils', +'modules/documentCanvas/canvas/documentElement', 'wlxml/wlxml', -], function($, chai, sinon, canvas, utils, wlxml) { +], function($, chai, sinon, canvas, utils, documentElement, wlxml) { 'use strict'; /* global describe, it, beforeEach, afterEach */ @@ -228,20 +229,20 @@ describe('Default document changes handling', function() { describe('Custom elements based on wlxml class attribute', function() { it('allows custom rendering', function() { - var c = getCanvasFromXML('
', [ - {tag: 'div', klass: 'testClass', prototype: { + var prototype = $.extend({}, documentElement.DocumentNodeElement.prototype, { init: function() { this._container().append(''); } - }, extending: {tag: 'div'}} + }), + c = getCanvasFromXML('
', [ + {tag: 'div', klass: 'testClass', prototype: prototype} ]); expect(c.doc().children()[0]._container().children('test').length).to.equal(1); // @! }); it('allows handling changes to internal structure of rendered node', function() { - var c = getCanvasFromXML('
', [ - {tag: 'div', klass: 'testClass', prototype: { + var prototype = $.extend({}, documentElement.DocumentNodeElement.prototype, { init: function() { this.header = $('

'); this._container().append(this.header); @@ -254,7 +255,10 @@ describe('Custom elements based on wlxml class attribute', function() { void(event); this.refresh2(); } - }, extending: {tag: 'div'}} + }); + + var c = getCanvasFromXML('
', [ + {tag: 'div', klass: 'testClass', prototype: prototype} ]); var node = c.wlxmlDocument.root.contents()[0],