From 362d1d3e86f187651c29feeb8478110afada385b Mon Sep 17 00:00:00 2001 From: James Halliday Date: Tue, 5 Aug 2014 13:15:33 +1200 Subject: [PATCH] server-side element test --- index.js | 2 +- test/element.js | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 test/element.js diff --git a/index.js b/index.js index 31c6309..66a9434 100644 --- a/index.js +++ b/index.js @@ -36,7 +36,7 @@ module.exports = function inspect_ (obj, opts, depth, seen) { } s += '>'; if (obj.childNodes && obj.childNodes.length) s += '...'; - s += ''; + s += ''; return s; } else if (isArray(obj)) { diff --git a/test/element.js b/test/element.js new file mode 100644 index 0000000..2088f64 --- /dev/null +++ b/test/element.js @@ -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,
, 3 ]'); +});