Upstream version 10.39.225.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / LayoutTests / inspector / editor / text-editor-smart-braces.html
1 <html>
2 <head>
3 <script src="../../http/tests/inspector/inspector-test.js"></script>
4 <script src="editor-test.js"></script>
5 <script>
6
7 function test()
8 {
9     var textEditor = InspectorTest.createTestEditor();
10     textEditor.setMimeType("text/javascript");
11     textEditor.setReadOnly(false);
12     textEditor.element.focus();
13
14     function clearEditor()
15     {
16         textEditor.setText("");
17         textEditor.setSelection(WebInspector.TextRange.createFromLocation(0, 0));
18     }
19
20     InspectorTest.runTestSuite([
21         function testTypeBraceSequence(next)
22         {
23             clearEditor();
24             InspectorTest.typeIn(textEditor, "({[", onTypedIn);
25             function onTypedIn()
26             {
27                 InspectorTest.dumpTextWithSelection(textEditor);
28                 next();
29             }
30         },
31
32         function testBraceOverride(next)
33         {
34             clearEditor();
35             InspectorTest.typeIn(textEditor, "({[]})", onTypedIn);
36             function onTypedIn()
37             {
38                 InspectorTest.dumpTextWithSelection(textEditor);
39                 next();
40             }
41         },
42
43         function testQuotesToCloseStringLiterals(next)
44         {
45             textEditor.setText("'Hello");
46             textEditor.setSelection(WebInspector.TextRange.createFromLocation(0, 6));
47             InspectorTest.typeIn(textEditor, "\"'", onTypedIn);
48             function onTypedIn()
49             {
50                 InspectorTest.dumpTextWithSelection(textEditor);
51                 next();
52             }
53         }
54     ]);
55 }
56
57 </script>
58 </head>
59
60 <body onload="runTest();">
61 <p>
62 This test checks text editor smart braces functionality.
63 </p>
64
65 </body>
66 </html>