Chromium Code Reviews| 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 library trydart.paste_test; | 5 library trydart.paste_test; |
| 6 | 6 |
| 7 import 'dart:html'; | 7 import 'dart:html'; |
| 8 import 'dart:async'; | 8 import 'dart:async'; |
| 9 | 9 |
| 10 import 'package:try/src/interaction_manager.dart' show | 10 import 'package:try/src/interaction_manager.dart' show |
| (...skipping 28 matching lines...) Expand all Loading... | |
| 39 | 39 |
| 40 Future runTests() { | 40 Future runTests() { |
| 41 Iterator<String> keys = tests.keys.iterator; | 41 Iterator<String> keys = tests.keys.iterator; |
| 42 keys.moveNext(); | 42 keys.moveNext(); |
| 43 mainEditorPane.innerHtml = keys.current; | 43 mainEditorPane.innerHtml = keys.current; |
| 44 | 44 |
| 45 Future makeFuture() => new Future(() { | 45 Future makeFuture() => new Future(() { |
| 46 String key = keys.current; | 46 String key = keys.current; |
| 47 print('Checking $key'); | 47 print('Checking $key'); |
| 48 queryDiagnosticNodes().forEach((Node node) { | 48 queryDiagnosticNodes().forEach((Node node) { |
| 49 node.parent.insertBefore( | 49 node.parent.append(new Text('</DIAGNOSTIC>')); |
| 50 new Text('<DIAGNOSTIC>'), node.parent.firstChild); | 50 node.replaceWith(new Text('<DIAGNOSTIC>')); |
|
ahe
2014/07/04 13:52:00
This code replaces diagnostics with <DIAGNOSTIC>..
| |
| 51 node.replaceWith(new Text('</DIAGNOSTIC>')); | |
| 52 observer.takeRecords(); // Discard mutations. | 51 observer.takeRecords(); // Discard mutations. |
| 53 }); | 52 }); |
| 54 Expect.stringEquals(tests[key], mainEditorPane.text); | 53 Expect.stringEquals(tests[key], mainEditorPane.text); |
| 55 if (keys.moveNext()) { | 54 if (keys.moveNext()) { |
| 56 key = keys.current; | 55 key = keys.current; |
| 57 print('Setting $key'); | 56 print('Setting $key'); |
| 58 mainEditorPane.innerHtml = key; | 57 mainEditorPane.innerHtml = key; |
| 59 return makeFuture(); | 58 return makeFuture(); |
| 60 } else { | 59 } else { |
| 61 // Clear the DOM to work around a bug in test.dart. | 60 // Clear the DOM to work around a bug in test.dart. |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 72 | 71 |
| 73 var interaction = new InteractionManager(); | 72 var interaction = new InteractionManager(); |
| 74 mainEditorPane = new DivElement(); | 73 mainEditorPane = new DivElement(); |
| 75 document.body.append(mainEditorPane); | 74 document.body.append(mainEditorPane); |
| 76 observer = new MutationObserver(interaction.onMutation) | 75 observer = new MutationObserver(interaction.onMutation) |
| 77 ..observe( | 76 ..observe( |
| 78 mainEditorPane, childList: true, characterData: true, subtree: true); | 77 mainEditorPane, childList: true, characterData: true, subtree: true); |
| 79 | 78 |
| 80 asyncTest(runTests); | 79 asyncTest(runTests); |
| 81 } | 80 } |
| OLD | NEW |