OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 // SharedOptions=--package-root=sdk/lib/_internal/ | 5 // SharedOptions=--package-root=sdk/lib/_internal/ |
6 | 6 |
7 library trydart.paste_test; | 7 library trydart.paste_test; |
8 | 8 |
9 import 'dart:html'; | 9 import 'dart:html'; |
10 import 'dart:async'; | 10 import 'dart:async'; |
11 | 11 |
12 import '../../site/try/src/interaction_manager.dart' show | 12 import '../../site/try/src/interaction_manager.dart' show |
13 InteractionManager; | 13 InteractionManager; |
14 | 14 |
15 import '../../site/try/src/ui.dart' show | 15 import '../../site/try/src/ui.dart' show |
16 mainEditorPane, | 16 mainEditorPane, |
17 observer; | 17 observer; |
18 | 18 |
19 import '../../site/try/src/user_option.dart' show | 19 import '../../site/try/src/user_option.dart' show |
20 UserOption; | 20 UserOption; |
21 | 21 |
22 import '../../pkg/expect/lib/expect.dart'; | 22 import '../../pkg/expect/lib/expect.dart'; |
23 import '../../pkg/async_helper/lib/async_helper.dart'; | 23 import '../../pkg/async_helper/lib/async_helper.dart'; |
24 | 24 |
25 const Map<String, String> tests = const <String, String> { | 25 const Map<String, String> tests = const <String, String> { |
26 '<span><p>//...</p>}</span>': '//...\n}\n', | 26 '<span><p>//...</p>}</span>': '//...\n}', |
27 'someText': 'someText\n', | 27 'someText': 'someText', |
28 '"\$"': '"<DIAGNOSTIC>\$</DIAGNOSTIC>"\n', | 28 '"\$"': '"<DIAGNOSTIC>\$</DIAGNOSTIC>"', |
29 '"\$\$"': '"<DIAGNOSTIC>\$</DIAGNOSTIC><DIAGNOSTIC>\$</DIAGNOSTIC>"\n', | 29 '"\$\$"': '"<DIAGNOSTIC>\$</DIAGNOSTIC><DIAGNOSTIC>\$</DIAGNOSTIC>"', |
30 '"\$\$4"': '"<DIAGNOSTIC>\$</DIAGNOSTIC><DIAGNOSTIC>\$</DIAGNOSTIC>4"\n', | 30 '"\$\$4"': '"<DIAGNOSTIC>\$</DIAGNOSTIC><DIAGNOSTIC>\$</DIAGNOSTIC>4"', |
31 '"\$\$4 "': '"<DIAGNOSTIC>\$</DIAGNOSTIC><DIAGNOSTIC>\$</DIAGNOSTIC>4 "\n', | 31 '"\$\$4 "': '"<DIAGNOSTIC>\$</DIAGNOSTIC><DIAGNOSTIC>\$</DIAGNOSTIC>4 "', |
32 '1e': '<DIAGNOSTIC>1e</DIAGNOSTIC>\n', | 32 '1e': '<DIAGNOSTIC>1e</DIAGNOSTIC>', |
| 33 'r"""\n\n\'"""': 'r"""\n\n\'"""', |
| 34 '"': '<DIAGNOSTIC>"</DIAGNOSTIC>', |
| 35 '/**\n*/': '/**\n*/', |
33 }; | 36 }; |
34 | 37 |
35 List<Node> queryDiagnosticNodes() { | 38 List<Node> queryDiagnosticNodes() { |
36 return mainEditorPane.querySelectorAll('a.diagnostic>span'); | 39 return mainEditorPane.querySelectorAll('a.diagnostic>span'); |
37 } | 40 } |
38 | 41 |
39 Future runTests() { | 42 Future runTests() { |
40 Iterator<String> keys = tests.keys.iterator; | 43 Iterator<String> keys = tests.keys.iterator; |
41 keys.moveNext(); | 44 keys.moveNext(); |
42 mainEditorPane.innerHtml = keys.current; | 45 mainEditorPane.innerHtml = keys.current; |
(...skipping 26 matching lines...) Expand all Loading... |
69 void main() { | 72 void main() { |
70 UserOption.storage = {}; | 73 UserOption.storage = {}; |
71 | 74 |
72 var interaction = new InteractionManager(); | 75 var interaction = new InteractionManager(); |
73 mainEditorPane = new DivElement(); | 76 mainEditorPane = new DivElement(); |
74 document.body.append(mainEditorPane); | 77 document.body.append(mainEditorPane); |
75 observer = new MutationObserver(interaction.onMutation) | 78 observer = new MutationObserver(interaction.onMutation) |
76 ..observe( | 79 ..observe( |
77 mainEditorPane, childList: true, characterData: true, subtree: true); | 80 mainEditorPane, childList: true, characterData: true, subtree: true); |
78 | 81 |
79 mainEditorPane.innerHtml = "<span><p>//...</p>}</span>"; | |
80 | |
81 asyncTest(runTests); | 82 asyncTest(runTests); |
82 } | 83 } |
OLD | NEW |