Commit 679a34fa authored by justing's avatar justing

Reviewed by harrison

        Layout test for:
        <http://bugzilla.opendarwin.org/show_bug.cgi?id=4609>
        window.getSelection().toString() is undefined (range object
        returned from window.getSelection() is useless)

        * editing/selection/toString-expected.txt: Added.
        * editing/selection/toString.html: Added.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@11866 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 2d592013
2006-01-03 Justin Garcia <justin.garcia@apple.com>
Reviewed by harrison
Layout test for:
<http://bugzilla.opendarwin.org/show_bug.cgi?id=4609>
window.getSelection().toString() is undefined (range object
returned from window.getSelection() is useless)
* editing/selection/toString-expected.txt: Added.
* editing/selection/toString.html: Added.
2006-01-03 Eric Seidel <eseidel@apple.com>
Reviewed by darin.
......
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
This tests Selection::toString(): that it exists, that it returns the same result as the implicit toString call, and that it returns the correct results.
hello world
Success
<script>
function log(str) {
var li = document.createElement("li");
li.appendChild(document.createTextNode(str));
var console = document.getElementById("console");
console.appendChild(li);
}
function runTest() {
try {
if (window.layoutTestController)
window.layoutTestController.dumpAsText();
var selection = window.getSelection();
var element = document.getElementById("test");
if (selection.setBaseAndExtent)
selection.setBaseAndExtent(element, 0, element, 1);
else if (selection.selectAllChildren)
selection.selectAllChildren(element);
else
throw("Couldn't set a selection.");
if (selection.toString) {
var string = selection.toString();
if (string != selection)
throw("Implicit toString call did not match explicit call");
if (string != "hello world")
throw("Selection::toString() returned incorrect results.");
log("Success");
} else
throw("Selection::toString() not supported");
} catch(e) {
log("Test Failed. Error was: " + e);
}
}
</script>
<body>
<p>This tests Selection::toString(): that it exists, that it returns the same result as the implicit toString call, and that it returns the correct results.</p>
<div id="test" style="border: 1px solid black;">hello world</div>
<ul id="console"></ul>
<script>runTest();</script>
</body>
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment