Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(251)

Side by Side Diff: third_party/WebKit/LayoutTests/inspector/elements/accessibility/autocomplete-attribute.html

Issue 2200893003: DevTools: Add autocomplete for ARIA (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: skip_compilation Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/inspector/elements/accessibility/autocomplete-attribute-expected.txt » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 <html>
2 <head>
3 <script src="../../../http/tests/inspector/inspector-test.js"></script>
4 <script src="../../../http/tests/inspector/elements-test.js"></script>
5 <script src="accessibility-pane-test.js"></script>
6 <script>
7
8 function test()
9 {
10 WebInspector.viewManager.showView("accessibility.view")
11 .then(() => InspectorTest.selectNodeAndWaitForAccessibility("inspected") )
12 .then(runTests);
13
14 function getPromptForAttribute(attribute)
15 {
16 var treeElement = InspectorTest.findARIAAttributeTreeElement(attribute);
17 treeElement._startEditing();
18 return treeElement._prompt;
19 }
20
21 function runTests()
22 {
23 InspectorTest.runTestSuite([
24 function testCheckedEmptyValue(next)
25 {
26 var prompt = getPromptForAttribute("aria-checked");
27 testAgainstGolden(prompt, "", ["true", "false", "mixed"], next);
28 },
29
30 function testCheckedFirstCharacter(next)
31 {
32 var prompt = getPromptForAttribute("aria-checked");
33 testAgainstGolden(prompt, "t", ["true"], next);
34 },
35
36 function testRoleFirstCharacter(next)
37 {
38 var prompt = getPromptForAttribute("role");
39 testAgainstGolden(prompt, "b", ["banner", "button"], next);
40 }
41 ]);
42 }
43
44 function testAgainstGolden(prompt, inputText, golden, callback)
45 {
46 var proxyElement = document.createElement("div");
47 document.body.appendChild(proxyElement);
48 proxyElement.style = "webkit-user-select: text; -webkit-user-modify: rea d-write-plaintext-only";
49 proxyElement.textContent = inputText;
50 var selectionRange = document.createRange();
51 var textNode = proxyElement.childNodes[0];
52 if (textNode) {
53 selectionRange.setStart(textNode, inputText.length);
54 selectionRange.setEnd(textNode, inputText.length);
55 } else {
56 selectionRange.selectNodeContents(proxyElement);
57 }
58 var range = selectionRange.startContainer.rangeOfWord(selectionRange.sta rtOffset, prompt._completionStopCharacters, proxyElement, "backward");
59 prompt._buildPropertyCompletions(proxyElement, range, true, completions) ;
60
61 function completions(result, index)
62 {
63 var i;
64 for (i = 0; i < golden.length; ++i) {
65 if (result.indexOf(golden[i]) === -1)
66 InspectorTest.addResult("NOT FOUND: " + golden[i]);
67 }
68 proxyElement.remove();
69 callback();
70 }
71 }
72 }
73 </script>
74 </head>
75
76 <body onload="runTest()">
77 <p>
78 Tests that autocompletions are computed correctly when editing the ARIA pane.
79 </p>
80 <span id="inspected" aria-checked="true" role="checkbox"></span>
81 </body>
82 </html>
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/inspector/elements/accessibility/autocomplete-attribute-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698