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