function doTest() { var t1 = $("t1"); var editor = SpecialPowers.wrap(t1).editor;
ok(editor, "able to get editor for the element");
t1.focus();
t1.select();
try {
// Cut the initial text in the textbox
ok(editor.canCut(), "can cut text");
editor.cut();
is(t1.value, "", "initial text was removed");
// So now we will have emptied the textfield and the editor will have
// created a padding <br> element for empty editor.
// Check the transaction is in the undo stack...
ok(editor.canUndo, "undo should be available");
// Undo the cut
editor.undo();
is(t1.value, "minefield", "text reinserted");
// So now, the cut should be in the redo stack, so executing the redo
// will clear the text once again and reinsert the padding <br>
// element for empty editor that was removed after undo.
// This will require the editor to figure out that we have a padding
// <br> element again...
ok(editor.canRedo, "redo should be available");
editor.redo();
// Did the editor notice a padding <br> element for empty editor
// reappeared?
is(t1.value, "", "editor found padding element");
} catch (e) {
ok(false, "test failed with error " + e);
}
SimpleTest.finish();
}
</script>
</pre>
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.