diff options
Diffstat (limited to 'lib/__tests__/Rating-test.js')
-rw-r--r-- | lib/__tests__/Rating-test.js | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/lib/__tests__/Rating-test.js b/lib/__tests__/Rating-test.js new file mode 100644 index 0000000..75734cc --- /dev/null +++ b/lib/__tests__/Rating-test.js @@ -0,0 +1,30 @@ +var React = require('react/addons'); +var TestUtils = React.addons.TestUtils; +var expect = require('expect'); +var {Rating, RatingIcon} = require('../'); + +describe('Rating', function() { + + it('should render 5 RatingIcons as default', function() { + var ratingWrapper = TestUtils.renderIntoDocument( + <div> + <Rating onRate={() => {}} /> + </div> + ); + + var ratingIcons = TestUtils.scryRenderedComponentsWithType(ratingWrapper, RatingIcon); + expect(ratingIcons.length).toBe(5, 'Rating is not rendering 5 icons as default'); + }); + + it('should render 3 RatingIcons', function() { + var ratingWrapper = TestUtils.renderIntoDocument( + <div> + <Rating onRate={() => {}} maxRating={3} /> + </div> + ); + + var ratingIcons = TestUtils.scryRenderedComponentsWithType(ratingWrapper, RatingIcon); + expect(ratingIcons.length).toBe(3, 'Rating is not renderin 3 icons'); + }); + +}); |