editor/libeditor/html/tests/test_bug832025.html

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/editor/libeditor/html/tests/test_bug832025.html	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,42 @@
     1.4 +<!DOCTYPE HTML>
     1.5 +<html>
     1.6 +<!--
     1.7 +https://bugzilla.mozilla.org/show_bug.cgi?id=832025
     1.8 +-->
     1.9 +<head>
    1.10 +  <title>Test for Bug 832025</title>
    1.11 +  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
    1.12 +  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
    1.13 +  <script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
    1.14 +</head>
    1.15 +<body>
    1.16 +<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=832025">Mozilla Bug 832025</a>
    1.17 +<div id="test" contenteditable="true">header1</div>
    1.18 +<script type="application/javascript">
    1.19 +
    1.20 +/**
    1.21 + * Test for Bug 832025
    1.22 + *
    1.23 + */
    1.24 +
    1.25 +document.execCommand("stylewithcss", false, "true");
    1.26 +var test = document.getElementById("test");
    1.27 +test.focus();
    1.28 +
    1.29 +// place caret at end of editable area
    1.30 +var sel = getSelection();
    1.31 +sel.collapse(test, test.childNodes.length);
    1.32 +
    1.33 +// make it a H1
    1.34 +document.execCommand("heading", false, "H1");
    1.35 +// simulate a CR key
    1.36 +sendKey("return");
    1.37 +// insert some text
    1.38 +document.execCommand("insertText", false, "abc");
    1.39 +
    1.40 +is(test.innerHTML == '<h1>header1</h1><p>abc<br></p>',
    1.41 +   true, "A paragraph automatically created after a CR at the end of an H1 should not be bold");
    1.42 +
    1.43 +</script>
    1.44 +</body>
    1.45 +</html>

mercurial