+
+ describe('Internal HTML representation of a sample document', function() {
+ it('works', function() {
+ var c = canvas.fromXML('\
+ <section>\
+ This is some text without its own wrapping tag.\
+ <div class="p.subclass">\
+ This is a paragraph.\
+ </div>\
+ <div>\
+ This is text in a div <span>with some inline text</span>.\
+ </div>\
+ This is some text without its own wrapping tag.\
+ </section>\
+ ');
+ var expected = '<div wlxml-tag="section">'
+ + 'This is some text without its own wrapping tag.'
+ + '<div wlxml-tag="div" wlxml-class="p-subclass">This is a paragraph.</div>'
+ + '<div wlxml-tag="div">This is text in a div <div wlxml-tag="span">with some inline text</div>.</div>'
+ + 'This is some text without its own wrapping tag.'
+ + '</div>';
+ 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) {
+ var dom = canvas.fromXML('<' + tagName + '></' + 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('<section></section>').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('<section class="some.class"></section>').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('<section>Alice</section>').doc().children()[0].dom();
+ expect(dom[0].nodeType === Node.TEXT_NODE);
+ });
+ });
+