67 lines
1.7 KiB
HTML
67 lines
1.7 KiB
HTML
<!doctype html>
|
|
<html>
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<meta name="timeout" content="long">
|
|
<meta name="variant" content="?white-space=pre">
|
|
<meta name="variant" content="?white-space=pre-wrap">
|
|
<title>Forward-deleting a part of multiple white-spaces when white-space style preserves them</title>
|
|
<script src="/resources/testharness.js"></script>
|
|
<script src="/resources/testharnessreport.js"></script>
|
|
<script src="../include/editor-test-utils.js"></script>
|
|
<script>
|
|
"use strict";
|
|
|
|
const searchParams = new URLSearchParams(document.location.search);
|
|
const whiteSpace = searchParams.get("white-space");
|
|
|
|
addEventListener("load", () => {
|
|
const editingHost = document.querySelector("div[contenteditable=plaintext-only]");
|
|
editingHost.style.whiteSpace = whiteSpace;
|
|
const utils = new EditorTestUtils(editingHost);
|
|
for (const data of [
|
|
{
|
|
init: `<p>A [] B</p>`,
|
|
expected: `<p>A B</p>`,
|
|
},
|
|
{
|
|
init: `<p>A[] B</p>`,
|
|
expected: `<p>A B</p>`,
|
|
},
|
|
{
|
|
init: `<p>A [] B</p>`,
|
|
expected: `<p>A B</p>`,
|
|
},
|
|
{
|
|
init: `<p>A [] B</p>`,
|
|
expected: `<p>A B</p>`,
|
|
},
|
|
{
|
|
init: `<p>A[] B</p>`,
|
|
expected: `<p>A B</p>`,
|
|
},
|
|
{
|
|
init: `<p>A [] B</p>`,
|
|
expected: `<p>A B</p>`,
|
|
},
|
|
{
|
|
init: `<p>A[] B</p>`,
|
|
expected: `<p>A B</p>`,
|
|
},
|
|
]) {
|
|
if (data.skipIf !== undefined && data.skipIf) {
|
|
continue;
|
|
}
|
|
test(() => {
|
|
utils.setupEditingHost(data.init);
|
|
document.execCommand("forwardDelete");
|
|
assert_equals(editingHost.innerHTML, data.expected);
|
|
}, `document.execCommand("forwardDelete") when ${data.init}`);
|
|
}
|
|
}, {once: true});
|
|
</script>
|
|
</head>
|
|
<body>
|
|
<div contenteditable="plaintext-only"></div>
|
|
</body>
|
|
</html>
|