From 119c4d0c1bccd85fe609c7faeb70c13af62cb109 Mon Sep 17 00:00:00 2001 From: Joffrey JAFFEUX Date: Wed, 27 Nov 2019 17:36:45 +0100 Subject: [PATCH] DEV: adds a `stringToHTML` helper to be used in tests (#8424) This will replace the need for jquery: `$(string)` --- test/javascripts/helpers/html-helper.js.es6 | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 test/javascripts/helpers/html-helper.js.es6 diff --git a/test/javascripts/helpers/html-helper.js.es6 b/test/javascripts/helpers/html-helper.js.es6 new file mode 100644 index 00000000000..e9997908db3 --- /dev/null +++ b/test/javascripts/helpers/html-helper.js.es6 @@ -0,0 +1,5 @@ +export function stringToHTML(string) { + const parser = new DOMParser(); + const doc = parser.parseFromString(string, "text/html"); + return doc.body.firstChild; +}