Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / accessibility / is-richly-editable.html
blobec19fdc99945367991d49e9f4be1e10e6726c5c9
1 <!DOCTYPE html>
2 <script src="../resources/js-test.js"></script>
4 <!-- Richly editable elements. -->
5 <div id="richly_editable1" contentEditable></div>
6 <div id="richly_editable2" contentEditable="true"></div>
7 <div contentEditable>
8 <p id="richly_editable3">Some text.</p>
9 </div>
10 <div contentEditable="true">
11 <p id="richly_editable4">Some text.</p>
12 </div>
13 <div style="display: none;" aria-hidden="false">
14 <p id="richly_editable5" contentEditable>Some text.</p>
15 </div>
16 <canvas id="empty_canvas" width="200" height="100"
17 style="border: 1px solid #000000;">
18 <div id="richly_editable6" contentEditable="true">Some text.</div>
19 </canvas>
20 <iframe id="richly_editable7"
21 src="data:text/html,<html><body><p>Some text.</p></body></html>">
22 </iframe>
24 <!-- Non-richly editable elements. -->
25 <input id="non_richly_editable1" type="text" value="Some text.">
26 <textarea id="non_richly_editable2">
27 Some text.</textarea>
28 <div id="non_richly_editable3" contentEditable="plaintext-only"></div>
29 <div id="non_richly_editable4" contentEditable style="-webkit-user-modify: read-only;"></div>
30 <div contentEditable="plaintext-only">
31 <p id="non_richly_editable5">Some text.</p>
32 </div>
33 <p id="non_richly_editable6" tabindex="0">Some text.</p>
34 <button id="non_richly_editable7">Button</button>
36 <script>
37 description("This tests that only elements that allow the user to edit rich text in them are recognized as being richly editable.");
39 var iframeId = "richly_editable7";
40 var iframe = document.getElementById(iframeId);
41 window.axElement = undefined; // Needs to be globally declared for test expectations to work.
42 iframe.onload = function()
44 var iframeDocument = iframe.contentDocument;
45 iframeDocument.designMode = "on";
47 if (window.accessibilityController) {
49 for (var i = 1; i <= 7; ++i) {
50 var elementId = "richly_editable" + i;
51 var element = document.getElementById(elementId);
52 element.focus();
53 window.axElement = accessibilityController.focusedElement;
54 shouldBeTrue("axElement.isRichlyEditable");
57 // Both the iframe itself (tested above) and its body should be richly editable.
58 iframeDocument.body.focus();
59 window.axElement = accessibilityController.focusedElement;
60 shouldBeTrue("axElement.isRichlyEditable");
63 for (var i = 1; i <= 7; ++i) {
64 var elementId = "non_richly_editable" + i;
65 var element = document.getElementById(elementId);
66 element.focus();
67 window.axElement = accessibilityController.focusedElement;
68 shouldBeFalse("axElement.isRichlyEditable");
73 </script>