UNPKG

libxmljs

Version:

libxml bindings for v8 javascript engine

37 lines (31 loc) 1.04 kB
import * as libxml from "../index"; module.exports.new = function(assert: any) { var doc = libxml.Document(); var comm = libxml.Comment(doc, 'comment1'); doc.root(comm); assert.equal('comment1', comm.text()); assert.done(); }; module.exports.text = function(assert: any) { var doc = libxml.Document(); var comm = libxml.Comment(doc); comm.text('comment2'); assert.equal('comment2', comm.text()); assert.done(); }; module.exports.textWithSpecialCharacters = function(assert: any) { var doc = libxml.Document(); var comm = libxml.Comment(doc); var theText = 'my comment <has> special ch&r&cters'; comm.text(theText); assert.equal(theText, comm.text()); assert.done(); }; module.exports.toStringWithSpecialCharacters = function(assert: any) { var doc = libxml.Document(); var comm = libxml.Comment(doc); var theText = 'my comment <has> special ch&r&cters'; comm.text(theText); assert.equal("<!--" + theText + "-->", comm.toString()); assert.done(); };