Skip to content

Commit fdaabcb

Browse files
author
Nir Maoz
authored
Add test for image update on prop change (#174)
1 parent 2f8d02e commit fdaabcb

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

test/ImageTest.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,14 @@ describe('Image', () => {
9494

9595
expect(tag.find('img').prop('src')).to.match(/fn_wasm:blur.wasm\/sample/);
9696
});
97+
it('should update on prop change', () => {
98+
let tag = mount(<Image publicId="sample" cloudName="demo"/>);
99+
expect(tag.find('img').prop('src')).to.equal('http://res.cloudinary.com/demo/image/upload/sample');
100+
tag.setProps({effect: 'sepia:20'});
101+
expect(tag.find('img').prop('src')).to.equal('http://res.cloudinary.com/demo/image/upload/e_sepia:20/sample');
102+
tag.setProps({effect: 'sepia:30', secure:true});
103+
expect(tag.find('img').prop('src')).to.equal('https://res.cloudinary.com/demo/image/upload/e_sepia:30/sample');
104+
});
97105
it('Should support forwarding innerRef to underlying image element', function () {
98106
const expected = 'http://res.cloudinary.com/demo/image/upload/sample';
99107
let myRef = React.createRef();

0 commit comments

Comments
 (0)