| 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}\n', |
| 27 'someText': 'someText\n', | 27 'someText': 'someText\n', |
| 28 '"\$"': '"\$"<DIAGNOSTIC>\n', | 28 '"\$"': '"\$<DIAGNOSTIC>"\n', |
| 29 '"\$\$"': '"\$\$<DIAGNOSTIC>"<DIAGNOSTIC>\n', | 29 '"\$\$"': '"\$<DIAGNOSTIC>\$<DIAGNOSTIC>"\n', |
| 30 '"\$\$4"': '"\$\$<DIAGNOSTIC>4<DIAGNOSTIC>"\n', | 30 '"\$\$4"': '"\$<DIAGNOSTIC>\$<DIAGNOSTIC>4"\n', |
| 31 '"\$\$4 "': '"\$\$<DIAGNOSTIC>4<DIAGNOSTIC> "\n', | 31 '"\$\$4 "': '"\$<DIAGNOSTIC>\$<DIAGNOSTIC>4 "\n', |
| 32 '1e': '1<DIAGNOSTIC>e\n', | 32 '1e': '1e<DIAGNOSTIC>\n', |
| 33 }; | 33 }; |
| 34 | 34 |
| 35 List<Node> queryDiagnosticNodes() { | 35 List<Node> queryDiagnosticNodes() { |
| 36 return mainEditorPane.querySelectorAll('a.diagnostic>span'); | 36 return mainEditorPane.querySelectorAll('a.diagnostic>span'); |
| 37 } | 37 } |
| 38 | 38 |
| 39 Future runTests() { | 39 Future runTests() { |
| 40 Iterator<String> keys = tests.keys.iterator; | 40 Iterator<String> keys = tests.keys.iterator; |
| 41 keys.moveNext(); | 41 keys.moveNext(); |
| 42 mainEditorPane.innerHtml = keys.current; | 42 mainEditorPane.innerHtml = keys.current; |
| (...skipping 28 matching lines...) Expand all Loading... |
| 71 mainEditorPane = new DivElement(); | 71 mainEditorPane = new DivElement(); |
| 72 document.body.append(mainEditorPane); | 72 document.body.append(mainEditorPane); |
| 73 observer = new MutationObserver(interaction.onMutation) | 73 observer = new MutationObserver(interaction.onMutation) |
| 74 ..observe( | 74 ..observe( |
| 75 mainEditorPane, childList: true, characterData: true, subtree: true); | 75 mainEditorPane, childList: true, characterData: true, subtree: true); |
| 76 | 76 |
| 77 mainEditorPane.innerHtml = "<span><p>//...</p>}</span>"; | 77 mainEditorPane.innerHtml = "<span><p>//...</p>}</span>"; |
| 78 | 78 |
| 79 asyncTest(runTests); | 79 asyncTest(runTests); |
| 80 } | 80 } |
| OLD | NEW |