X-Git-Url: https://git.mdrn.pl/fnpeditor.git/blobdiff_plain/e0aad96df245c7148966887cbcc77417a4b7675b..bc66ee34b72b64bbf916a055bf2742ffc7da08c2:/src/editor/modules/documentCanvas/canvas/elementsRegister.test.js?ds=inline diff --git a/src/editor/modules/documentCanvas/canvas/elementsRegister.test.js b/src/editor/modules/documentCanvas/canvas/elementsRegister.test.js index eb7ad89..542e199 100644 --- a/src/editor/modules/documentCanvas/canvas/elementsRegister.test.js +++ b/src/editor/modules/documentCanvas/canvas/elementsRegister.test.js @@ -13,20 +13,18 @@ var expect = chai.expect; describe('Elements register', function() { it('registers element for a tag', function() { var register = new ElementsRegister(documentElement.DocumentNodeElement), - prototype = {testMethod: function(){}}; + prototype = Object.create({}); register.register({ tag: 'div', prototype: prototype, }); - var Element = register.getElement({tag: 'div'}); - expect(Element.prototype.testMethod).to.equal(prototype.testMethod, '1'); - expect(Element.prototype instanceof documentElement.DocumentNodeElement).to.equal(true, '2'); + expect(Element.prototype).to.equal(prototype); }); it('registers element for a class', function() { var register = new ElementsRegister(documentElement.DocumentNodeElement), - prototype = {testMethod: function(){}}; + prototype = Object.create({}); register.register({ tag: 'div', @@ -34,29 +32,7 @@ describe('Elements register', function() { prototype: prototype, }); var Element = register.getElement({tag: 'div', klass: 'a.b.c'}); - expect(Element.prototype.testMethod).to.equal(prototype.testMethod, '1'); - expect(Element.prototype instanceof documentElement.DocumentNodeElement).to.equal(true, '2'); - }); - it('allows inheriting from selected element', function() { - var register = new ElementsRegister(documentElement.DocumentNodeElement), - method1 = function() {}, - method2 = function() {}; - - register.register({ - tag: 'div', - prototype: {method1: method1} - }); - - register.register({ - tag: 'div', - klass: 'a', - prototype: {method2: method2}, - extending: {tag: 'div'} - }); - - var Element = register.getElement({tag: 'div', klass: 'a'}); - expect(Element.prototype.method2).to.equal(method2, '2'); - expect(Element.prototype instanceof register.getElement({tag: 'div'})).to.equal(true, '2'); + expect(Element.prototype).to.equal(prototype); }); });