diff options
author | Francesco <firefelix@gmail.com> | 2015-06-09 16:53:04 +0200 |
---|---|---|
committer | Francesco <firefelix@gmail.com> | 2015-06-09 16:53:04 +0200 |
commit | a54e39b4db5f845841f1258b7398f24d0b1b8117 (patch) | |
tree | a44b31c9e9aa728afa777e142b2e20fb966e480a /lib/__tests__/Rating-test.js | |
parent | 472048d2afd6ede93715cd20fe20156ba6e679f0 (diff) | |
download | react-autosize-textarea-a54e39b4db5f845841f1258b7398f24d0b1b8117.zip react-autosize-textarea-a54e39b4db5f845841f1258b7398f24d0b1b8117.tar.gz react-autosize-textarea-a54e39b4db5f845841f1258b7398f24d0b1b8117.tar.bz2 |
Initial Commitv0.1.0
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'); + }); + +}); |