mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 07:30:19 +00:00
Tests: Add test for Node.nodeName
This commit is contained in:
parent
ea2bb52962
commit
97436e7d65
Notes:
github-actions[bot]
2024-07-26 05:20:14 +00:00
Author: https://github.com/tcl3 Commit: https://github.com/LadybirdBrowser/ladybird/commit/97436e7d657 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/838
2 changed files with 37 additions and 0 deletions
9
Tests/LibWeb/Text/expected/DOM/Node-nodeName.txt
Normal file
9
Tests/LibWeb/Text/expected/DOM/Node-nodeName.txt
Normal file
|
@ -0,0 +1,9 @@
|
|||
Element nodeName: DIV
|
||||
Attribute nodeName: testattribute
|
||||
Text nodeName: #text
|
||||
CDATASection nodeName: #cdata-section
|
||||
ProcessingInstruction nodeName: testPI
|
||||
Comment nodeName: #comment
|
||||
Document nodeName: #document
|
||||
DocumentType nodeName: html
|
||||
DocumentFragment nodeName: #document-fragment
|
28
Tests/LibWeb/Text/input/DOM/Node-nodeName.html
Normal file
28
Tests/LibWeb/Text/input/DOM/Node-nodeName.html
Normal file
|
@ -0,0 +1,28 @@
|
|||
<!DOCTYPE html>
|
||||
<script src="../include.js"></script>
|
||||
<script>
|
||||
test(() => {
|
||||
const element = document.createElement("div");
|
||||
element.setAttribute("testAttribute", "foo");
|
||||
element.innerText = "Text";
|
||||
println(`Element nodeName: ${element.nodeName}`);
|
||||
println(`Attribute nodeName: ${element.attributes[0].nodeName}`);
|
||||
println(`Text nodeName: ${element.childNodes[0].nodeName}`);
|
||||
|
||||
const xmlDocument = new DOMParser().parseFromString(`<xml></xml>`, "application/xml");
|
||||
const CDATASection = xmlDocument.createCDATASection("Test CDATA");
|
||||
println(`CDATASection nodeName: ${CDATASection.nodeName}`);
|
||||
|
||||
const processingInstruction = document.createProcessingInstruction("testPI", "bar");
|
||||
println(`ProcessingInstruction nodeName: ${processingInstruction.nodeName}`);
|
||||
|
||||
const comment = document.createComment("Test comment");
|
||||
println(`Comment nodeName: ${comment.nodeName}`);
|
||||
|
||||
println(`Document nodeName: ${document.nodeName}`);
|
||||
println(`DocumentType nodeName: ${document.doctype.nodeName}`);
|
||||
|
||||
const documentFragment = document.createDocumentFragment();
|
||||
println(`DocumentFragment nodeName: ${documentFragment.nodeName}`);
|
||||
});
|
||||
</script>
|
Loading…
Reference in a new issue