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

Side by Side Diff: LayoutTests/fast/dom/HTMLMenuElement/custom-context-menu.html

Issue 721603002: If an element A has a parent element, then A's assigned context menu is the assigned context menu o… (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fixed nits Created 6 years, 1 month 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
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <head> 2 <head>
3 <script src="../../../resources/js-test.js"></script> 3 <script src="../../../resources/js-test.js"></script>
4 </head> 4 </head>
5 <button id="button" style="height: 100px; width: 100px;"> 5 <button id="button" style="height: 100px; width: 100px;">
6 </button> 6 </button>
7 <button id="button_with_contextmenu" contextmenu="menu_id" style="height: 100px; width: 100px;"> 7 <button id="button_with_contextmenu" contextmenu="menu_id" style="height: 100px; width: 100px;">
8 <menu id="menu_id" type="PopUp"> 8 <menu id="menu_id" type="PopUp">
9 <!-- Test removal of separator at the start. --> 9 <!-- Test removal of separator at the start. -->
10 <hr> 10 <hr>
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 <menuitem label="Item1"></menuitem> 74 <menuitem label="Item1"></menuitem>
75 <menuitem label="Item2"></menuitem> 75 <menuitem label="Item2"></menuitem>
76 <menuitem label="Item3"></menuitem> 76 <menuitem label="Item3"></menuitem>
77 </menu> 77 </menu>
78 </button> 78 </button>
79 <!-- Test with menu element without any children. --> 79 <!-- Test with menu element without any children. -->
80 <button id="button_4" contextmenu="menu_4" style="height: 100px; width: 100px;"> 80 <button id="button_4" contextmenu="menu_4" style="height: 100px; width: 100px;">
81 <menu id="menu_4" type="popup"> 81 <menu id="menu_4" type="popup">
82 </menu> 82 </menu>
83 </button> 83 </button>
84 <!-- Test if an element A has a parent element, then A's assigned context menu i s the assigned context menu of its parent element. -->
85 <div contextmenu="menu_5">
86 <div>
87 <button id="button_5" style="height: 100px; width: 100px;"></button>
88 </div>
89 <menu id="menu_5" type="popup">
90 <menuitem label="Item1">
91 <menuitem label="Item2">
92 <menuitem label="Item3">
93 </menu>
94 </div>
84 <script> 95 <script>
85 if (!window.eventSender) 96 if (!window.eventSender)
86 debug("This test requires window.eventSender.") 97 debug("This test requires window.eventSender.")
87 98
88 function contextClickAndGetMenuItems(element) { 99 function contextClickAndGetMenuItems(element) {
89 var x = element.offsetParent.offsetLeft + element.offsetLeft + 4; 100 var x = element.offsetParent.offsetLeft + element.offsetLeft + 4;
90 var y = element.offsetParent.offsetTop + element.offsetTop + element.offsetH eight / 2; 101 var y = element.offsetParent.offsetTop + element.offsetTop + element.offsetH eight / 2;
91 eventSender.mouseMoveTo(x, y); 102 eventSender.mouseMoveTo(x, y);
92 return eventSender.contextClick(); 103 return eventSender.contextClick();
93 } 104 }
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 var button3 = document.getElementById("button_3"); 140 var button3 = document.getElementById("button_3");
130 document.getElementById("menu_3").addEventListener("show", removeMenu, false); 141 document.getElementById("menu_3").addEventListener("show", removeMenu, false);
131 var items3 = contextClickAndGetMenuItems(button3); 142 var items3 = contextClickAndGetMenuItems(button3);
132 143
133 // Esc key to hide the context menu. 144 // Esc key to hide the context menu.
134 eventSender.keyDown("escape"); 145 eventSender.keyDown("escape");
135 146
136 var button4 = document.getElementById("button_4"); 147 var button4 = document.getElementById("button_4");
137 var items4 = contextClickAndGetMenuItems(button4); 148 var items4 = contextClickAndGetMenuItems(button4);
138 149
150 // Esc key to hide the context menu.
151 eventSender.keyDown("escape");
152
153 var button5 = document.getElementById("button_5");
154 var items5 = contextClickAndGetMenuItems(button5);
155
139 shouldBeEqualToNumber("itemsWithCustomContextMenu.length - items.length", 17); 156 shouldBeEqualToNumber("itemsWithCustomContextMenu.length - items.length", 17);
140 shouldBeEqualToString("itemsWithCustomContextMenu[0]", "Item1"); 157 shouldBeEqualToString("itemsWithCustomContextMenu[0]", "Item1");
141 shouldBeEqualToString("itemsWithCustomContextMenu[1]", "Item2"); 158 shouldBeEqualToString("itemsWithCustomContextMenu[1]", "Item2");
142 shouldBeEqualToString("itemsWithCustomContextMenu[2]", "---------"); 159 shouldBeEqualToString("itemsWithCustomContextMenu[2]", "---------");
143 shouldBeEqualToString("itemsWithCustomContextMenu[3]", "Item3"); 160 shouldBeEqualToString("itemsWithCustomContextMenu[3]", "Item3");
144 shouldBeEqualToString("itemsWithCustomContextMenu[4]", "Submenu >"); 161 shouldBeEqualToString("itemsWithCustomContextMenu[4]", "Submenu >");
145 shouldBeEqualToString("itemsWithCustomContextMenu[5]", "_Item4"); 162 shouldBeEqualToString("itemsWithCustomContextMenu[5]", "_Item4");
146 shouldBeEqualToString("itemsWithCustomContextMenu[6]", "_Deeper submenu >"); 163 shouldBeEqualToString("itemsWithCustomContextMenu[6]", "_Deeper submenu >");
147 shouldBeEqualToString("itemsWithCustomContextMenu[7]", "__Item5"); 164 shouldBeEqualToString("itemsWithCustomContextMenu[7]", "__Item5");
148 shouldBeEqualToString("itemsWithCustomContextMenu[8]", "__---------"); 165 shouldBeEqualToString("itemsWithCustomContextMenu[8]", "__---------");
149 shouldBeEqualToString("itemsWithCustomContextMenu[9]", "__Item6"); 166 shouldBeEqualToString("itemsWithCustomContextMenu[9]", "__Item6");
150 shouldBeEqualToString("itemsWithCustomContextMenu[10]", "Item7"); 167 shouldBeEqualToString("itemsWithCustomContextMenu[10]", "Item7");
151 shouldBeEqualToString("itemsWithCustomContextMenu[11]", "---------"); 168 shouldBeEqualToString("itemsWithCustomContextMenu[11]", "---------");
152 shouldBeEqualToString("itemsWithCustomContextMenu[12]", "Item8"); 169 shouldBeEqualToString("itemsWithCustomContextMenu[12]", "Item8");
153 shouldBeEqualToString("itemsWithCustomContextMenu[13]", "Item11"); 170 shouldBeEqualToString("itemsWithCustomContextMenu[13]", "Item11");
154 shouldBeEqualToString("itemsWithCustomContextMenu[14]", "Item12"); 171 shouldBeEqualToString("itemsWithCustomContextMenu[14]", "Item12");
155 shouldBeEqualToString("itemsWithCustomContextMenu[15]", "---------"); 172 shouldBeEqualToString("itemsWithCustomContextMenu[15]", "---------");
156 shouldBeEqualToString("itemsWithCustomContextMenu[16]", "Item13"); 173 shouldBeEqualToString("itemsWithCustomContextMenu[16]", "Item13");
157 shouldBeEqualToNumber("items1.length - items.length", 0); 174 shouldBeEqualToNumber("items1.length - items.length", 0);
158 shouldBeEqualToNumber("items2.length - items.length", 0); 175 shouldBeEqualToNumber("items2.length - items.length", 0);
159 shouldBeEqualToNumber("items3.length - items.length", 0); 176 shouldBeEqualToNumber("items3.length - items.length", 0);
160 shouldBeEqualToNumber("items4.length - items.length", 0); 177 shouldBeEqualToNumber("items4.length - items.length", 0);
178 shouldBeEqualToNumber("items5.length - items.length", 3);
179 shouldBeEqualToString("items5[0]", "Item1");
180 shouldBeEqualToString("items5[1]", "Item2");
181 shouldBeEqualToString("items5[2]", "Item3");
161 182
162 </script> 183 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698