Files
firefox/editor/libeditor/tests/test_documentCharacterSet.html
T
Brian Grinstead 6bf5cf3d2a Bug 1544322 - Part 2.1 - Remove the [type] attribute for one-liner <script> tags loading files in /tests/SimpleTest/ in everything except for dom/ r=bzbarsky
This excludes dom/, otherwise the file size is too large for phabricator to handle.

This is an autogenerated commit to handle scripts loading mochitest harness files, in
the simple case where the script src is on the same line as the tag.

This was generated with https://bug1544322.bmoattachments.org/attachment.cgi?id=9058170
using the `--part 2` argument.

Differential Revision: https://phabricator.services.mozilla.com/D27456
2019-04-16 03:50:44 +00:00

60 lines
1.7 KiB
HTML

<!DOCTYPE html>
<html>
<head>
<script src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<p id="display"></p>
<div id="content" style="display: none;">
</div>
<iframe></iframe>
<pre id="test">
<script class="testbody" type="application/javascript">
function getEditor() {
let editframe = window.frames[0];
return SpecialPowers.wrap(editframe).docShell.editingSession
.getEditorForWindow(editframe);
}
SimpleTest.waitForExplicitFinish();
SimpleTest.waitForFocus(function() {
let editdoc = window.frames[0].document;
editdoc.designMode = "on";
let editor = getEditor();
editor.documentCharacterSet = "us-ascii";
let meta = editdoc.getElementsByTagName("meta")[0];
is(meta.getAttribute("http-equiv"), "Content-Type",
"meta element should have http-equiv");
is(meta.getAttribute("content"), "text/html;charset=us-ascii",
"charset should be set as us-ascii");
let dummyMeta = editdoc.createElement("meta");
dummyMeta.setAttribute("name", "keywords");
dummyMeta.setAttribute("content", "test");
meta.parentNode.insertBefore(dummyMeta, meta);
editor.documentCharacterSet = "utf-8";
meta = editdoc.getElementsByTagName("meta")[0];
isnot(meta.getAttribute("http-equiv"), "Content-Type",
"first meta element shouldn't have http-equiv");
meta = editdoc.getElementsByTagName("meta")[1];
is(meta.getAttribute("http-equiv"), "Content-Type",
"second meta element should have http-equiv");
is(meta.getAttribute("content"), "text/html;charset=utf-8",
"charset should be set as utf-8");
SimpleTest.finish();
});
</script>
</pre>
</body>
</html>