Initialize Tizen 2.3
[framework/web/webkit-efl.git] / LayoutTests / java / focus.html
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <meta charset="utf-8">
5 <script src="../fast/js/resources/js-test-pre.js"></script>
6 <script>
7 if (window.testRunner)
8     testRunner.overridePreference("WebKitJavaEnabled", "1");
9 </script>
10 </head>
11 <body>
12 <p>Test for <a href="https://bugs.webkit.org/show_bug.cgi?id=32292">bug 32292</a>:
13 "Unable to focus on embedded plugins such as Flash via javascript focus()"</p>
14 <p>This tests focusing Applets. See LayoutTests/plugins for Embed and Object elements.</p>
15 <div id=appletOwner>
16
17 <applet id="appletElem" width=150 height=25 code="SharedApplet.class" name="javaTest" shouldFocus=true></applet>
18
19 <applet id="appletElemWithFallbackContents" width=150 height=25 code="SharedApplet.class" name="javaTest" shouldFocus=true>Fallback Contents.</applet>
20
21 <applet id="noCodeAppletElem" width=150 height=25 code="DoesNotExist.class" shouldFocus=false></applet>
22
23 <applet id="noCodeAppletElemWithFallbackContents" width=150 height=25 code="DoesNotExist.class" shouldFocus=false>Fallback contents.</applet>
24
25 <applet id="noCodeAppletElemWithTabindex" width=150 height=25 code="DoesNotExist.class" tabindex=-1 shouldFocus=true></applet>
26
27 <applet id="noCodeAppletElemWithContenteditable" width=150 height=25 code="DoesNotExist.class" shouldFocus=true></applet>
28
29 </div>
30 <script>
31
32 description("Test for Applet for bug 32292: Unable to focus on embedded plugins such as Flash via javascript focus().");
33
34 function RunTest() {
35     var owner = document.getElementById("appletOwner");
36     for (var i = 0; i < owner.childNodes.length; ++i) {
37         pluginElement = owner.childNodes[i];
38         if (pluginElement.id) {
39             pluginElement.focus();
40             shouldBe('"' + pluginElement.id + '"; document.activeElement === pluginElement',
41                 pluginElement.getAttribute("shouldFocus").toString());
42             pluginElement.blur();
43         }
44     }
45 }
46
47 document.addEventListener("DOMContentLoaded", RunTest, false);
48
49 </script>
50 <script src="../fast/js/resources/js-test-post.js"></script>
51 </body>
52 </html>