Skip to content

Commit

Permalink
test: Merge parser.js and domparser.js
Browse files Browse the repository at this point in the history
  • Loading branch information
lauriro committed Jul 5, 2024
1 parent 1a04ec5 commit 55b038b
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 34 deletions.
33 changes: 0 additions & 33 deletions test/domparser.js

This file was deleted.

1 change: 0 additions & 1 deletion test/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
require("./dom.js")
require("./selector.js")
require("./parser.js")
require("./domparser.js")
require("./interactive.js")
require("./net.js")

15 changes: 15 additions & 0 deletions test/parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,25 @@ describe("parser", function() {

var DOM = require("../")
, parser = new DOM.DOMParser()
, serializer = new DOM.XMLSerializer()
, fs = require("fs")
, path = require("path")
, test = describe.test

test("MDN DOMParser example", function (assert) {
var xmlStr = '<q id="a"><span id="b">hey!</span></q>'
, doc = parser.parseFromString(xmlStr, "application/xml")

assert.equal(doc.documentElement, doc.firstElementChild)
assert.equal(doc.documentElement.nodeName, "q")
assert.equal(doc.documentElement.namespaceURI, null)
assert.equal(doc.contentType, "application/xml")
assert.equal(doc.querySelector("Span"), null)
assert.equal(doc.querySelector("span").textContent, "hey!")
assert.equal(serializer.serializeToString(doc), xmlStr)

assert.end()
})

test("parse and stringify", function (assert) {
assert.matchSnapshot("./test/samp1.html", function(str) {
Expand Down

0 comments on commit 55b038b

Please sign in to comment.