From 7a654f614ffa870a17f7b2430940518d34076bcc Mon Sep 17 00:00:00 2001 From: "Daniel G. Taylor" Date: Tue, 24 Nov 2015 12:14:45 -0800 Subject: [PATCH] Fix a bug when loading compact refract attributes; bump to 0.12.1 --- CHANGELOG.md | 4 ++++ lib/primitives/base-element.js | 2 +- package.json | 2 +- test/subclass-test.js | 5 +++++ 4 files changed, 11 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 98746df0..86b837ec 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +# 0.12.1 - 2015-11-24 + +- Fix a bug when loading refracted attributes from compact refract. + # 0.12.0 - 2015-11-23 - Provide a way for elements to mark attributes as unrefracted arrays of diff --git a/lib/primitives/base-element.js b/lib/primitives/base-element.js index e7f09633..db688c15 100644 --- a/lib/primitives/base-element.js +++ b/lib/primitives/base-element.js @@ -137,7 +137,7 @@ module.exports = function(registry) { this.content = tuple[3]; this.convertAttributesToElements(function(attribute) { - registry.fromCompactRefract(attribute); + return registry.fromCompactRefract(attribute); }); if (this.element !== tuple[0]) { diff --git a/package.json b/package.json index f6f7e1ef..67775297 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "minim", - "version": "0.12.0", + "version": "0.12.1", "description": "A library for interacting with JSON through Refract elements", "main": "lib/minim.js", "scripts": { diff --git a/test/subclass-test.js b/test/subclass-test.js index 6f8a812e..c8dbdf65 100644 --- a/test/subclass-test.js +++ b/test/subclass-test.js @@ -100,5 +100,10 @@ describe('Minim subclasses', function() { ] }, null]); }); + + it('should round-trip', function() { + const refracted = myElement.toCompactRefract(); + expect(myElement.fromCompactRefract(refracted).toCompactRefract()).to.deep.equal(refracted); + }); }); });