diff options
Diffstat (limited to 'testing/web-platform/tests/editing/other/cefalse-boundaries-deletion.html')
-rw-r--r-- | testing/web-platform/tests/editing/other/cefalse-boundaries-deletion.html | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/testing/web-platform/tests/editing/other/cefalse-boundaries-deletion.html b/testing/web-platform/tests/editing/other/cefalse-boundaries-deletion.html new file mode 100644 index 0000000000..de793bd6a3 --- /dev/null +++ b/testing/web-platform/tests/editing/other/cefalse-boundaries-deletion.html @@ -0,0 +1,60 @@ +<!DOCTYPE HTML> +<meta charset=utf-8> +<title>Selecting and deleting all from the cE=true element with cE=false element at the beginning</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="../include/editor-test-utils.js"></script> + +<div contenteditable></div> + +<script> + const utils = new EditorTestUtils( document.querySelector( 'div[contenteditable]' ) ); + + test( () => { + utils.setupEditingHost( `<div contenteditable="false" id="cefalse-beginning"> </div> + <p id="paragraph-beginning">Lorem ipsum dolor sit amet.</p>` ); + + const cefalse = document.querySelector( '#cefalse-beginning' ); + const paragraph = document.querySelector( '#paragraph-beginning' ); + + utils.editingHost.focus(); + document.execCommand( 'selectAll' ); + document.execCommand( 'delete' ); + + assert_false( cefalse.isConnected, 'cE=false element should be removed' ); + assert_false( paragraph.isConnected, 'paragraph should be removed' ); + }, 'cE=false elements can be removed from the beginning of the cE=true elements' ); + + test( () => { + utils.setupEditingHost( `<p id="paragraph-end">Lorem ipsum dolor sit amet.</p> + <div contenteditable="false" id="cefalse-end"> </div>` ); + + const cefalse = document.querySelector( '#cefalse-end' ); + const paragraph = document.querySelector( '#paragraph-end' ); + + utils.editingHost.focus(); + document.execCommand( 'selectAll' ); + document.execCommand( 'delete' ); + + assert_false( cefalse.isConnected, 'cE=false element should be removed' ); + assert_false( paragraph.isConnected, 'paragraph should be removed' ); + }, 'cE=false elements can be removed from the end of the cE=true elements' ); + + test( () => { + utils.setupEditingHost( `<div contenteditable="false" id="cefalse-boundaries-beginning"> </div> + <p id="paragraph-boundaries">Lorem ipsum dolor sit amet.</p> + <div contenteditable="false" id="cefalse-boundaries-end"> </div>` ); + + const cefalseBeginning = document.querySelector( '#cefalse-boundaries-beginning' ); + const cefalseEnd = document.querySelector( '#cefalse-boundaries-end' ); + const paragraph = document.querySelector( '#paragraph-boundaries' ); + + utils.editingHost.focus(); + document.execCommand( 'selectAll' ); + document.execCommand( 'delete' ); + + assert_false( cefalseBeginning.isConnected, 'cE=false element at the beginning should be removed' ); + assert_false( cefalseEnd.isConnected, 'cE=false element at the end should be removed' ); + assert_false( paragraph.isConnected, 'paragraph should be removed' ); + }, 'cE=false elements can be removed from the boundaries of the cE=true elements' ); +</script> |