From 2e5ec1a7f2e8994446ed6a28517d39f56148c89b Mon Sep 17 00:00:00 2001 From: Ajeet Yadav Date: Wed, 5 Apr 2023 16:45:50 +0530 Subject: [PATCH] test cases for additional html elements copying widgets --- tests/richText.js | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/tests/richText.js b/tests/richText.js index 4b67ef395..e2f82289e 100644 --- a/tests/richText.js +++ b/tests/richText.js @@ -273,6 +273,32 @@ define([ [" ", " \xa0 "], [" ", "   "], ["' ,", "'\u200B,"], + + ]; + + var prefix_html_1 = '

', + prefix_html_2 = '', + prefix_html = prefix_html_1 + prefix_html_2, + widget_html = ' dob' + + '', + suffix_html = '

'; + + var text_widgets_outputs = [ + ['This dob: is of child', prefix_html + 'This dob: ' + widget_html + ' is of child' + suffix_html], + ['This dob: ', prefix_html + 'This dob: ' + widget_html + suffix_html], + [' is of child', prefix_html + widget_html + ' is of child' + suffix_html], + ['', prefix_html_1 + widget_html + suffix_html], + ['This dob: is of child', 'This dob: <output value="#case/dob" /> is of child'] ]; _.each(text, function(val){ @@ -289,6 +315,21 @@ define([ ); }); }); + + _.each(text_widgets_outputs, function(val){ + it("from html to text: " + JSON.stringify(val[1]), function() { + assert.strictEqual(richText.fromRichText(val[1]), val[0]); + }); + }); + + _.each(text_widgets_outputs, function(val){ + it("(text -> html -> text): " + JSON.stringify(val[0]), function() { + assert.strictEqual( + richText.fromRichText(richText.toRichText(val[0], form)), + val[0] + ); + }); + }); }); describe("doesn't convert", function() {