summaryrefslogtreecommitdiffstats
path: root/dom/base/test/test_bug333064.html
blob: 65cc893a42a17730f80677f04c7b78bdac6bc5a3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=333064
-->
<head>
  <title>Test for Bug 333064</title>
  <script src="/tests/SimpleTest/SimpleTest.js"></script>
  <script src="/tests/SimpleTest/EventUtils.js"></script>
  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=333064">Mozilla Bug 333064</a>
<p id="display"></p>

<div id="display">
</div>
<div id="korean-text">안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안</div>

<pre id="test">
</pre>

<script class="testbody" type="application/javascript">

/** Test for Bug 333064 **/
SimpleTest.waitForExplicitFinish();
SimpleTest.waitForFocus(function() {
  var div = document.getElementById("korean-text");
  var sel = window.getSelection();

  // Select text node in div.
  var r = document.createRange();
  r.setStart(div, 0);
  r.setEnd(div, 1);
  sel.addRange(r);

  SimpleTest.waitForClipboard(
    function compare(value) {
      // Make sure we got the HTML flavour we asked for and that our
      // string is included without additional spaces.
      return value.includes("korean-text") && value.includes("안".repeat(160));
    },
    function setup() {
      synthesizeKey("C", {accelKey: true});
    },
    function onSuccess() {
      SimpleTest.finish();
    },
    function onFailure() {
      SimpleTest.finish();
    },
    "text/html"
  );
});

</script>

</body>
</html>