Add more module scope related tests with code evaluation by string
[WebKit-https.git] / LayoutTests / js / dom / modules / module-scope-event-handler.html
1 <!DOCTYPE HTML>
2 <html>
3 <head>
4 <script src="../../../resources/js-test-pre.js"></script>
5 </head>
6 <body>
7 <div id="target"></div>
8 <div id="target2" onclick="window.visibleAtATime = cocoa; shouldBeEqualToString('visibleAtATime', 'Global Scope'); finishJSTest();"></div>
9 <script>
10 description("Test relationship between module scope and event handlers");
11
12 window.jsTestIsAsync = true;
13 debug("Module is not executed yet.");
14 window.cocoa = 'Global Scope'
15 window.visibleAtATime = null;
16 </script>
17 <script type="module">
18 var cocoa = 'Module Scope';
19 window.visibleAtATime = cocoa;
20 shouldBeEqualToString("visibleAtATime", "Module Scope");
21 var target = document.getElementById('target');
22 target.onclick = function () {
23     window.visibleAtATime = cocoa;
24     shouldBeEqualToString("visibleAtATime", "Module Scope");
25     var target2 = document.getElementById('target2');
26     target2.click();
27 };
28 target.click();
29 </script>
30 <script src="../../../resources/js-test-post.js"></script>
31 </body>
32 </html>