<html>
<head>
<script src="../../resources/dump-as-markup.js"></script>
<script src="../editing.js"></script>
<script>
Markup.waitUntilDone()

function editingTest() {
    Markup.description('https://bugs.webkit.org/show_bug.cgi?id=166813 Unindenting text inside a blockquote can result in the text being reordered');

    document.getElementById("edit1").focus();
    window.getSelection().setPosition(document.getElementById("select1"), 0);
    Markup.dump('edit1', 'before outdent');
    document.execCommand("Outdent");
    Markup.dump('edit1', 'after outdent');

    document.getElementById("edit2").focus();
    window.getSelection().setPosition(document.getElementById("select2"), 0);
    Markup.dump('edit2', 'before outdent (second inside <div>)');
    document.execCommand("Outdent");
    Markup.dump('edit2', 'after outdent');

    document.getElementById("edit3").focus();
    window.getSelection().setPosition(document.getElementById("select3"), 0);
    Markup.dump('edit3', 'before outdent (second inside <b>)');
    document.execCommand("Outdent");    
    Markup.dump('edit3', 'after outdent');

    Markup.notifyDone();
}


</script>
</head>
<body onload="runEditingTest()">
<div id="description1">This tests outdenting text adjacent to an inner blockquote, inside a blockquote with an inner div.</div>
<div id="edit1" contentEditable><blockquote><div><blockquote>first</blockquote><br/>second<span id="select1"></span><br/></div></blockquote></div>

<div id="description2">This tests outdenting text inside a div adjacent to an inner blockquote, inside a blockquote with an inner div.</div>
<div id="edit2" contentEditable><blockquote><div><blockquote>first</blockquote><br/><div>second<span id="select2"></span><br/></div></div></blockquote></div>

<div id="description3">This tests outdenting text inside an inline adjacent to an inner blockquote, inside a blockquote with an inner div.</div>
<div id="edit3" contentEditable><blockquote><div><blockquote>first</blockquote><br/><b>second<span id="select3"></span><br/></b></div></blockquote></div>
</body>
</html>