From 59203c63bb777a3bacec32fb8830fba33540e809 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 12 Jun 2024 07:35:29 +0200 Subject: Adding upstream version 127.0. Signed-off-by: Daniel Baumann --- testing/web-platform/tests/editing/data/delete.js | 6 +- .../tests/editing/data/forwarddelete.js | 26 +- .../tests/editing/edit-context/WEB_FEATURES.yml | 3 + .../tests/editing/include/editor-test-utils.js | 75 ++ ...thout-unwrapping-first-line-of-child-block.html | 1020 ++++++++++++++++++++ 5 files changed, 1114 insertions(+), 16 deletions(-) create mode 100644 testing/web-platform/tests/editing/edit-context/WEB_FEATURES.yml create mode 100644 testing/web-platform/tests/editing/other/delete-without-unwrapping-first-line-of-child-block.html (limited to 'testing/web-platform/tests/editing') diff --git a/testing/web-platform/tests/editing/data/delete.js b/testing/web-platform/tests/editing/data/delete.js index 131c99b1d5..c4d1225ef3 100644 --- a/testing/web-platform/tests/editing/data/delete.js +++ b/testing/web-platform/tests/editing/data/delete.js @@ -2044,12 +2044,12 @@ var browserTests = [ {"defaultparagraphseparator":[false,false,"div",false,false,"p"],"delete":[false,false,"",false,false,""]}], ["foo

{

]bar

", [["defaultparagraphseparator","div"],["delete",""]], - "foo
{}bar", + "foo

bar

", [true,true], {"defaultparagraphseparator":[false,false,"p",false,false,"div"],"delete":[false,false,"",false,false,""]}], ["foo

{

]bar

", [["defaultparagraphseparator","p"],["delete",""]], - "foo
{}bar", + "foo

bar

", [true,true], {"defaultparagraphseparator":[false,false,"div",false,false,"p"],"delete":[false,false,"",false,false,""]}], ["

foo
{

}bar

", @@ -2359,7 +2359,7 @@ var browserTests = [ {"delete":[false,false,"",false,false,""]}], ["
  1. foo
[bar
  1. ]baz
", [["delete",""]], - "
  1. foo
{}baz", + "
  1. foo
  1. baz
", [true], {"delete":[false,false,"",false,false,""]}], ["
  1. foo

[bar

  1. ]baz
", diff --git a/testing/web-platform/tests/editing/data/forwarddelete.js b/testing/web-platform/tests/editing/data/forwarddelete.js index ea590a4fbb..a881fb6ccf 100644 --- a/testing/web-platform/tests/editing/data/forwarddelete.js +++ b/testing/web-platform/tests/editing/data/forwarddelete.js @@ -2009,12 +2009,12 @@ var browserTests = [ {"defaultparagraphseparator":[false,false,"div",false,false,"p"],"forwarddelete":[false,false,"",false,false,""]}], ["foo

{

]bar

", [["defaultparagraphseparator","div"],["forwarddelete",""]], - "foo
{}bar", + "foo

bar

", [true,true], {"defaultparagraphseparator":[false,false,"p",false,false,"div"],"forwarddelete":[false,false,"",false,false,""]}], ["foo

{

]bar

", [["defaultparagraphseparator","p"],["forwarddelete",""]], - "foo
{}bar", + "foo

bar

", [true,true], {"defaultparagraphseparator":[false,false,"div",false,false,"p"],"forwarddelete":[false,false,"",false,false,""]}], ["

foo
{

}bar

", @@ -2184,7 +2184,7 @@ var browserTests = [ {"forwarddelete":[false,false,"",false,false,""]}], ["
  1. foo
{}
  1. bar
", [["forwarddelete",""]], - "
  1. foo
{}bar", + "
  1. foo
  1. bar
", [true], {"forwarddelete":[false,false,"",false,false,""]}], ["
  1. foo

{}

  1. bar
", @@ -2199,22 +2199,22 @@ var browserTests = [ {"forwarddelete":[false,false,"",false,false,""]}], ["
  1. foo
{}
  1. bar
", [["forwarddelete",""]], - "
  1. foo
{}bar", + "
  1. foo
  1. bar
", [true], {"forwarddelete":[false,false,"",false,false,""]}], ["
  1. foo
{}
  1. bar
", [["forwarddelete",""]], - "
  1. foo
{}bar", + "
  1. foo
  1. bar
", [true], {"forwarddelete":[false,false,"",false,false,""]}], ["
  1. foo
{}
  1. bar
", [["forwarddelete",""]], - "
  1. foo
{}bar", + "
  1. foo
  1. bar
", [true], {"forwarddelete":[false,false,"",false,false,""]}], ["
  1. foo
{}
  1. bar
", [["forwarddelete",""]], - "
  1. foo
{}bar", + "
  1. foo
  1. bar
", [true], {"forwarddelete":[false,false,"",false,false,""]}], ["
    1. foo
  1. {}
    1. bar
", @@ -2259,7 +2259,7 @@ var browserTests = [ {"forwarddelete":[false,false,"",false,false,""]}], ["
  1. foo
[bar
  1. ]baz
", [["forwarddelete",""]], - "
  1. foo
{}baz", + "
  1. foo
  1. baz
", [true], {"forwarddelete":[false,false,"",false,false,""]}], ["
  1. foo

[bar

  1. ]baz
", @@ -2269,12 +2269,12 @@ var browserTests = [ {"forwarddelete":[false,false,"",false,false,""]}], ["
  1. foo

[bar

  1. ]baz

", [["defaultparagraphseparator","div"],["forwarddelete",""]], - "
  1. foo

{}baz

", + "
  1. foo
  1. {}baz

", [true,true], {"defaultparagraphseparator":[false,false,"p",false,false,"div"],"forwarddelete":[false,false,"",false,false,""]}], ["
  1. foo

[bar

  1. ]baz

", [["defaultparagraphseparator","p"],["forwarddelete",""]], - "
  1. foo

{}baz

", + "
  1. foo
  1. {}baz

", [true,true], {"defaultparagraphseparator":[false,false,"div",false,false,"p"],"forwarddelete":[false,false,"",false,false,""]}], ["
  1. foo
  1. []bar
", @@ -2289,7 +2289,7 @@ var browserTests = [ {"forwarddelete":[false,false,"",false,false,""]}], ["{}
", [["forwarddelete",""]], - "{}bar", + "", [true], {"forwarddelete":[false,false,"",false,false,""]}], ["

{}

", @@ -2304,7 +2304,7 @@ var browserTests = [ {"forwarddelete":[false,false,"",false,false,""]}], ["
  1. foo
{}
", [["forwarddelete",""]], - "
  1. foo
{}bar", + "
  1. foo
", [true], {"forwarddelete":[false,false,"",false,false,""]}], ["
  1. foo

{}

", @@ -2314,7 +2314,7 @@ var browserTests = [ {"forwarddelete":[false,false,"",false,false,""]}], ["{}
  1. bar
", [["forwarddelete",""]], - "{}bar", + "
  1. bar
", [true], {"forwarddelete":[false,false,"",false,false,""]}], ["

{}

  1. bar
", diff --git a/testing/web-platform/tests/editing/edit-context/WEB_FEATURES.yml b/testing/web-platform/tests/editing/edit-context/WEB_FEATURES.yml new file mode 100644 index 0000000000..284280066a --- /dev/null +++ b/testing/web-platform/tests/editing/edit-context/WEB_FEATURES.yml @@ -0,0 +1,3 @@ +features: +- name: edit-context + files: "**" diff --git a/testing/web-platform/tests/editing/include/editor-test-utils.js b/testing/web-platform/tests/editing/include/editor-test-utils.js index d0d50d22a6..b180f3343f 100644 --- a/testing/web-platform/tests/editing/include/editor-test-utils.js +++ b/testing/web-platform/tests/editing/include/editor-test-utils.js @@ -424,4 +424,79 @@ class EditorTestUtils { ); } } + + static getRangeArrayDescription(arrayOfRanges) { + if (arrayOfRanges === null) { + return "null"; + } + if (arrayOfRanges === undefined) { + return "undefined"; + } + if (!Array.isArray(arrayOfRanges)) { + return "Unknown Object"; + } + if (arrayOfRanges.length === 0) { + return "[]"; + } + let result = ""; + for (let range of arrayOfRanges) { + if (result === "") { + result = "["; + } else { + result += ","; + } + result += `{${EditorTestUtils.getRangeDescription(range)}}`; + } + result += "]"; + return result; + } + + static getNodeDescription(node) { + if (!node) { + return "null"; + } + switch (node.nodeType) { + case Node.TEXT_NODE: + case Node.COMMENT_NODE: + case Node.CDATA_SECTION_NODE: + return `${node.nodeName} "${node.data.replaceAll("\n", "\\\\n")}"`; + case Node.ELEMENT_NODE: + return `<${node.nodeName.toLowerCase()}${ + node.hasAttribute("id") ? ` id="${node.getAttribute("id")}"` : "" + }${ + node.hasAttribute("class") ? ` class="${node.getAttribute("class")}"` : "" + }${ + node.hasAttribute("contenteditable") + ? ` contenteditable="${node.getAttribute("contenteditable")}"` + : "" + }${ + node.inert ? ` inert` : "" + }${ + node.hidden ? ` hidden` : "" + }${ + node.readonly ? ` readonly` : "" + }${ + node.disabled ? ` disabled` : "" + }>`; + default: + return `${node.nodeName}`; + } + } + + static getRangeDescription(range) { + if (range === null) { + return "null"; + } + if (range === undefined) { + return "undefined"; + } + return range.startContainer == range.endContainer && + range.startOffset == range.endOffset + ? `(${EditorTestUtils.getNodeDescription(range.startContainer)}, ${range.startOffset})` + : `(${EditorTestUtils.getNodeDescription(range.startContainer)}, ${ + range.startOffset + }) - (${EditorTestUtils.getNodeDescription(range.endContainer)}, ${range.endOffset})`; + } + + } diff --git a/testing/web-platform/tests/editing/other/delete-without-unwrapping-first-line-of-child-block.html b/testing/web-platform/tests/editing/other/delete-without-unwrapping-first-line-of-child-block.html new file mode 100644 index 0000000000..99f8f05888 --- /dev/null +++ b/testing/web-platform/tests/editing/other/delete-without-unwrapping-first-line-of-child-block.html @@ -0,0 +1,1020 @@ + + + + + + + + + + + + + +Tests for deleting preceding lines of right child block if range ends at start of the right child + + + + + + + + +
+ -- cgit v1.2.3