Index: tests/try/web/cursor_position_test.dart |
=================================================================== |
--- tests/try/web/cursor_position_test.dart (revision 39473) |
+++ tests/try/web/cursor_position_test.dart (working copy) |
@@ -13,9 +13,18 @@ |
new TestCase('Test adding two lines programmatically.', () { |
clearEditorPaneWithoutNotifications(); |
mainEditorPane.appendText('\n\n'); |
- Text text = mainEditorPane.firstChild; |
- window.getSelection().collapse(text, 1); |
- checkSelectionIsCollapsed(text, 1); |
+ var textOrBr = mainEditorPane.firstChild; |
+ if (textOrBr is Text) { |
+ window.getSelection().collapse(textOrBr, 1); |
+ checkSelectionIsCollapsed(textOrBr, 1); |
+ } else { |
+ // This else-branch accomodates IE11, which |
+ // puts <BR> instead of '\n' in content-editable Divs. |
+ var range = document.createRange()..selectNode(textOrBr); |
+ (window.getSelection())..addRange(range) |
+ ..collapseToEnd(); |
+ checkSelectionIsCollapsed(mainEditorPane, 1); |
+ } |
}, checkAtBeginningOfSecondLine); |
runTests(<TestCase>[ |