summaryrefslogtreecommitdiffstats
path: root/editor/libeditor/tests/browserscope/test_richtext2.html
diff options
context:
space:
mode:
authorMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
committerMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
commit5f8de423f190bbb79a62f804151bc24824fa32d8 (patch)
tree10027f336435511475e392454359edea8e25895d /editor/libeditor/tests/browserscope/test_richtext2.html
parent49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff)
downloadUXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip
Add m-esr52 at 52.6.0
Diffstat (limited to 'editor/libeditor/tests/browserscope/test_richtext2.html')
-rw-r--r--editor/libeditor/tests/browserscope/test_richtext2.html233
1 files changed, 233 insertions, 0 deletions
diff --git a/editor/libeditor/tests/browserscope/test_richtext2.html b/editor/libeditor/tests/browserscope/test_richtext2.html
new file mode 100644
index 000000000..c0ce07a8f
--- /dev/null
+++ b/editor/libeditor/tests/browserscope/test_richtext2.html
@@ -0,0 +1,233 @@
+<!DOCTYPE html>
+<html lang="en">
+<!--
+BrowserScope richtext2 category tests
+
+This test is originally based on the unit test example available as part of the
+RichText2 suite:
+http://code.google.com/p/browserscope/source/browse/trunk/categories/richtext2/unittestexample.html
+-->
+<head>
+ <meta http-equiv="content-type" content="text/html; charset=utf-8" />
+ <meta http-equiv="X-UA-Compatible" content="IE=edge" />
+
+ <title>BrowserScope Richtext2 Tests</title>
+ <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+ <script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
+
+ <!-- utility scripts -->
+ <script type="text/javascript" src="lib/richtext2/richtext2/static/js/variables.js"></script>
+ <script type="text/javascript" src="lib/richtext2/richtext2/static/js/canonicalize.js"></script>
+ <script type="text/javascript" src="lib/richtext2/richtext2/static/js/compare.js"></script>
+ <script type="text/javascript" src="lib/richtext2/richtext2/static/js/pad.js"></script>
+ <script type="text/javascript" src="lib/richtext2/richtext2/static/js/range.js"></script>
+ <script type="text/javascript" src="lib/richtext2/richtext2/static/js/units.js"></script>
+ <script type="text/javascript" src="lib/richtext2/richtext2/static/js/run.js"></script>
+ <!-- you do not need static/js/output.js -->
+
+ <!--
+ Tests - note that those have the extensions .py,
+ but can be used as JS files directly.
+ -->
+ <script type="text/javascript" src="lib/richtext2/richtext2/tests/selection.py"></script>
+ <script type="text/javascript" src="lib/richtext2/richtext2/tests/apply.py"></script>
+ <script type="text/javascript" src="lib/richtext2/richtext2/tests/applyCSS.py"></script>
+ <script type="text/javascript" src="lib/richtext2/richtext2/tests/change.py"></script>
+ <script type="text/javascript" src="lib/richtext2/richtext2/tests/changeCSS.py"></script>
+ <script type="text/javascript" src="lib/richtext2/richtext2/tests/unapply.py"></script>
+ <script type="text/javascript" src="lib/richtext2/richtext2/tests/unapplyCSS.py"></script>
+ <script type="text/javascript" src="lib/richtext2/richtext2/tests/delete.py"></script>
+ <script type="text/javascript" src="lib/richtext2/richtext2/tests/forwarddelete.py"></script>
+ <script type="text/javascript" src="lib/richtext2/richtext2/tests/insert.py"></script>
+ <script type="text/javascript" src="lib/richtext2/richtext2/tests/querySupported.py"></script>
+ <script type="text/javascript" src="lib/richtext2/richtext2/tests/queryEnabled.py"></script>
+ <script type="text/javascript" src="lib/richtext2/richtext2/tests/queryIndeterm.py"></script>
+ <script type="text/javascript" src="lib/richtext2/richtext2/tests/queryState.py"></script>
+ <script type="text/javascript" src="lib/richtext2/richtext2/tests/queryValue.py"></script>
+
+ <script type="text/javascript" src="lib/richtext2/currentStatus.js"></script>
+
+ <!-- Do something -->
+ <script type="text/javascript">
+ // Set this constant to true in order to get the current status of the test suite.
+ // This is useful for updating the currentStatus.js file when an editor bug is fixed.
+ const UPDATE_TEST_RESULTS = false;
+
+ // some tests (at least RTE2-QE_PASTE_TEXT-1) require clipboard data
+ function startTest() {
+ SimpleTest.waitForClipboard("foo",
+ function() {
+ SpecialPowers.clipboardCopyString("foo");
+ },
+ runTest,
+ function() {
+ ok(false, "Failed to copy a string to the clipboard");
+ SimpleTest.finish();
+ }
+ );
+ }
+
+ function runTest() {
+ initVariables();
+ initEditorDocs();
+
+ const tests = [
+ SELECTION_TESTS,
+ APPLY_TESTS,
+ APPLY_TESTS_CSS,
+ CHANGE_TESTS,
+ CHANGE_TESTS_CSS,
+ UNAPPLY_TESTS,
+ UNAPPLY_TESTS_CSS,
+ DELETE_TESTS,
+ FORWARDDELETE_TESTS,
+ INSERT_TESTS,
+ QUERYSUPPORTED_TESTS,
+ QUERYENABLED_TESTS,
+ QUERYINDETERM_TESTS,
+ QUERYSTATE_TESTS,
+ QUERYVALUE_TESTS,
+ ];
+
+ for (var i = 0; i < tests.length; ++i) {
+ runTestSuite(tests[i]);
+ }
+
+ // Below alert is just a simple demonstration on how to access the test results.
+ // Note that we only ran UNAPPLY tests above, so we have only results from that test set.
+ //
+ // The 'results' structure is as follows:
+ //
+ // results structure containing all results
+ // [<suite ID>] structure containing the results for the given suite *)
+ // .count number of tests in the given suite
+ // .valscore sum of all test value results (HTML or query value)
+ // .selscore sum of all selection results (HTML tests only)
+ // [<class ID>] structure containing the results for the given class **)
+ // .count number of tests in the given suite
+ // .valscore sum of all test value results (HTML or query value)
+ // .selscore sum of all selection results (HTML tests only)
+ // [<test ID>] structure containing the reults for a given test ***)
+ // .valscore value score (0 or 1), minimum over all containers
+ // .selscore selection score (0 or 1), minimum over all containers (HTML tests only)
+ // .valresult worst test value result (integer, see variables.js)
+ // .selresult worst selection result (integer, see variables.js)
+ // [<cont. ID>] structure containing the results of the test for a given container ****)
+ // .valscore value score (0 or 1)
+ // .selscore selection score (0 or 1)
+ // .valresult value result (integer, see variables.js)
+ // .selresult selection result (integer, see variables.js)
+ // .output output string (mainly for use by the online version)
+ // .innerHTML inner HTML of the testing container (<div> or <body>) after the test
+ // .outerHTML outer HTML of the testing container (<div> or <body>) after the test
+ // .bodyInnerHTML inner HTML of the <body> after the test
+ // .bodyOuterHTML outer HTML of the <body> after the test
+ //
+ // *) <suite ID>: a 1-3 character ID, e.g. UNAPPLY_TESTS.id, or 'U' (both referring the same suite)
+ // **) <class ID>: one of 'Proposed', 'RFC' or 'Finalized'
+ // ***) <test ID>: the ID of the test, without the leading 'RTE2-<suite ID>_' part
+ // ****) <container ID>: one of 'div' (test within a <div contenteditable="true">)
+ // 'dM' (test with designMode = 'on')
+ // 'body' (test within a <body contenteditable="true">)
+
+ if (UPDATE_TEST_RESULTS) {
+ var newKnownFailures = {value: {}, select: {}};
+ for (var i = 0; i < tests.length; ++i) {
+ var category = tests[i];
+ for (var group in results[category.id]) {
+ switch (group) {
+ // Skip the known properties
+ case "count":
+ case "valscore":
+ case "selscore":
+ case "time":
+ break;
+ default:
+ for (var test_id in results[category.id][group]) {
+ switch (test_id) {
+ // Skip the known properties
+ case "count":
+ case "valscore":
+ case "selscore":
+ break;
+ default:
+ for (var structure in results[category.id][group][test_id]) {
+ switch (structure) {
+ // Only look at each test structure
+ case "dM":
+ case "body":
+ case "div":
+ if (!results[category.id][group][test_id][structure].valscore) {
+ newKnownFailures.value[category.id + "-" + group + "-" + test_id + "-" + structure] = true;
+ }
+ if (!results[category.id][group][test_id][structure].selscore) {
+ newKnownFailures.select[category.id + "-" + group + "-" + test_id + "-" + structure] = true;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ var resultContainer = document.getElementById("results");
+ resultContainer.style.display = "";
+ resultContainer.textContent = JSON.stringify(newKnownFailures);
+ } else {
+ for (var i = 0; i < tests.length; ++i) {
+ var category = tests[i];
+ for (var group in results[category.id]) {
+ switch (group) {
+ // Skip the known properties
+ case "count":
+ case "valscore":
+ case "selscore":
+ case "time":
+ break;
+ default:
+ for (var test_id in results[category.id][group]) {
+ switch (test_id) {
+ // Skip the known properties
+ case "count":
+ case "valscore":
+ case "selscore":
+ break;
+ default:
+ for (var structure in results[category.id][group][test_id]) {
+ switch (structure) {
+ // Only look at each test structure
+ case "dM":
+ case "body":
+ case "div":
+ var row = results[category.id][group][test_id][structure];
+ var testName = [category.id, group, test_id, structure].join("-");
+ (testName in knownFailures.value ? todo_is : is)(
+ row.valscore, 1, "Browserscope richtext2 value: " + testName);
+ (testName in knownFailures.select ? todo_is : is)(
+ row.selscore, 1, "Browserscope richtext2 selection: " + testName);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ SimpleTest.finish();
+ }
+
+ SimpleTest.waitForExplicitFinish();
+ // Running all of the tests can take a long time, try to account for it
+ SimpleTest.requestLongerTimeout(5);
+ </script>
+</head>
+
+<body onload="startTest()">
+ <iframe name="iframe-dM" id="iframe-dM" src="lib/richtext2/richtext2/static/editable-dM.html"></iframe>
+ <iframe name="iframe-body" id="iframe-body" src="lib/richtext2/richtext2/static/editable-body.html"></iframe>
+ <iframe name="iframe-div" id="iframe-div" src="lib/richtext2/richtext2/static/editable-div.html"></iframe>
+ <pre id="results" style="display: none"></pre>
+</body>
+</html>