X-Git-Url: https://git.mdrn.pl/fnpeditor.git/blobdiff_plain/9f174539a3cc0869845fbdca08aa2d1d3e784847..00d1285a2038e326246c5f5ff3bca7728f67925b:/modules/documentCanvas/canvas/canvas.test3.js diff --git a/modules/documentCanvas/canvas/canvas.test3.js b/modules/documentCanvas/canvas/canvas.test3.js index 5aa4aad..3b251f6 100644 --- a/modules/documentCanvas/canvas/canvas.test3.js +++ b/modules/documentCanvas/canvas/canvas.test3.js @@ -11,6 +11,30 @@ var expect = chai.expect; describe('Canvas', function() { + describe('Internal HTML representation of a sample document', function() { + it('works', function() { + var c = canvas.fromXML('\ +
\ + This is some text without its own wrapping tag.\ +
\ + This is a paragraph.\ +
\ +
\ + This is text in a div with some inline text.\ +
\ + This is some text without its own wrapping tag.\ +
\ + '); + var expected = '
' + + 'This is some text without its own wrapping tag.' + + '
This is a paragraph.
' + + '
This is text in a div
with some inline text
.
' + + 'This is some text without its own wrapping tag.' + + '
'; + expect(c.doc().dom()[0].isEqualNode($(expected)[0])).to.be.true; + }); + }); + describe('Internal HTML representation of a DocumentNodeElement', function() { it('is always a div tag', function() { ['section', 'header', 'span', 'aside', 'figure'].forEach(function(tagName) { @@ -79,6 +103,8 @@ describe('Canvas', function() { expect(section.getWlxmlClass()).to.equal('some.class'); section.setWlxmlClass('some.other.class'); expect(section.getWlxmlClass()).to.equal('some.other.class'); + section.setWlxmlClass(null); + expect(section.getWlxmlClass()).to.be.undefined; }); }); }); @@ -162,6 +188,7 @@ describe('Canvas', function() { var c = canvas.fromXML('
'); expect(c.doc().children().length).to.equal(1); expect(c.doc().children()[0]).to.be.instanceOf(documentElement.DocumentTextElement); + expect(c.doc().children()[0].getText()).to.equal(' '); }); it('ignores white space surrounding block elements', function() { var c = canvas.fromXML('
');