diff --git a/spec/spec_text_node.js b/spec/spec_text_node.js
index 40fb9239..c48c204c 100644
--- a/spec/spec_text_node.js
+++ b/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(
'\
child\
');
+ });
+
+ 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(
+ '\
+ \
+ ');
+ });
+
+ 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(
+ '\
+ \
+ ');
+ });
+
+ it('knows its type is "cdata"', function() {
+ assertEqual('cdata', doc.child().type());
+ });
+
+ it('has no name', function() {
+ assertEqual(undefined, doc.child().name());
+ });
});
}