From 6bd5691f375bacac8fa6f44924d5cc2b4f62efef Mon Sep 17 00:00:00 2001 From: =?utf8?q?Aleksander=20=C5=81ukasz?= Date: Tue, 9 Jul 2013 12:05:28 +0200 Subject: [PATCH] Describing DocumentElements internal html structure --- modules/documentCanvas/canvas/canvas.test3.js | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) 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(''); -- 2.20.1