diff --git a/CHANGELOG.md b/CHANGELOG.md index 88e14649..17f3b5d0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Minim Changelog +## 0.21.1 + +### Bug Fixes + +- Empty parseResult and link arrays are serialised in JSON 06 Serialiser, a + regression of 0.21.0 caused these to not be serialised. + ## 0.21.0 ### Breaking diff --git a/lib/serialisers/json-0.6.js b/lib/serialisers/json-0.6.js index f87556b2..11d14936 100644 --- a/lib/serialisers/json-0.6.js +++ b/lib/serialisers/json-0.6.js @@ -77,7 +77,10 @@ module.exports = JSONSerialiser.extend({ return false; } - if (element.element === 'httpRequest' || element.element === 'httpResponse' || element.element === 'category') { + if (element.element === 'parseResult' || element.element === 'httpRequest' || + element.element === 'httpResponse' || element.element === 'category' || + element.element === 'link') + { return true; } diff --git a/package.json b/package.json index 978a5f23..b4cf49cb 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "minim", - "version": "0.21.0", + "version": "0.21.1", "description": "A library for interacting with JSON through Refract elements", "main": "lib/minim.js", "scripts": { diff --git a/test/serialisers/json-0.6.js b/test/serialisers/json-0.6.js index 31d6e75c..9d5c20ec 100644 --- a/test/serialisers/json-0.6.js +++ b/test/serialisers/json-0.6.js @@ -820,6 +820,17 @@ describe('JSON 0.6 Serialiser', function() { }); }); + it('serialises empty parseResult content', function() { + var element = new minim.elements.Element([]); + element.element = 'parseResult'; + var serialised = serialiser.serialise(element); + + expect(serialised).to.deep.equal({ + element: 'parseResult', + content: [] + }); + }); + it('serialises empty httpRequest content', function() { var element = new minim.elements.Element([]); element.element = 'httpRequest'; @@ -842,6 +853,17 @@ describe('JSON 0.6 Serialiser', function() { }); }); + it('serialises empty link content', function() { + var element = new minim.elements.Element([]); + element.element = 'link'; + var serialised = serialiser.serialise(element); + + expect(serialised).to.deep.equal({ + element: 'link', + content: [], + }); + }); + it('serialises empty category content', function() { var element = new minim.elements.Element([]); element.element = 'category';