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

Side by Side Diff: third_party/WebKit/LayoutTests/http/tests/inspector-unit/soft-drop-down.js

Issue 2911363002: DevTools: Split SoftDropdown out of ConsoleContextSelector (Closed)
Patch Set: fixes Created 3 years, 6 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/http/tests/inspector-unit/soft-drop-down-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 var items = [
2 {
3 title: "first",
4 index: 0
5 },
6 {
7 title: "second",
8 index: 1
9 },
10 {
11 title: "third",
12 index: 2
13 },
14 {
15 title: "fourth",
16 index: 3
17 },
18 {
19 title: "disabled 4.5",
20 disabled: true,
21 index: 4
22 },
23 {
24 title: "fifth",
25 index: 5
26 },
27 {
28 title: "sixth",
29 index: 6
30 },
31 {
32 title: "seventh",
33 index: 7
34 },
35 {
36 title: "eighth",
37 index: 8
38 }
39 ];
40
41 class Delegate {
42 titleFor(item) {
43 return item.title;
44 }
45
46 createElementForItem(item) {
47 var element = createElement("div");
48 element.textContent = this.titleFor(item);
49 return element;
50 }
51
52 isItemSelectable(item) {
53 return !item.disabled;
54 }
55
56 itemSelected(item) {
57 if (item !== null)
58 TestRunner.addResult("Item selected: " + this.titleFor(item));
59 }
60
61 highlightedItemChanged(from, to, fromElement, toElement) {
62 if (to !== null)
63 TestRunner.addResult("Item highlighted: " + this.titleFor(to));
64 }
65 };
66
67 function pressKey(key) {
68 var element = document.deepActiveElement();
69 if (!element)
70 return;
71 TestRunner.addResult(key);
72 element.dispatchEvent(TestRunner.createKeyEvent(key));
73 }
74 var model = new UI.ListModel();
75 var dropDown = new UI.SoftDropDown(model, new Delegate());
76 for (var i = items.length - 1; i >= 0; i--)
77 model.insertWithComparator(items[i], (a, b) => a.index - b.index);
78
79 UI.inspectorView.element.appendChild(dropDown.element);
80 dropDown.selectItem(items[5]);
81 TestRunner.addResult("Showing drop down");
82 dropDown.element.dispatchEvent(new Event("mousedown"));
83 pressKey('ArrowDown');
84 pressKey('ArrowDown');
85 pressKey('ArrowDown');
86 pressKey('ArrowUp');
87 pressKey('ArrowUp');
88 pressKey('ArrowUp');
89 pressKey('ArrowDown');
90 pressKey('ArrowDown');
91 pressKey('f');
92 pressKey('f');
93 pressKey('t');
94 TestRunner.completeTest();
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/http/tests/inspector-unit/soft-drop-down-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698