Skip to content

Commit

Permalink
LibWeb+WebContent: Do not include DOM HTML in text test expectations
Browse files Browse the repository at this point in the history
For example, in the following abbreviated test HTML:

    <span>some text</span>
    <script>println("whf")</script>

We would have to craft the expectation file to include the "some text"
segment, usually with some leading whitespace. This is a bit annoying,
and makes it difficult to manually craft expectation files.

So instead of comparing the expectation against the entire DOM inner
text, we now send the inner text of just the <pre> element containing
the test output when we invoke `internals.signalTextTestIsDone`.
  • Loading branch information
trflynn89 committed Oct 2, 2024
1 parent ad86b4f commit 21f237f
Show file tree
Hide file tree
Showing 314 changed files with 329 additions and 333 deletions.
2 changes: 1 addition & 1 deletion Tests/LibWeb/Text/expected/DOM/AbortSignal-any-crash.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
PASS (didn't crash)
PASS (didn't crash)
2 changes: 1 addition & 1 deletion Tests/LibWeb/Text/expected/DOM/CDATASection-cloneNode.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Cloned CDATASection node data: PASS
Cloned CDATASection node data: PASS
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<DIV id="one" >
<DIV id="one" >
<DIV id="two" >
<DIV id="two" >
<DIV id="one" >
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<DIV id="one" >
<DIV id="one" >
<DIV id="two" >
<DIV id="two" >
<DIV id="one" >
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[object HTMLDocument]
[object HTMLDocument]
true
[object HTMLDocument]
true
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Submit <FORM >
<FORM >
document.bob === document.forms[0]: true
<BUTTON id="fred" >
img element with name 'foo' and id 'bar':
Expand Down
2 changes: 1 addition & 1 deletion Tests/LibWeb/Text/expected/DOM/Element-classList.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
element.classList initial value: ""
element.classList initial value: ""
element.classList after setting classList to "a": "a"
element.classList after setting className to "": ""
element.classList after setting to className to "a a b c": "a a b c"
Expand Down
2 changes: 1 addition & 1 deletion Tests/LibWeb/Text/expected/DOM/Element-closest.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<DIV id="target" >
<DIV id="target" >
2 changes: 1 addition & 1 deletion Tests/LibWeb/Text/expected/DOM/Element-from-point-2.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
hello <DIV id="c" >
<DIV id="c" >
2 changes: 1 addition & 1 deletion Tests/LibWeb/Text/expected/DOM/Element-from-point.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Negative coordinates return null: true
Negative coordinates return null: true
Coordinates outside the viewport return null: true
<HTML id="root-element" >
<DIV id="large-box" >
Expand Down
2 changes: 1 addition & 1 deletion Tests/LibWeb/Text/expected/DOM/Element-getAttributeNS.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
xlink:ref getAttribute = 'null'
xlink:ref getAttribute = 'null'
xlink:ref getAttributeNS = 'test'
href getAttribute = 'test'
href getAttributeNS = 'null'
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
xlink:href getAttributeNode = 'null'
xlink:href getAttributeNode = 'null'
xlink:href getAttributeNodeNS = 'Attr': name = xlink:href value = test
href getAttributeNode = 'Attr': name = href value = test
href getAttributeNodeNS = 'null'
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Original values
Original values
xlink:href getAttributeNS = 'test'
href getAttribute = 'test'
Non-matching namespace
Expand Down
2 changes: 1 addition & 1 deletion Tests/LibWeb/Text/expected/DOM/Element-set-scroll-left.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
Item 1Item 2Item 3Item 4Item 5Item 6Item 7Item 8Item 9Item 10Item 11Item 12 scrollWidth: 1430
scrollWidth: 1430
scrollLeft: 1130
2 changes: 1 addition & 1 deletion Tests/LibWeb/Text/expected/DOM/Elements-from-point-2.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
hello <DIV id="c" >
<DIV id="c" >
<DIV id="b" >
<DIV id="a" >
<HTML >
1 change: 0 additions & 1 deletion Tests/LibWeb/Text/expected/DOM/Elements-from-point-3.txt
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
Some text Elements at point 30, 20: p < div < body < html
2 changes: 1 addition & 1 deletion Tests/LibWeb/Text/expected/DOM/Elements-from-point.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Negative coordinates return empty array: true
Negative coordinates return empty array: true
Coordinates outside the viewport return empty array: true
== Elements at (500, 10) ==
<DIV id="large-box" >
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
12389 PASS (didn't crash)
PASS (didn't crash)
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
Well hello friends some
text text-input selectionStart: 0 selectionEnd: 0 selectionDirection: none
text-input selectionStart: 0 selectionEnd: 0 selectionDirection: none
date-input selectionStart: null selectionEnd: null selectionDirection: null
textarea selectionStart: 0 selectionEnd: 0 selectionDirection: none
text-input selectionStart: 18 selectionEnd: 18 selectionDirection: none
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Calling setRangeText() on an element where setRangeText doesn't apply throws: InvalidStateError
Calling setRangeText() on an element where setRangeText doesn't apply throws: InvalidStateError
setRangeText("foo") on: textarea - Value: foo
setRangeText("foo", 1, 3) on: textarea - Value: tfoot
setRangeText("foo") on: password - Value: footest
Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
Empty string in collection: false
Empty string in collection: false
'haxx' in collection: true
2 changes: 1 addition & 1 deletion Tests/LibWeb/Text/expected/DOM/HTMLCollection-order.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
HTMLCollection
HTMLCollection
anchor1
anchor2
anchor3
Expand Down
2 changes: 1 addition & 1 deletion Tests/LibWeb/Text/expected/DOM/Node-isEqualNode.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ element.isEqualNode(elementWithDifferentLocalName): false
element.isEqualNode(elementWithAttribute): false
element.isEqualNode(elementWithAttribute) (after adding non-matching attribute): false
element.isEqualNode(elementWithAttribute) (after adding matching attribute): false
element.isEqualNode(elementWithAttribute) (after removing non-matching attribute): true
element.isEqualNode(elementWithAttribute) (after removing non-matching attribute): true
2 changes: 1 addition & 1 deletion Tests/LibWeb/Text/expected/DOM/Node-lookupNamespaceURI.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ After setting element attribute xmlns:bar='exampleNamespaceURI'
element.lookupNamespaceURI(null): null
element.lookupNamespaceURI(""): null
element.lookupNamespaceURI("foo"): null
element.lookupNamespaceURI("bar"): exampleNamespaceURI
element.lookupNamespaceURI("bar"): exampleNamespaceURI
2 changes: 1 addition & 1 deletion Tests/LibWeb/Text/expected/DOM/Node-lookupPrefix.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ Prefix for absent namespace "no" on document: null
Prefix for namespace "def" on child: abc
Prefix null on child: null
Prefix for namespace "test" (in parent) on child: ex
Prefix for namespace "def" (from attribute "x") on child: abc
Prefix for namespace "def" (from attribute "x") on child: abc
2 changes: 1 addition & 1 deletion Tests/LibWeb/Text/expected/DOM/Node-normalize.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ Document fragment text after documentFragment.normalize(): 1234, child nodes: 2
Text node 1 data: 12
Text node 2 data: 2
Text node 3 data: 34
Text node 4 data: 4
Text node 4 data: 4
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
Top: 16
Top: 16
Left: 8
2 changes: 1 addition & 1 deletion Tests/LibWeb/Text/expected/DOM/Range-to-string.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
Hello💨😮 World

llo💨😮 Wo
2 changes: 1 addition & 1 deletion Tests/LibWeb/Text/expected/DOM/Text-wholeText.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ Text node B with previous sibling A: AB
Text node B with previous sibling A and next sibling C: ABC
CDATA section D with no siblings: D
CDATA section E with previous sibling D: DE
CDATA section E with previous sibling D and next sibling F: DEF
CDATA section E with previous sibling D and next sibling F: DEF
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
a(
a(
a(
2 changes: 1 addition & 1 deletion Tests/LibWeb/Text/expected/DOM/element-scroll-height.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Item 1Item 2Item 3Item 4Item 5Item 6Item 7Item 8Item 9Item 10Item 11Item 12 1200
1200
2 changes: 1 addition & 1 deletion Tests/LibWeb/Text/expected/DOM/element-scroll-width.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Item 1Item 2Item 3Item 4Item 5Item 6Item 7Item 8Item 9Item 10Item 11Item 12 1200
1200
Original file line number Diff line number Diff line change
@@ -1 +1 @@
document.getElementById(""): null
document.getElementById(""): null
2 changes: 1 addition & 1 deletion Tests/LibWeb/Text/expected/DOM/getElementById-multiple.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
getElementById('foo') => 1
getElementById('foo') => 1
Original file line number Diff line number Diff line change
@@ -1 +1 @@
document.getElementsByClassName("").length: 0
document.getElementsByClassName("").length: 0
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
document.getElementsByClassName("te st").length: 3
document.getElementsByClassName("te st").length: 3
<DIV id="1" >
<DIV id="2" >
<DIV id="3" >
Original file line number Diff line number Diff line change
@@ -1 +1 @@
document.getElementsByName("").length: 0
document.getElementsByName("").length: 0
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
Hello Ladybird Ladybird again World 6
6
4
4 changes: 2 additions & 2 deletions Tests/LibWeb/Text/expected/DOM/range-get-client-rects.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
x [object DOMRectList]
[object DOMRect]
[object DOMRectList]
[object DOMRect]
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
1
1
<H2 >
2
<H2 >
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Hello, world!I'm totally bold rn execCommand("bold") returned false
execCommand("bold") returned false
Hello, world!<b>I'm totally bold rn</b>
queryCommandEnabled("bold") returned false
queryCommandIndeterm("bold") returned false
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
PASS (didn't crash)
PASS (didn't crash)
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
PASS (''): InvalidCharacterError
PASS (''): InvalidCharacterError
PASS ('0'): InvalidCharacterError
4 changes: 2 additions & 2 deletions Tests/LibWeb/Text/expected/HTML/Element-checkVisibility.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
display-none visible: false
display-none visible: false
content-visibility-parent visible: true
content-visibility-child visible: false
opacity-hidden visible: false
opacity-visible visible: true
visibility-hidden visible: false
visibility-visible visible: true
content-visibility-auto-hidden visible: true
content-visibility-auto-hidden visible: true
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
form.length: 12
form.length: 12
elements.length: 12
form[0].name: foo
form[1].name: bar
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
== Elements and Names ==
== Elements and Names ==
formy.length: 12
elements.length: 12
elements[0] === form.foo
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
PASS (Didn't crash)
PASS (Didn't crash)
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
HTMLAllCollection
HTMLAllCollection
typeof document.all = undefined
equal to undefined = true
equal to null = true
Expand Down
2 changes: 1 addition & 1 deletion Tests/LibWeb/Text/expected/HTML/HTMLElement-click.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Event: PointerEvent
Event: PointerEvent
Original file line number Diff line number Diff line change
@@ -1 +1 @@
true
true
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@

nodeName: CANVAS
offsetTop: 0
offsetLeft: 0
Expand Down
2 changes: 1 addition & 1 deletion Tests/LibWeb/Text/expected/HTML/HTMLFormElement-action.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
form.action initial value: http://www.example.com/
form.action initial value: http://www.example.com/
Final segment of form.action after setting to the empty string: HTMLFormElement-action.html
Final segment of form.action after setting to "../test.html": test.html
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
Cloned checkbox checked: true
Cloned checkbox checked: true
Cloned text input value: PASS
Original file line number Diff line number Diff line change
@@ -1 +1 @@
PASS (didn't crash)
PASS (didn't crash)
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
valueAsNumber getter:
valueAsNumber getter:
number: 100
range: 100
hidden: NaN
Expand Down
2 changes: 1 addition & 1 deletion Tests/LibWeb/Text/expected/HTML/HTMLLabelElement-form.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Form for #label-no-for is null
Form for #label-no-for is null
Control for #label-no-for is null: true
Form for #parent-of-input2: #form2
label.form is the same as label.control.form for #parent-of-input2: true
Expand Down
2 changes: 1 addition & 1 deletion Tests/LibWeb/Text/expected/HTML/HTMLOptionElement-form.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Option element with no parent select returns null: true
Option element with no parent select returns null: true
Option element with no parent form returns null: true
Option element with no parent select returns null: true
Option element within optgroup with no parent select returns null: true
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
PASS (didn't crash)
PASS (didn't crash)
Original file line number Diff line number Diff line change
@@ -1 +1 @@
B PASS
PASS
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Option 1 PASS (correct value)
PASS (correct value)
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Option 1 PASS (correct value)
PASS (correct value)
Original file line number Diff line number Diff line change
@@ -1 +1 @@
PASS (didn't crash)
PASS (didn't crash)
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Cloned textarea value: PASS
Cloned textarea value: PASS
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ kind value after setting to "captions": 'captions'
kind value after setting to null: 'metadata'
kind value after setting to "CHAPTERS": 'chapters'
kind value after setting to "": 'metadata'
kind value after calling removeAttribute: 'subtitles'
kind value after calling removeAttribute: 'subtitles'
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Select files...4 files selected. input1:
input1:
file1: text/plain: Contents for file1
file2: text/plain: Contents for file2
file3: text/plain: Contents for file3
Expand Down
2 changes: 1 addition & 1 deletion Tests/LibWeb/Text/expected/HTML/Window-find.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
window.find(): false
window.find(): false
window.find("this"): true, selection from: 0 to 4
window.find("this"): false
window.find("A"): true, selection from: 8 to 9
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
PASS (didn't crash)
PASS (didn't crash)
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
george true
true
true
true
true
Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
true
true
true
2 changes: 1 addition & 1 deletion Tests/LibWeb/Text/expected/HTML/Window-opener.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
window.opener initial value: null
window.opener initial value: null
window.opener after setting to "test": test
iframe contentWindow.opener initial value is the current window object: true
iframe contentWindow.opener after setting to null: null
Expand Down
2 changes: 1 addition & 1 deletion Tests/LibWeb/Text/expected/HTML/Window-postMessage.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
originError instanceof DOMException: true
originError instanceof DOMException: true
originError.name: SyntaxError
originError.message: Invalid URL for targetOrigin: 'aaaa'
originError.constructor === window.DOMException: true
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@


PASS (didn't crash)
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
http:
http:
https:
Original file line number Diff line number Diff line change
@@ -1 +1 @@
/foo%C2%91%91
/foo%C2%91%91
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Label Text input focused
Text input focused
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Label Checkbox changed
Checkbox changed
Original file line number Diff line number Diff line change
@@ -1 +1 @@
PASS (didn't crash)
PASS (didn't crash)
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
Entered TestElement constructor, throwing.
Entered TestElement constructor, throwing.
PASS! (Didn't crash)
5 changes: 0 additions & 5 deletions Tests/LibWeb/Text/expected/HTML/data-transfer.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,3 @@ effectAllowed: none
length=0, types=
stringItem: kind=string, type=custom-type
length=1, types=custom-type
stringItemAsString: data=well hello friends
fileItem: kind=file, type=text/plain
length=2, types=custom-type,Files
fileItemAsFile: name=file.txt, type=text/plain
fileItemAsEntry: name=file.txt, file=true, directory=false
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Slot directionality: ltr
Slot directionality: ltr
Original file line number Diff line number Diff line change
@@ -1 +1 @@
PASS
PASS
Loading

0 comments on commit 21f237f

Please sign in to comment.