Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-star-rating-input

Package Overview
Dependencies
Maintainers
1
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-star-rating-input - npm Package Compare versions

Comparing version 4.0.0 to 4.1.0

2

package.json
{
"name": "react-star-rating-input",
"version": "4.0.0",
"version": "4.1.0",
"description": "React.js component for entering 0-5 stars",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -13,3 +13,3 @@ (function () {

getDefaultProps: function () {
return {value: 0};
return {value: 0, size: 5};
},

@@ -48,5 +48,8 @@

starItems: function () {
return [1, 2, 3, 4, 5].map(function (value) {
return this.starItem(value, this.anchorMode(value));
}.bind(this));
var stars = [],
i;
for (i = 1; i <= this.props.size; i += 1) {
stars.push(this.starItem(i, this.anchorMode(i)));
}
return stars;
},

@@ -53,0 +56,0 @@

@@ -11,4 +11,4 @@ describe('StarRatingInput', function () {

props = function (value, onChange) {
return {value: value, onChange: (onChange ? onChange : function () {})};
props = function (value, size, onChange) {
return {value: value, size: size || 5, onChange: (onChange ? onChange : function () {})};
};

@@ -25,21 +25,23 @@

describe('static markup', function () {
var element;
beforeEach(function () {
element = TestUtils.renderIntoDocument(
React.createElement(StarRatingInput, props(0))
var element = function (size) {
return TestUtils.renderIntoDocument(
React.createElement(StarRatingInput, props(0, size))
).getDOMNode();
});
};
it('has the root element\'s class assigned', function () {
assert(bro.$(element).hasClass('star-rating-input'));
assert(bro.$(element()).hasClass('star-rating-input'));
});
it('has the "Clear" link', function () {
assert.strictEqual(bro.$('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(bro.$('.star-rating-star-container', element).size(), 5);
it('has the 5 star items as default', function () {
assert.strictEqual(bro.$('.star-rating-star-container', element()).size(), 5);
});
it('has the N star items', function () {
assert.strictEqual(bro.$('.star-rating-star-container', element(10)).size(), 10);
});
});

@@ -102,3 +104,3 @@

component = TestUtils.renderIntoDocument(
React.createElement(StarRatingInput, props(1, spy))
React.createElement(StarRatingInput, props(1, 5, spy))
);

@@ -105,0 +107,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc