react-key-value
Advanced tools
Comparing version 1.0.4 to 1.1.0
@@ -101,2 +101,11 @@ 'use strict'; | ||
}, | ||
toJSON: function toJSON() { | ||
var _state$rows = this.state.rows, | ||
rows = _state$rows === undefined ? [] : _state$rows; | ||
return rows.reduce(function (acc, row) { | ||
acc[row.keyItem] = row.valueItem; | ||
return acc; | ||
}, {}); | ||
}, | ||
renderLabelText: function renderLabelText(text) { | ||
@@ -103,0 +112,0 @@ if (this.props.hideLabels === true) { |
@@ -111,2 +111,16 @@ 'use strict'; | ||
}); | ||
it('should return a json representation of rows', function () { | ||
var rows = [{ | ||
keyItem: 'foo', | ||
valueItem: 'bar' | ||
}, { | ||
keyItem: 'lorem', | ||
valueItem: 'ipsum' | ||
}]; | ||
var $ = (0, _enzyme.shallow)(_react2.default.createElement(_keyValue2.default, { rows: rows })); | ||
$.instance().toJSON().should.eql({ | ||
foo: 'bar', | ||
lorem: 'ipsum' | ||
}); | ||
}); | ||
}); |
{ | ||
"name": "react-key-value", | ||
"version": "1.0.4", | ||
"version": "1.1.0", | ||
"description": "Key value visualizer/editor written in React", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
19710
10
342