Skip to content

Commit

Permalink
added tests for the cdata and comments
Browse files Browse the repository at this point in the history
  • Loading branch information
polotek committed Aug 22, 2010
1 parent 0b710fa commit 9da473d
Showing 1 changed file with 49 additions and 2 deletions.
51 changes: 49 additions & 2 deletions spec/spec_text_node.js
@@ -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());
});
});

}

0 comments on commit 9da473d

Please sign in to comment.