/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
const TEST_URI =
"data:text/html;charset=utf-8,Test syntax highlighted output";
add_task(async function () {
const hud = await openNewTabAndConsole(TEST_URI);
// Syntax highlighting is implemented with a Custom Element:
ok(
hud.iframeWindow.customElements.get("syntax-highlighted"),
"Custom Element exists"
);
// Check that we syntax highlight output to look like the inputed text.
// See Bug 1463669.
const onMessage = waitForMessageByType(hud, `var a = 'str';`, ".command");
execute(hud, "var a = 'str';");
const message = await onMessage;
const highlighted = message.node.querySelectorAll("syntax-highlighted");
const expectedMarkup = isCmNextEnabled
? // TODO: Fix syntax highlighting for the output CM6. See Bug 2015445
`var a = 'str';`
: `var a = 'str';`;
is(highlighted.length, 1, "1 syntax highlighted tag");
is(highlighted[0].outerHTML, expectedMarkup, "got expected html");
});