forwarddelete-img.tentative.html (2066B)
1 <!doctype html> 2 <html> 3 <head> 4 <meta charset="utf-8"> 5 <meta name="flags" content="may"> 6 <title>Testing normalizing white-space sequence after deleting image surrounded by white-spaces</title> 7 <script src="/resources/testharness.js"></script> 8 <script src="/resources/testharnessreport.js"></script> 9 <script src="../../include/editor-test-utils.js"></script> 10 <script> 11 "use strict"; 12 13 addEventListener("load", () => { 14 // README: 15 // These tests based on the behavior of Chrome 134. This test does NOT define 16 // nor suggest any standard behavior (actually, some expected results might 17 // look odd), but this test must help you to understand how other browsers 18 // use different logic to normalize white-space sequence. 19 20 const editingHost = document.querySelector("div[contenteditable]"); 21 const utils = new EditorTestUtils(editingHost); 22 23 async function addPromiseTest(aInitHTML, aExpectedHTML) { 24 promise_test(async () => { 25 utils.setupEditingHost(aInitHTML); 26 document.execCommand("forwarddelete"); 27 assert_equals(editingHost.innerHTML, aExpectedHTML); 28 }, `document.execCommand("forwarddelete") when "${aInitHTML.replaceAll(/src=".+"/g, 'src="${src}"')}"`); 29 } 30 31 const src = "../../../images/green-16x16.png"; 32 addPromiseTest( 33 `{}<img src="${src}"> `, 34 ` ` 35 ); 36 addPromiseTest( 37 `{}<img src="${src}"> b`, 38 ` b` 39 ); 40 addPromiseTest( 41 `a[]<img src="${src}"> b`, 42 `a b` 43 ); 44 addPromiseTest( 45 `a []<img src="${src}"> b`, 46 `a b` 47 ); 48 addPromiseTest( 49 `a []<img src="${src}">b`, 50 `a b` 51 ); 52 addPromiseTest( 53 `a []<img src="${src}">`, 54 `a ` 55 ); 56 addPromiseTest( 57 `a []<img src="${src}">`, 58 `a ` 59 ); 60 }, {once: true}); 61 </script> 62 </head> 63 <body> 64 <div><img src="../../../images/green-16x16.png"></div> 65 <div contenteditable></div> 66 </body> 67 </html>