Skip to content

Commit

Permalink
server-side element test
Browse files Browse the repository at this point in the history
  • Loading branch information
James Halliday committed Aug 5, 2014
1 parent e12b91c commit 362d1d3
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ module.exports = function inspect_ (obj, opts, depth, seen) {
}
s += '>';
if (obj.childNodes && obj.childNodes.length) s += '...';
s += '</' + String(obj.tagName).toLowerCase() + '>';
s += '</' + String(obj.nodeName).toLowerCase() + '>';
return s;
}
else if (isArray(obj)) {
Expand Down
16 changes: 16 additions & 0 deletions test/element.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
var inspect = require('../');
var test = require('tape');

test('element', function (t) {
t.plan(1);
var elem = {
nodeName: 'div',
attributes: [ { name: 'class', value: 'row' } ],
getAttribute: function (key) {
return elem.attributes[key];
},
childNodes: []
};
var obj = [ 1, elem, 3 ];
t.deepEqual(inspect(obj), '[ 1, <div class="row"></div>, 3 ]');
});

0 comments on commit 362d1d3

Please sign in to comment.