Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(558)

Unified Diff: tests/try/web/cursor_position_test.dart

Issue 494253002: Fix Try Dart newline handling on IE11. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« site/try/src/interaction_manager.dart ('K') | « tests/try/try.status ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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>[
« site/try/src/interaction_manager.dart ('K') | « tests/try/try.status ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698