From a6cc38fb9ae0ba3f62e05be0cf8c3d2d2b8386d8 Mon Sep 17 00:00:00 2001 From: Artur Arseniev Date: Sun, 6 Dec 2020 19:03:27 +0100 Subject: [PATCH] Update parser tests --- test/specs/editor/index.js | 14 ++++++------ test/specs/parser/model/ParserHtml.js | 32 +++++++++++++-------------- 2 files changed, 23 insertions(+), 23 deletions(-) diff --git a/test/specs/editor/index.js b/test/specs/editor/index.js index dd832d129..9a64636fd 100644 --- a/test/specs/editor/index.js +++ b/test/specs/editor/index.js @@ -48,8 +48,8 @@ describe('Editor', () => { test('Components are correctly tracked on add', () => { const all = editor.Components.allById(); const wrapper = editor.getWrapper(); - wrapper.append('
Component
'); - expect(keys(all).length).toBe(1 + initComps); + wrapper.append('
Component
'); // Div component + textnode + expect(keys(all).length).toBe(2 + initComps); }); test('Components are correctly tracked on add and remove', () => { @@ -59,13 +59,13 @@ describe('Editor', () => {
Component 1
`); - expect(keys(all).length).toBe(2 + initComps); + expect(keys(all).length).toBe(3 + initComps); const secComp = added[1]; secComp.append(`
Component 2
Component 3
`); - expect(keys(all).length).toBe(4 + initComps); + expect(keys(all).length).toBe(7 + initComps); wrapper.empty(); expect(wrapper.components().length).toBe(0); expect(keys(all).length).toBe(initComps); @@ -84,7 +84,7 @@ describe('Editor', () => { expect(umStack.length).toBe(2); expect(keys(all).length).toBe(initComps); um.undo(false); - expect(keys(all).length).toBe(1 + initComps); + expect(keys(all).length).toBe(2 + initComps); }); test('Components are correctly tracked with UndoManager and mutiple operations', () => { @@ -99,7 +99,7 @@ describe('Editor', () => {
Component 2
`); expect(umStack.length).toBe(1); // UM counts first children - expect(keys(all).length).toBe(3 + initComps); + expect(keys(all).length).toBe(5 + initComps); wrapper .components() .at(0) @@ -109,7 +109,7 @@ describe('Editor', () => { // UM registers 2 identical remove undoTypes as Backbone triggers remove from the // collection and the model expect(umStack.length).toBe(3); - expect(keys(all).length).toBe(2 + initComps); + expect(keys(all).length).toBe(3 + initComps); wrapper.empty(); expect(umStack.length).toBe(4); expect(keys(all).length).toBe(initComps); diff --git a/test/specs/parser/model/ParserHtml.js b/test/specs/parser/model/ParserHtml.js index ee06e8979..baa486761 100644 --- a/test/specs/parser/model/ParserHtml.js +++ b/test/specs/parser/model/ParserHtml.js @@ -130,7 +130,7 @@ describe('ParserHtml', () => { tagName: 'div', attributes: { id: 'test1' }, type: 'text', - content: 'test2 ' + components: 'test2 ' } ]; expect(obj.parse(str).html).toEqual(result); @@ -158,7 +158,7 @@ describe('ParserHtml', () => { tagName: '' }, { - content: 'b', + components: 'b', type: 'text', tagName: 'b' }, @@ -168,7 +168,7 @@ describe('ParserHtml', () => { tagName: '' }, { - content: 'i', + components: 'i', tagName: 'i', type: 'text' }, @@ -178,7 +178,7 @@ describe('ParserHtml', () => { tagName: '' }, { - content: 'u', + components: 'u', tagName: 'u', type: 'text' }, @@ -208,7 +208,7 @@ describe('ParserHtml', () => { tagName: '' }, { - content: 'b', + components: 'b', tagName: 'b', type: 'text' }, @@ -218,7 +218,7 @@ describe('ParserHtml', () => { tagName: '' }, { - content: 'i', + components: 'i', tagName: 'i', type: 'text' }, @@ -230,7 +230,7 @@ describe('ParserHtml', () => { { tagName: 'div', type: 'text', - content: 'ABC' + components: 'ABC' }, { content: ' ', @@ -238,7 +238,7 @@ describe('ParserHtml', () => { tagName: '' }, { - content: 'i', + components: 'i', tagName: 'i', type: 'text' }, @@ -248,7 +248,7 @@ describe('ParserHtml', () => { tagName: '' }, { - content: 'u', + components: 'u', tagName: 'u', type: 'text' }, @@ -313,7 +313,7 @@ describe('ParserHtml', () => { { tagName: 'div', type: 'text', - content: 'nested' + components: 'nested' }, { tagName: '', @@ -343,7 +343,7 @@ describe('ParserHtml', () => { { tagName: 'span', type: 'text', - content: 'nested' + components: 'nested' } ] }, @@ -448,7 +448,7 @@ describe('ParserHtml', () => { }, { tagName: 'p', - content: 'TestText', + components: 'TestText', type: 'text' }, { @@ -475,7 +475,7 @@ describe('ParserHtml', () => { 'data-test': 'test-value' }, type: 'text', - content: 'test2 ' + components: 'test2 ' } ]; expect(obj.parse(str).html).toEqual(result); @@ -494,7 +494,7 @@ describe('ParserHtml', () => { 'data-test': 'test-value' }, type: 'text', - content: 'test2 ' + components: 'test2 ' } ]; expect(obj.parse(str).html).toEqual(result); @@ -512,7 +512,7 @@ describe('ParserHtml', () => { prop2: 10, prop3: true }, - content: 'test2 ' + components: 'test2 ' } ]; expect(obj.parse(str).html).toEqual(result); @@ -526,7 +526,7 @@ describe('ParserHtml', () => { attributes: {}, type: 'text', test: ['value1', 'value2'], - content: 'test2 ' + components: 'test2 ' } ]; expect(obj.parse(str).html).toEqual(result);