From 7f4e07080708bd0091f84cc71e52103336d32a58 Mon Sep 17 00:00:00 2001 From: Bruno Windels Date: Mon, 23 Sep 2019 15:34:01 +0200 Subject: [PATCH] fix deserialize unit tests --- test/editor/deserialize-test.js | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/test/editor/deserialize-test.js b/test/editor/deserialize-test.js index 8a79b4101f..bf670b0fd8 100644 --- a/test/editor/deserialize-test.js +++ b/test/editor/deserialize-test.js @@ -94,7 +94,7 @@ describe('editor/deserialize', function() { const html = "bold and emphasized text"; const parts = normalize(parseEvent(htmlMessage(html), createPartCreator())); expect(parts.length).toBe(1); - expect(parts[0]).toStrictEqual({type: "plain", text: "**bold** and *emphasized* text"}); + expect(parts[0]).toStrictEqual({type: "plain", text: "**bold** and _emphasized_ text"}); }); it('hyperlink', function() { const html = 'click this!'; @@ -105,10 +105,11 @@ describe('editor/deserialize', function() { it('multiple lines with paragraphs', function() { const html = '

hello

world

'; const parts = normalize(parseEvent(htmlMessage(html), createPartCreator())); - expect(parts.length).toBe(3); + expect(parts.length).toBe(4); expect(parts[0]).toStrictEqual({type: "plain", text: "hello"}); expect(parts[1]).toStrictEqual({type: "newline", text: "\n"}); - expect(parts[2]).toStrictEqual({type: "plain", text: "world"}); + expect(parts[2]).toStrictEqual({type: "newline", text: "\n"}); + expect(parts[3]).toStrictEqual({type: "plain", text: "world"}); }); it('multiple lines with line breaks', function() { const html = 'hello
world'; @@ -121,18 +122,19 @@ describe('editor/deserialize', function() { it('multiple lines mixing paragraphs and line breaks', function() { const html = '

hello
warm

world

'; const parts = normalize(parseEvent(htmlMessage(html), createPartCreator())); - expect(parts.length).toBe(5); + expect(parts.length).toBe(6); expect(parts[0]).toStrictEqual({type: "plain", text: "hello"}); expect(parts[1]).toStrictEqual({type: "newline", text: "\n"}); expect(parts[2]).toStrictEqual({type: "plain", text: "warm"}); expect(parts[3]).toStrictEqual({type: "newline", text: "\n"}); - expect(parts[4]).toStrictEqual({type: "plain", text: "world"}); + expect(parts[4]).toStrictEqual({type: "newline", text: "\n"}); + expect(parts[5]).toStrictEqual({type: "plain", text: "world"}); }); it('quote', function() { const html = '

wise
words

indeed

'; const parts = normalize(parseEvent(htmlMessage(html), createPartCreator())); expect(parts.length).toBe(6); - expect(parts[0]).toStrictEqual({type: "plain", text: "> *wise*"}); + expect(parts[0]).toStrictEqual({type: "plain", text: "> _wise_"}); expect(parts[1]).toStrictEqual({type: "newline", text: "\n"}); expect(parts[2]).toStrictEqual({type: "plain", text: "> **words**"}); expect(parts[3]).toStrictEqual({type: "newline", text: "\n"}); @@ -159,7 +161,7 @@ describe('editor/deserialize', function() { const html = "formatted message for @room"; const parts = normalize(parseEvent(htmlMessage(html), createPartCreator())); expect(parts.length).toBe(2); - expect(parts[0]).toStrictEqual({type: "plain", text: "*formatted* message for "}); + expect(parts[0]).toStrictEqual({type: "plain", text: "_formatted_ message for "}); expect(parts[1]).toStrictEqual({type: "at-room-pill", text: "@room"}); }); it('inline code', function() { @@ -220,7 +222,7 @@ describe('editor/deserialize', function() { const html = "says DON'T SHOUT!"; const parts = normalize(parseEvent(htmlMessage(html, "m.emote"), createPartCreator())); expect(parts.length).toBe(1); - expect(parts[0]).toStrictEqual({type: "plain", text: "/me says *DON'T SHOUT*!"}); + expect(parts[0]).toStrictEqual({type: "plain", text: "/me says _DON'T SHOUT_!"}); }); }); });