summaryrefslogtreecommitdiffstats
path: root/dom/base/test/test_bug1101364.html
diff options
context:
space:
mode:
Diffstat (limited to 'dom/base/test/test_bug1101364.html')
-rw-r--r--dom/base/test/test_bug1101364.html68
1 files changed, 68 insertions, 0 deletions
diff --git a/dom/base/test/test_bug1101364.html b/dom/base/test/test_bug1101364.html
new file mode 100644
index 0000000000..98aeb8c351
--- /dev/null
+++ b/dom/base/test/test_bug1101364.html
@@ -0,0 +1,68 @@
+<!DOCTYPE>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=1101364
+-->
+<head>
+<title>Test for Bug 1101364</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <script src="/tests/SimpleTest/WindowSnapshot.js"></script>
+ <script src="/tests/SimpleTest/EventUtils.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+ <style>
+ #test1 {
+ user-select: none;
+ }
+
+ #testDiv, #test2 {
+ user-select: text;
+ }
+ </style>
+</head>
+<body id='body'>
+
+<iframe id="test1" srcdoc="<h1 id='test1' style='user-select:none'>Header</h1><div id='testDiv'>test1</div>"></iframe>
+<iframe id="test2" srcdoc="<div contenteditable id='test2'>AAA<span id='test2Inner'>BBB</span></div>"></iframe>
+<pre id="test">
+<script class="testbody" type="text/javascript">
+
+async function test()
+{
+ var iframe1 = document.getElementById('test1');
+ iframe1.focus();
+ var docShell = SpecialPowers.wrap(iframe1.contentWindow).docShell;
+
+ // test1
+ docShell.doCommand("cmd_selectAll");
+ var withoutContenteditable = await snapshotWindow(iframe1.contentWindow);
+
+ iframe1.contentDocument.getElementById('testDiv').setAttribute('contentEditable', true);
+ docShell.doCommand("cmd_selectAll");
+ var withContenteditable = await snapshotWindow(iframe1.contentWindow);
+ dump(withoutContenteditable.toDataURL());
+ dump(withContenteditable.toDataURL());
+
+ ok(compareSnapshots(withoutContenteditable, withContenteditable, true)[0], 'Select all should look identical');
+
+ // test2
+ var iframe2 = document.getElementById('test2');
+ iframe2.focus();
+ var docShell = SpecialPowers.wrap(iframe2.contentWindow).docShell;
+ var test2Inner = iframe2.contentDocument.getElementById('test2Inner');
+ test2Inner.style.MozUserSelect = 'text';
+ docShell.doCommand("cmd_selectAll");
+ var withoutUserSelect = await snapshotWindow(iframe2.contentWindow);
+
+ test2Inner.style.MozUserSelect = 'none';
+ docShell.doCommand("cmd_selectAll");
+ var withUserSelect = await snapshotWindow(iframe2.contentWindow);
+ ok(compareSnapshots(withoutUserSelect, withUserSelect, true)[0], 'Editable fields should ignore user select style');
+
+ SimpleTest.finish();
+}
+window.onload = function() { setTimeout(test, 0); };
+SimpleTest.waitForExplicitFinish();
+</script>
+</pre>
+</body>
+</html>