| OLD | NEW |
| (Empty) | |
| 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 |
| 3 // BSD-style license that can be found in the LICENSE file. |
| 4 |
| 5 import 'dart:html' show |
| 6 DivElement, |
| 7 MutationObserver, |
| 8 document; |
| 9 |
| 10 import '../../site/try/src/interaction_manager.dart' show |
| 11 InteractionManager; |
| 12 |
| 13 import '../../site/try/src/ui.dart' show |
| 14 hackDiv, |
| 15 mainEditorPane, |
| 16 observer; |
| 17 |
| 18 import '../../site/try/src/user_option.dart' show |
| 19 UserOption; |
| 20 |
| 21 InteractionManager mockTryDartInteraction() { |
| 22 UserOption.storage = {}; |
| 23 |
| 24 InteractionManager interaction = new InteractionManager(); |
| 25 |
| 26 hackDiv = new DivElement(); |
| 27 mainEditorPane = new DivElement() |
| 28 ..style.whiteSpace = 'pre' |
| 29 ..contentEditable = 'true'; |
| 30 |
| 31 observer = new MutationObserver(interaction.onMutation); |
| 32 observer.observe( |
| 33 mainEditorPane, childList: true, characterData: true, subtree: true); |
| 34 |
| 35 document.body.nodes.addAll([mainEditorPane, hackDiv]); |
| 36 |
| 37 return interaction; |
| 38 } |
| 39 |
| 40 void clearEditorPaneWithoutNotifications() { |
| 41 mainEditorPane.nodes.clear(); |
| 42 observer.takeRecords(); |
| 43 } |
| OLD | NEW |