From: Aleksander Ɓukasz Date: Tue, 9 Jul 2013 10:05:28 +0000 (+0200) Subject: Describing DocumentElements internal html structure X-Git-Url: https://git.mdrn.pl/fnpeditor.git/commitdiff_plain/6bd5691f375bacac8fa6f44924d5cc2b4f62efef Describing DocumentElements internal html structure --- diff --git a/modules/documentCanvas/canvas/canvas.test3.js b/modules/documentCanvas/canvas/canvas.test3.js index 56f8ee6..253a97c 100644 --- a/modules/documentCanvas/canvas/canvas.test3.js +++ b/modules/documentCanvas/canvas/canvas.test3.js @@ -10,6 +10,31 @@ var expect = chai.expect; describe('Canvas', function() { + + describe('Internal HTML representation of a DocumentNodeElement', function() { + it('is always a div tag', function() { + ['section', 'header', 'span', 'aside', 'figure'].forEach(function(tagName) { + var dom = canvas.fromXML('<' + tagName + '>').doc().dom(); + expect(dom.prop('tagName')).to.equal('DIV', tagName + ' is represented as div'); + }); + }); + it('has wlxml tag put into wlxml-tag attribute', function() { + var dom = canvas.fromXML('
').doc().dom(); + expect(dom.attr('wlxml-tag')).to.equal('section'); + }); + it('has wlxml class put into wlxml-class, dots replaced with dashes', function() { + var dom = canvas.fromXML('
').doc().dom(); + expect(dom.attr('wlxml-class')).to.equal('some-class'); + }); + }); + + describe('Internal HTML representation of a DocumentTextElement', function() { + it('is just a TextNode', function() { + var dom = canvas.fromXML('
Alice
').doc().children()[0].dom(); + expect(dom[0].nodeType === Node.TEXT_NODE); + }); + }); + describe('basic properties', function() { it('renders empty document when canvas created from empty XML', function() { var c = canvas.fromXML('');