Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added tests for the cdata and comments
- Loading branch information
Showing
1 changed file
with
49 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,60 @@ | ||
with(require('./helpers')) { | ||
|
||
describe('Text node', function() { | ||
it('knows its type is "text"', function() { | ||
var doc = libxml.parseXmlString( | ||
var doc = null; | ||
|
||
beforeEach(function() { | ||
doc = libxml.parseXmlString( | ||
'<?xml version="1.0"?>\ | ||
<root>child</root>\ | ||
'); | ||
}); | ||
|
||
it('knows its type is "text"', function() { | ||
assertEqual('text', doc.child().type()); | ||
}); | ||
|
||
it('knows its name is "text"', function() { | ||
assertEqual('text', doc.child().name()); | ||
}); | ||
}); | ||
|
||
describe('Comment node', function() { | ||
var doc = null; | ||
|
||
beforeEach(function() { | ||
doc = libxml.parseXmlString( | ||
'<?xml version="1.0"?>\ | ||
<root><!-- comment --></root>\ | ||
'); | ||
}); | ||
|
||
it('knows its type is "comment"', function() { | ||
assertEqual('comment', doc.child().type()); | ||
}); | ||
|
||
it('knows its name is "comment"', function() { | ||
assertEqual('comment', doc.child().name()); | ||
}); | ||
}); | ||
|
||
describe('CDATA node', function() { | ||
var doc = null; | ||
|
||
beforeEach(function() { | ||
doc = libxml.parseXmlString( | ||
'<?xml version="1.0"?>\ | ||
<root><![CDATA[cdata text]]></root>\ | ||
'); | ||
}); | ||
|
||
it('knows its type is "cdata"', function() { | ||
assertEqual('cdata', doc.child().type()); | ||
}); | ||
|
||
it('has no name', function() { | ||
assertEqual(undefined, doc.child().name()); | ||
}); | ||
}); | ||
|
||
} |