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

Side by Side Diff: LayoutTests/fast/dom/HTMLElement/script-tests/contextmenu.js

Issue 243403006: Implement contextmenu attribute with basic support of <menu> (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Reflect HTMLMenuElement as per spec Created 6 years, 4 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
OLDNEW
(Empty)
1 description('Tests the contextmenu attribute.');
2
3 debug("Test with valid contextmenu attribute");
4 document.write("<div id='container1' contextmenu='menu1'><menu id='menu1' type=' popup' label='menu 1'></menu></div>");
5 shouldBe("document.getElementById('container1').contextMenu.id", "'menu1'");
6 shouldBe("document.getElementById('container1').contextMenu.type", "'popup'");
7 shouldBe("document.getElementById('container1').contextMenu.label", "'menu 1'");
8
9 debug("Test with invalid contextmenu attribute");
10 document.write("<div id='container2' contextmenu='nonexistent_menu'><menu id='me nu2' type='popup' label='menu 2'></menu></div>");
11 shouldBe("document.getElementById('container2').contextMenu", "null");
12
13 debug("Test setting contextmenu attribute");
14 document.write("<div id='container3'></div>");
15 var menu = document.createElement('menu');
16 menu.id = 'menu3';
17 menu.type = 'popup';
18 menu.label = 'menu 3';
19 document.getElementById('container3').appendChild(menu);
20 var container3 = document.getElementById('container3');
21 container3.contextMenu = menu;
22 shouldBe("container3.contextMenu.id", "'menu3'");
23 shouldBe("container3.contextMenu.type", "'popup'");
24 shouldBe("container3.contextMenu.label", "'menu 3'");
25
26 debug("Test setting contextmenu attribute with menu element without id");
27 document.write("<div id='container4'></div>");
28 var menu1 = document.createElement('menu');
29 menu1.type = 'popup';
30 menu1.label = 'menu 4';
31 document.getElementById('container4').appendChild(menu1);
32 var container4 = document.getElementById('container4');
33 container4.contextMenu = menu1;
34 shouldBe("container4.contextMenu", "null");
35
36 debug("Test setting contextmenu attribute with multiple menu element with same i d");
37 document.write("<div id='container5'></div>");
38 var menu2 = document.createElement('menu');
39 menu2.id = 'menu5';
40 menu2.type = 'popup';
41 menu2.label = 'menu 5';
42 var menu3 = document.createElement('menu');
43 menu3.id = 'menu5';
44 menu3.type = 'popup';
45 menu3.label = 'menu 6';
46 document.getElementById('container5').appendChild(menu2);
47 document.getElementById('container5').appendChild(menu3);
48 var container5 = document.getElementById('container5');
49 container5.contextMenu = menu2;
50 shouldBe("container5.contextMenu.id", "'menu5'");
51 shouldBe("container5.contextMenu.type", "'popup'");
52 shouldBe("container5.contextMenu.label", "'menu 5'");
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698