wlxml: turn extracted list items into paragraphs instead of generic blocks
authorAleksander Łukasz <aleksander.lukasz@nowoczesnapolska.org.pl>
Fri, 8 Aug 2014 09:13:44 +0000 (11:13 +0200)
committerAleksander Łukasz <aleksander.lukasz@nowoczesnapolska.org.pl>
Thu, 14 Aug 2014 14:26:15 +0000 (16:26 +0200)
src/wlxml/extensions/list/list.js
src/wlxml/extensions/list/list.test.js

index 7731616..8d88115 100644 (file)
@@ -133,7 +133,7 @@ extension.document.transformations.extractItems = {
                 reference.after(item);
                 reference = item;
                 if(!listIsNested) {
                 reference.after(item);
                 reference = item;
                 if(!listIsNested) {
-                    item.setClass('');
+                    item.setClass('p');
                 }
             });
             if(precedingItems.length === 0) {
                 }
             });
             if(precedingItems.length === 0) {
@@ -143,14 +143,14 @@ extension.document.transformations.extractItems = {
             extractedItems.forEach(function(item) {
                 reference.before(item);
                 if(!listIsNested) {
             extractedItems.forEach(function(item) {
                 reference.before(item);
                 if(!listIsNested) {
-                    item.setClass('');
+                    item.setClass('p');
                 }
             });
         } else {
             extractedItems.forEach(function(item) {
                 reference.after(item);
                 if(!listIsNested) {
                 }
             });
         } else {
             extractedItems.forEach(function(item) {
                 reference.after(item);
                 if(!listIsNested) {
-                    item.setClass('');
+                    item.setClass('p');
                 }
                 reference = item;
             });
                 }
                 reference = item;
             });
index 2d47778..277e828 100644 (file)
@@ -136,10 +136,10 @@ describe('Lists extension', function() {
             expect(list1.contents()[0].contents()[0].getText()).to.equal('0', 'first item of the first list is a first item of the original list');
 
             expect(oldItem1.contents()[0].getText()).to.equal('1', 'first item got extracted');
             expect(list1.contents()[0].contents()[0].getText()).to.equal('0', 'first item of the first list is a first item of the original list');
 
             expect(oldItem1.contents()[0].getText()).to.equal('1', 'first item got extracted');
-            expect(oldItem1.getClass() === '').to.equal(true, 'first extracted element has no wlxml class');
+            expect(oldItem1.getClass() === 'p').to.equal(true, 'first extracted element became a paragraph');
 
             expect(oldItem2.contents()[0].getText()).to.equal('2', 'second item got extracted');
 
             expect(oldItem2.contents()[0].getText()).to.equal('2', 'second item got extracted');
-            expect(oldItem2.getClass() === '').to.equal(true, 'second extracted element has no wlxml class');
+            expect(oldItem2.getClass() === 'p').to.equal(true, 'second extracted element became a paragraph');
 
             expect(list2.is('list')).to.equal(true, 'last section child is a list');
             expect(list2.contents().length).to.equal(1, 'second list has one child');
 
             expect(list2.is('list')).to.equal(true, 'last section child is a list');
             expect(list2.contents().length).to.equal(1, 'second list has one child');
@@ -414,7 +414,7 @@ describe('Lists extension', function() {
             expect(sectionContents[0].is('list')).to.equal(true, 'first child is a list');
 
             expect(extractedItem.getTagName()).to.equal('div', 'extracted item is a wlxml div');
             expect(sectionContents[0].is('list')).to.equal(true, 'first child is a list');
 
             expect(extractedItem.getTagName()).to.equal('div', 'extracted item is a wlxml div');
-            expect(extractedItem.getClass()).to.equal('', 'extracted item has no wlxml class');
+            expect(extractedItem.getClass()).to.equal('p', 'extracted item became a paragraph');
             expect(extractedItem.contents()[0].getText()).to.equal('1.1', 'extracted item ok');
             expect(sectionContents[2].is('list')).to.equal(true, 'second child is a list');
         });
             expect(extractedItem.contents()[0].getText()).to.equal('1.1', 'extracted item ok');
             expect(sectionContents[2].is('list')).to.equal(true, 'second child is a list');
         });