<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel="stylesheet" type="text/css" href="resources/extend-selection.css" />
<script src="resources/extend-selection.js"></script>
</head>
<body>
<pre id="console"></pre>
<script>
function runSelectionTestsWithGranularityForEnclosingBlock(testNodes, granularity)
{
    for (var i = 0; i < testNodes.length; ++i) {
        getSelection().setPosition(testNodes[i].firstChild, 0);

        log("Test " + (i + 1) + ", LTR:\n");
        log("  Extending right: ");
        extendAndLogSelectionWithinBlock("right", granularity, "win");

        log("  Extending left:  ");
        extendAndLogSelectionWithinBlock("left", granularity, "win");
    }
}

if (window.internals)
    internals.settings.setEditingBehavior("windows");
log("\n\n\nExtending by character\n");
runSelectionTestsWithGranularityForEnclosingBlock(createEnclosingBlockNodes(), "character");

log("\n\n\n\n\nExtending by word\n");
runSelectionTestsWithGranularityForEnclosingBlock(createEnclosingBlockNodes(), "word");
</script>
</body>
