diff --git a/components/avatar/__tests__/Avatar.test.js b/components/avatar/__tests__/Avatar.test.js index 6526db952d..225abfa331 100644 --- a/components/avatar/__tests__/Avatar.test.js +++ b/components/avatar/__tests__/Avatar.test.js @@ -87,7 +87,7 @@ describe('Avatar Render', () => { // https://github.com/jsdom/jsdom/issues/1816 wrapper.find('img').simulate('error'); - expect(wrapper).toMatchSnapshot(); + expect(wrapper.render()).toMatchSnapshot(); expect(div.querySelector('img').getAttribute('src')).toBe(LOAD_SUCCESS_SRC); wrapper.detach(); @@ -105,7 +105,7 @@ describe('Avatar Render', () => { const wrapper = mount(Fallback, { attachTo: div }); wrapper.find('img').simulate('error'); - expect(wrapper).toMatchSnapshot(); + expect(wrapper.render()).toMatchSnapshot(); expect(wrapper.find('.ant-avatar-string').length).toBe(1); // children should show, when image load error without onError return false expect(wrapper.find('.ant-avatar-string').prop('style')).not.toHaveProperty('opacity', 0); @@ -114,7 +114,7 @@ describe('Avatar Render', () => { wrapper.setProps({ src: LOAD_SUCCESS_SRC }); wrapper.update(); - expect(wrapper).toMatchSnapshot(); + expect(wrapper.render()).toMatchSnapshot(); expect(wrapper.find('.ant-avatar-image').length).toBe(1); // cleanup @@ -124,7 +124,7 @@ describe('Avatar Render', () => { it('should calculate scale of avatar children correctly', () => { const wrapper = mount(Avatar); - expect(wrapper.find('.ant-avatar-string')).toMatchSnapshot(); + expect(wrapper.find('.ant-avatar-string').render()).toMatchSnapshot(); Object.defineProperty(HTMLElement.prototype, 'offsetWidth', { get() { @@ -135,12 +135,12 @@ describe('Avatar Render', () => { }, }); wrapper.setProps({ children: 'xx' }); - expect(wrapper.find('.ant-avatar-string')).toMatchSnapshot(); + expect(wrapper.find('.ant-avatar-string').render()).toMatchSnapshot(); }); it('should calculate scale of avatar children correctly with gap', () => { const wrapper = mount(Avatar); - expect(wrapper.find('.ant-avatar-string')).toMatchSnapshot(); + expect(wrapper.find('.ant-avatar-string').render()).toMatchSnapshot(); }); it('should warning when pass a string as icon props', () => { diff --git a/components/avatar/__tests__/__snapshots__/Avatar.test.js.snap b/components/avatar/__tests__/__snapshots__/Avatar.test.js.snap index 8d66c5c98f..80dce08eba 100644 --- a/components/avatar/__tests__/__snapshots__/Avatar.test.js.snap +++ b/components/avatar/__tests__/__snapshots__/Avatar.test.js.snap @@ -110,14 +110,8 @@ exports[`Avatar Render rtl render component should be rendered correctly in RTL exports[`Avatar Render should calculate scale of avatar children correctly 1`] = ` Avatar @@ -125,14 +119,8 @@ exports[`Avatar Render should calculate scale of avatar children correctly 1`] = exports[`Avatar Render should calculate scale of avatar children correctly 2`] = ` xx @@ -140,93 +128,44 @@ exports[`Avatar Render should calculate scale of avatar children correctly 2`] = exports[`Avatar Render should calculate scale of avatar children correctly with gap 1`] = ` Avatar `; exports[`Avatar Render should handle onError correctly 1`] = ` - - + - - - - - + /> + `; exports[`Avatar Render should show image on success after a failure state 1`] = ` - - - - - - Fallback - - - - + Fallback - + `; exports[`Avatar Render should show image on success after a failure state 2`] = ` - - - - - + + `; exports[`Avatar Render support size is number 1`] = `