diff options
| author | Michael Williamson <mike@zwobble.org> | 2015-01-25 15:30:30 +0000 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2015-01-25 15:30:30 +0000 |
| commit | b79eaad70e41ea4843beced7c5e575d105362e10 (patch) | |
| tree | 8559d3e914158027bf2fb0289c1b926d2c93dfc5 | |
| parent | 97365b6993456f4de0198da23e517385e119e5ba (diff) | |
Test that empty HTML paths can be read
| -rw-r--r-- | lib/html-paths.js | 3 | ||||
| -rw-r--r-- | tests/style-reader.tests.js | 4 |
2 files changed, 5 insertions, 2 deletions
diff --git a/lib/html-paths.js b/lib/html-paths.js index 9be13be..b881131 100644 --- a/lib/html-paths.js +++ b/lib/html-paths.js @@ -44,5 +44,4 @@ Element.prototype.matchesElement = function(element) { return this.tagNames[element.tagName] && _.isEqual(this.attributes || {}, element.attributes || {}); }; - - +exports.empty = elements([]); diff --git a/tests/style-reader.tests.js b/tests/style-reader.tests.js index 28df434..df32839 100644 --- a/tests/style-reader.tests.js +++ b/tests/style-reader.tests.js @@ -11,6 +11,10 @@ var readStyle = styleReader.readStyle; describe('styleReader.readHtmlPath', function() { + test('reads empty path', function() { + assert.deepEqual(readHtmlPath(""), htmlPaths.empty); + }); + test('reads single element', function() { assert.deepEqual(readHtmlPath("p"), htmlPaths.elements(["p"])); }); |
