mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
Add ES6 support to more files
This commit is contained in:
14
test/javascripts/helpers/custom-html-test.js.es6
Normal file
14
test/javascripts/helpers/custom-html-test.js.es6
Normal file
@@ -0,0 +1,14 @@
|
||||
module("helper:custom-html");
|
||||
|
||||
import { getCustomHTML, setCustomHTML } from 'discourse/helpers/custom-html';
|
||||
|
||||
test("customHTML", function() {
|
||||
blank(getCustomHTML('evil'), "there is no custom HTML for a key by default");
|
||||
|
||||
setCustomHTML('evil', 'trout');
|
||||
equal(getCustomHTML('evil'), 'trout', 'it retrieves the custom html');
|
||||
|
||||
PreloadStore.store('customHTML', {cookie: 'monster'});
|
||||
equal(getCustomHTML('cookie'), 'monster', 'it returns HTML fragments from the PreloadStore');
|
||||
|
||||
});
|
||||
8
test/javascripts/helpers/parse-html.js.es6
Normal file
8
test/javascripts/helpers/parse-html.js.es6
Normal file
@@ -0,0 +1,8 @@
|
||||
/* global Tautologistics */
|
||||
export default function parseHTML(rawHtml) {
|
||||
const builder = new Tautologistics.NodeHtmlParser.HtmlBuilder();
|
||||
const parser = new Tautologistics.NodeHtmlParser.Parser(builder);
|
||||
|
||||
parser.parseComplete(rawHtml);
|
||||
return builder.dom;
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
/* global Tautologistics */
|
||||
/* exported parseHTML */
|
||||
function parseHTML(rawHtml) {
|
||||
var builder = new Tautologistics.NodeHtmlParser.HtmlBuilder(),
|
||||
parser = new Tautologistics.NodeHtmlParser.Parser(builder);
|
||||
|
||||
parser.parseComplete(rawHtml);
|
||||
return builder.dom;
|
||||
}
|
||||
Reference in New Issue
Block a user