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

Unified Diff: LayoutTests/editing/deleting/delete-br-001.html

Issue 18884002: Make editing/deleting/delete-br-00[1-7].html platform independent (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 5 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
« no previous file with comments | « no previous file | LayoutTests/editing/deleting/delete-br-001-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: LayoutTests/editing/deleting/delete-br-001.html
diff --git a/LayoutTests/editing/deleting/delete-br-001.html b/LayoutTests/editing/deleting/delete-br-001.html
index f29d5aa70e96cb54b4e88c50ff3a9c9a462f024b..a5cd2a3c1e34d4796cc0c23e9a48317e4cecfc98 100644
--- a/LayoutTests/editing/deleting/delete-br-001.html
+++ b/LayoutTests/editing/deleting/delete-br-001.html
@@ -1,37 +1,38 @@
-<html>
-<head>
-
-<style>
-.editing {
- border: 2px solid red;
- padding: 12px;
- font-size: 24px;
-}
-</style>
-<script src=../editing.js language="JavaScript" type="text/JavaScript" ></script>
-
+<body>
+<div id="container">
+<div contenteditable="true" id="work"></div>
+</div>
+</div>
+<script src="../../fast/js/resources/js-test-pre.js"></script>
<script>
+function $(id) { return document.getElementById(id); }
-function editingTest() {
- for (i = 0; i < 21; i++) {
- moveSelectionForwardByCharacterCommand();
- }
- deleteCommand();
+var sampleHTML = 'abc<br id="a"><br id="b"><br id="c">def';
+var selection = window.getSelection();
+function testIt(nth, numberOfDeletes, expectedOffset, expectedHTML) {
+ $('work').innerHTML = sampleHTML;
+ var range = document.createRange();
+ range.setStartAfter($('work').querySelectorAll('br')[nth]);
+ selection.removeAllRanges();
+ selection.addRange(range);
+ for (var i = 0; i < numberOfDeletes; ++i)
+ document.execCommand('Delete');
+ shouldBeEqualToString('$("work").innerHTML', expectedHTML);
+ shouldBeEqualToString('selection.type', 'Caret');
+ shouldBe('selection.anchorOffset', expectedOffset + '');
}
-</script>
-
-<title>Editing Test</title>
-</head>
-<body>
-<div contenteditable id="root" class="editing">
-<span id="test">Fourscore
-and seven <br>years ago</span>
-</div>
+testIt(0, 1, 3, 'abc<br id="b"><br id="c">def');
+testIt(1, 1, 2, 'abc<br id="a"><br>def');
+testIt(2, 1, 0, 'abc<br id="a"><br id="b">def');
+testIt(1, 2, 3, 'abc<br>def');
+testIt(2, 2, 0, 'abc<br id="a">def');
+testIt(2, 3, 3, 'abcdef');
-<script>
-runEditingTest();
+if (window.testRunner)
+ $('container').outerHTML = '';
+else
+ $('work').innerHTML = sampleHTML;
</script>
-
+<script src="../../fast/js/resources/js-test-post.js"></script>
</body>
-</html>
« no previous file with comments | « no previous file | LayoutTests/editing/deleting/delete-br-001-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698