react-star-rating-input
Advanced tools
Comparing version 3.1.0 to 4.0.0
@@ -10,3 +10,3 @@ (function () { | ||
render: function () { | ||
return StarRatingInput.Klass({ | ||
return React.createElement(StarRatingInput.Klass, { | ||
value: this.state.value, | ||
@@ -23,3 +23,3 @@ onChange: function (value) { this.setState({value: value}); }.bind(this) | ||
insertCss(StarRatingInput.css); | ||
React.renderComponent(Container(), global.document.body); | ||
React.render(React.createElement(Container), global.document.body); | ||
}()); |
{ | ||
"name": "react-star-rating-input", | ||
"version": "3.1.0", | ||
"version": "4.0.0", | ||
"description": "React.js component for entering 0-5 stars", | ||
@@ -40,9 +40,10 @@ "main": "index.js", | ||
"dependencies": { | ||
"react": "^0.11.2" | ||
"react": "^0.12.0" | ||
}, | ||
"devDependencies": { | ||
"brfs": "^1.2.0", | ||
"browserify": "^5.11.2", | ||
"browserify": "^6.3.2", | ||
"insert-css": "^0.2.0", | ||
"jsdom": "^1.0.0-pre.6", | ||
"jsdom": "^1.2.1", | ||
"jsdom-test-browser": "^2.0.0", | ||
"jshint": "^2.5.5", | ||
@@ -49,0 +50,0 @@ "mocha": "^1.21.4", |
@@ -1,4 +0,4 @@ | ||
// That module must be really simple. Otherwise, brfs won't work, | ||
// That module must be really simple. Otherwise, brfs won't work. | ||
var fs = require('fs'); | ||
module.exports = fs.readFileSync(__dirname + '/../www/styles.css', 'utf8'); |
@@ -5,4 +5,7 @@ describe('package index', function () { | ||
var assert = require('assert'), | ||
bro = require('jsdom-test-browser'), | ||
api = require('../index.js'); | ||
assert(bro); | ||
it('exports the component class', function () { | ||
@@ -9,0 +12,0 @@ assert(api.Klass); |
@@ -6,3 +6,4 @@ describe('StarRatingInput', function () { | ||
sinon = require('sinon'), | ||
jsdom = require('jsdom'), | ||
bro = require('jsdom-test-browser'), | ||
React = require('react'), | ||
TestUtils = require('react/addons').addons.TestUtils, | ||
@@ -13,22 +14,6 @@ StarRatingInput = require('../src/StarRatingInput'), | ||
return {value: value, onChange: (onChange ? onChange : function () {})}; | ||
}, | ||
}; | ||
$; | ||
before(function (done) { bro.jQueryify(done); }); | ||
this.timeout(4000); | ||
beforeEach(function (done) { | ||
global.document = jsdom.jsdom('<html><body></body></html>', jsdom.level(1, 'core')); | ||
global.window = global.document.parentWindow; | ||
jsdom.jQueryify(global.window, 'http://code.jquery.com/jquery-1.11.0.min.js', function () { | ||
$ = global.window.$; | ||
done(); | ||
}); | ||
}); | ||
afterEach(function () { | ||
global.window.close(); | ||
}); | ||
['value', 'onChange'].forEach(function (p) { | ||
@@ -44,15 +29,17 @@ it('declares the ' + p + ' property', function () { | ||
beforeEach(function () { | ||
element = TestUtils.renderIntoDocument(StarRatingInput(props(0))).getDOMNode(); | ||
element = TestUtils.renderIntoDocument( | ||
React.createElement(StarRatingInput, props(0)) | ||
).getDOMNode(); | ||
}); | ||
it('has the root element\'s class assigned', function () { | ||
assert($(element).hasClass('star-rating-input')); | ||
assert(bro.$(element).hasClass('star-rating-input')); | ||
}); | ||
it('has the "Clear" link', function () { | ||
assert.strictEqual($('a.star-rating-clear', element).text(), 'Clear'); | ||
assert.strictEqual(bro.$('a.star-rating-clear', element).text(), 'Clear'); | ||
}); | ||
it('has the 5 star items', function () { | ||
assert.strictEqual($('.star-rating-star-container', element).size(), 5); | ||
assert.strictEqual(bro.$('.star-rating-star-container', element).size(), 5); | ||
}); | ||
@@ -63,13 +50,16 @@ }); | ||
var assertState = function (element, onCount, offCount, suggestedCount) { | ||
assert.strictEqual($('.star-rating-star-container a.on', element).size(), onCount); | ||
assert.strictEqual(bro.$('.star-rating-star-container a.on', element).size(), onCount); | ||
assert.strictEqual( | ||
$('.star-rating-star-container a.off', element).size(), offCount); | ||
bro.$('.star-rating-star-container a.off', element).size(), offCount); | ||
assert.strictEqual( | ||
$('.star-rating-star-container a.suggested', element).size(), suggestedCount); | ||
bro.$('.star-rating-star-container a.suggested', element).size(), suggestedCount); | ||
}, | ||
element = function (value, prospectiveValue) { | ||
var component = TestUtils.renderIntoDocument(StarRatingInput(props(value))); | ||
var component = TestUtils.renderIntoDocument( | ||
React.createElement(StarRatingInput, props(value)) | ||
); | ||
component.setState({prospectiveValue: prospectiveValue}); | ||
@@ -92,3 +82,5 @@ return component.getDOMNode(); | ||
beforeEach(function () { | ||
component = TestUtils.renderIntoDocument(StarRatingInput({onChange: function () {}})); | ||
component = TestUtils.renderIntoDocument( | ||
React.createElement(StarRatingInput, {onChange: function () {}}) | ||
); | ||
}); | ||
@@ -111,3 +103,7 @@ | ||
spy = sinon.spy(); | ||
component = TestUtils.renderIntoDocument(StarRatingInput(props(1, spy))); | ||
component = TestUtils.renderIntoDocument( | ||
React.createElement(StarRatingInput, props(1, spy)) | ||
); | ||
component.setState({prospectiveValue: 2}); | ||
@@ -114,0 +110,0 @@ }); |
Sorry, the diff of this file is not supported yet
22653
9
258
+ Addedacorn@5.7.4(transitive)
+ Addedast-types@0.9.6(transitive)
+ Addedbalanced-match@1.0.2(transitive)
+ Addedbase62@1.2.8(transitive)
+ Addedbrace-expansion@1.1.11(transitive)
+ Addedcommander@2.20.3(transitive)
+ Addedcommoner@0.10.8(transitive)
+ Addedconcat-map@0.0.1(transitive)
+ Addeddefined@1.0.1(transitive)
+ Addeddetective@4.7.1(transitive)
+ Addedenvify@3.4.1(transitive)
+ Addedesprima@3.1.3(transitive)
+ Addedesprima-fb@15001.1.0-dev-harmony-fb(transitive)
+ Addedglob@5.0.15(transitive)
+ Addedgraceful-fs@4.2.11(transitive)
+ Addediconv-lite@0.4.24(transitive)
+ Addedinflight@1.0.6(transitive)
+ Addedinherits@2.0.4(transitive)
+ Addedjstransform@11.0.3(transitive)
+ Addedminimatch@3.1.2(transitive)
+ Addedminimist@1.2.8(transitive)
+ Addedmkdirp@0.5.6(transitive)
+ Addedobject-assign@2.1.1(transitive)
+ Addedonce@1.4.0(transitive)
+ Addedpath-is-absolute@1.0.1(transitive)
+ Addedprivate@0.1.8(transitive)
+ Addedq@1.5.1(transitive)
+ Addedreact@0.12.2(transitive)
+ Addedrecast@0.11.23(transitive)
+ Addedsafer-buffer@2.1.2(transitive)
+ Addedsource-map@0.4.40.5.7(transitive)
+ Addedwrappy@1.0.2(transitive)
- Removedbase62@0.1.1(transitive)
- Removedenvify@2.0.1(transitive)
- Removedesprima-fb@3001.1.0-dev-harmony-fb(transitive)
- Removedjstransform@3.0.0(transitive)
- Removedobject-keys@0.4.0(transitive)
- Removedreact@0.11.2(transitive)
- Removedsource-map@0.1.31(transitive)
- Removedxtend@2.1.2(transitive)
Updatedreact@^0.12.0