Skip to content

Commit

Permalink
FIXED: Compatibility of remove tests with new JSRobot.
Browse files Browse the repository at this point in the history
  • Loading branch information
Adrian Sutton committed Nov 22, 2010
1 parent 4216188 commit 4321396
Showing 1 changed file with 15 additions and 12 deletions.
27 changes: 15 additions & 12 deletions tests/remove.html
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
editor.execCommand('undo', false, null); editor.execCommand('undo', false, null);
equals(editor.getContent(), originalContent, 'Undo deletion'); equals(editor.getContent(), originalContent, 'Undo deletion');
QUnit.start(); QUnit.start();
}); }, editor.selection.getNode());
}); });


// oncut is not supported by FireFox 2.0 so this is impossible to fix there. // oncut is not supported by FireFox 2.0 so this is impossible to fix there.
Expand All @@ -42,15 +42,18 @@
editor.focus(); editor.focus();
setSelection('p:nth-child(1)', 4, 'p:nth-child(2)', 4); setSelection('p:nth-child(1)', 4, 'p:nth-child(2)', 4);
robot.cut(function() { robot.cut(function() {
equals(editor.getContent(), "<p>Line2</p>", 'Cut text'); // The fix for this bug happens in a timeout after cut so we need to make sure that happens first by adding an additional delay.
editor.execCommand('undo', false, null); setTimeout(function() {
equals(editor.getContent(), originalContent, 'Undo cut'); equals(editor.getContent(), "<p>Line2</p>", 'Cut text');
editor.execCommand('SelectAll'); editor.execCommand('undo', false, null);
robot.paste(function() { equals(editor.getContent(), originalContent, 'Undo cut');
ok(/Line/.test(editor.getContent()), 'Content should have been on clipboard. Got: ' + editor.getContent()); editor.execCommand('SelectAll');
QUnit.start(); robot.paste(function() {
}); ok(/Line/.test(editor.getContent()), 'Content should have been on clipboard. Got: ' + editor.getContent());
}); QUnit.start();
}, editor.selection.getNode());
}, 100);
}, editor.selection.getNode());
}); });
} else { } else {
test('Skipped on FireFox 2.x: Cut with indented text', function() {}); test('Skipped on FireFox 2.x: Cut with indented text', function() {});
Expand All @@ -69,7 +72,7 @@
editor.execCommand('undo', false, null); editor.execCommand('undo', false, null);
equals(editor.getContent(), originalContent, 'Undo deletion'); equals(editor.getContent(), originalContent, 'Undo deletion');
QUnit.start(); QUnit.start();
}); }, editor.selection.getNode());
}); });


asyncTest('Forward delete with first paragraph indented', function() { asyncTest('Forward delete with first paragraph indented', function() {
Expand All @@ -83,7 +86,7 @@
robot.forwardDelete(function() { robot.forwardDelete(function() {
equals(editor.getContent(), '<p style="margin-left: 30px;">Line2</p>', 'Delete content'); equals(editor.getContent(), '<p style="margin-left: 30px;">Line2</p>', 'Delete content');
QUnit.start(); QUnit.start();
}); }, editor.selection.getNode());
}); });


tinyMCE.init({ tinyMCE.init({
Expand Down

0 comments on commit 4321396

Please sign in to comment.