expected = "<divstyle=\"display:none;\">\n\n<divid=\"draggable\"ondragstart=\"doDragStartSelection(event)\">This is a <em>draggable</em>\n bit of text.</div>\n\n</div>";
var outContext = {value:''}, outInfo = {value:''};
out = encoder.encodeToStringWithContext(outContext, outInfo);
expected = "<divstyle=\"display:none;\">\n\n<divid=\"draggable\"ondragstart=\"doDragStartSelection(event)\">This is a <em>draggable</em> bit of text.</div>\n\n</div>";
is(out, expected, "test encodeToStringWithContext with selection ");
expected = '<olid=\"aList\">\n <li>Lorem ipsum dolor</li>\n <li>sit amet, <strong>consectetuer</strong></li>\n <li>adipiscing elit</li>\n <li>Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus \naliquet lectus. Nunc vitae eros. Class</li>\n <li>aptent taciti</li>\n</ol>';
expected = '\n <li>Lorem ipsum dolor</li>\n <li>sit amet, <strong>consectetuer</strong></li>\n <li>adipiscing elit</li>\n <li>Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus \naliquet lectus. Nunc vitae eros. Class</li>\n <li>aptent taciti</li>\n';
expected = "<olid=\"aList\">\n <li>Lorem ipsum dolor</li>\n <li>sit amet, <strong>consectetuer</strong></li>\n <li>adipiscing elit</li>\n <li>Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus \naliquet lectus. Nunc vitae eros. Class</li>\n <li>aptent taciti</li>\n</ol>";
is(out, expected, "test list node");
var liList = node.getElementsByTagName("li");
var range = document.createRange();
// selection start at the first child of the ol, and end after the element ol
expected = '<olid="aList">\n <li>Lorem ipsum dolor</li>\n <li>sit amet, <strong>consectetuer</strong></li>\n <li>adipiscing elit</li>\n <li>Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus \naliquet lectus. Nunc vitae eros. Class</li>\n <li>aptent taciti</li>\n</ol>';
is(out, expected, "test list selection with range: selection start at the first child of the ol, and end after the element ol");
// selection start at the third child of the ol, and end after the element ol
expected = '<olid="aList"><livalue=\"2\">sit amet, <strong>consectetuer</strong></li>\n <li>adipiscing elit</li>\n <li>Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus \naliquet lectus. Nunc vitae eros. Class</li>\n <li>aptent taciti</li>\n</ol>';
is(out, expected, "test list selection with range: selection start at the third child of the ol, and end after the element ol");
// selection start at the third child of the ol, and end after the element ol + ol start at the value 5
expected = '<olstart=\"5\"id=\"aList\"><livalue=\"6\">sit amet, <strong>consectetuer</strong>\n </li>\n <li>adipiscing elit</li>\n <li>Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus \naliquet lectus. Nunc vitae eros. Class</li>\n <li>aptent taciti</li>\n</ol>';
is(out, expected, "test list selection with range: selection start at the third child of the ol, and end after the element ol + ol start at the value 5");
expected = '<olid=\"aList\">\n <livalue=\"8\">Lorem ipsum dolor</li>\n <li>sit amet, <strong>consectetuer</strong></li>\n <li>adipiscing elit</li>\n <li>Nam eu sapien. Sed viverra lacus. Donec quis ipsum. Nunc cursus \naliquet lectus. Nunc vitae eros. Class</li>\n <li>aptent taciti</li>\n</ol>';
is(out, expected, "test list selection with a value on a LI");