Skip to content

Commit

Permalink
more element coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
James Halliday committed Aug 5, 2014
1 parent b530882 commit 6905cc2
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions test/element.js
Expand Up @@ -14,3 +14,29 @@ test('element', function (t) {
var obj = [ 1, elem, 3 ];
t.deepEqual(inspect(obj), '[ 1, <div class="row"></div>, 3 ]');
});

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

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

0 comments on commit 6905cc2

Please sign in to comment.