diff --git a/components/auto-complete/__tests__/__snapshots__/demo.test.js.snap b/components/auto-complete/__tests__/__snapshots__/demo.test.js.snap index d076f989e..c6e8e5da9 100644 --- a/components/auto-complete/__tests__/__snapshots__/demo.test.js.snap +++ b/components/auto-complete/__tests__/__snapshots__/demo.test.js.snap @@ -7,7 +7,7 @@ exports[`renders ./components/auto-complete/demo/basic.md correctly 1`] = `
input here
@@ -53,7 +53,7 @@ exports[`renders ./components/auto-complete/demo/non-case-sensitive.md correctly
input here
@@ -68,7 +68,7 @@ exports[`renders ./components/auto-complete/demo/options.md correctly 1`] = `
input here
diff --git a/components/avatar/Avatar.jsx b/components/avatar/Avatar.jsx index 067c517f3..e02abe4d8 100644 --- a/components/avatar/Avatar.jsx +++ b/components/avatar/Avatar.jsx @@ -34,6 +34,12 @@ export default { scale: 1, }; }, + watch: { + src() { + this.isImgExist = true; + this.scale = 1; + }, + }, mounted() { this.prevChildren = this.$slots.default; this.prevState = { ...this.$data }; diff --git a/components/avatar/__tests__/Avatar.test.js b/components/avatar/__tests__/Avatar.test.js index 956cf9ef6..2990367a8 100644 --- a/components/avatar/__tests__/Avatar.test.js +++ b/components/avatar/__tests__/Avatar.test.js @@ -69,14 +69,20 @@ describe('Avatar Render', () => { }; const wrapper = mount(Foo, { sync: false, attachToDocument: true },); - // mock img load Error, since jsdom do not load resource by default - // https://github.com/jsdom/jsdom/issues/1816 - wrapper.find('img').trigger('error'); - expect(wrapper.find({ name: 'AAvatar' }).vm.isImgExist).toBe(true); - expect(global.document.body.querySelector('img').getAttribute('src')).toBe(LOAD_SUCCESS_SRC); + await asyncExpect(() => { + // mock img load Error, since jsdom do not load resource by default + // https://github.com/jsdom/jsdom/issues/1816 + wrapper.find('img').trigger('error'); + }, 0); + await asyncExpect(() => { + expect(wrapper.find({ name: 'AAvatar' }).vm.isImgExist).toBe(true); + }, 0); + await asyncExpect(() => { + expect(global.document.body.querySelector('img').getAttribute('src')).toBe(LOAD_SUCCESS_SRC); + }, 0); }); - it('should show image on success after a failure state', async () => { + it('should show image on success after a failure state', async() => { global.document.body.innerHTML = ''; const LOAD_FAILURE_SRC = 'http://error.url'; const LOAD_SUCCESS_SRC = 'https://zos.alipayobjects.com/rmsportal/ODTLcjxAfvqbxHnVXCYX.png'; @@ -101,14 +107,14 @@ describe('Avatar Render', () => { await asyncExpect(() => { expect(wrapper.find({ name: 'AAvatar' }).vm.isImgExist).toBe(false); expect(wrapper.findAll('.ant-avatar-string').length).toBe(1); - }); + }, 0); await asyncExpect(() => { - wrapper.setProps({ src: LOAD_SUCCESS_SRC }); + wrapper.setData({ src: LOAD_SUCCESS_SRC }); }); await asyncExpect(() => { expect(wrapper.find({ name: 'AAvatar' }).vm.isImgExist).toBe(true); expect(wrapper.findAll('.ant-avatar-image').length).toBe(1); - }); + }, 0); }); }); diff --git a/components/button/__tests__/__snapshots__/demo.test.js.snap b/components/button/__tests__/__snapshots__/demo.test.js.snap index c7ba670e2..5019e995c 100644 --- a/components/button/__tests__/__snapshots__/demo.test.js.snap +++ b/components/button/__tests__/__snapshots__/demo.test.js.snap @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`renders ./components/button/demo/basic.md correctly 1`] = `
`; +exports[`renders ./components/button/demo/basic.md correctly 1`] = `
`; exports[`renders ./components/button/demo/block.md correctly 1`] = `
`; @@ -77,7 +77,9 @@ exports[`renders ./components/button/demo/size.md correctly 1`] = `




diff --git a/components/card/__tests__/__snapshots__/index.test.js.snap b/components/card/__tests__/__snapshots__/index.test.js.snap index 7c2b47bf3..5b491c89c 100644 --- a/components/card/__tests__/__snapshots__/index.test.js.snap +++ b/components/card/__tests__/__snapshots__/index.test.js.snap @@ -44,17 +44,6 @@ exports[`Card should still have padding when card which set padding to 0 is load
-
-
-
-
-
-
-
-
-
-
-
diff --git a/components/cascader/__tests__/__snapshots__/demo.test.js.snap b/components/cascader/__tests__/__snapshots__/demo.test.js.snap index 42bdbf2e0..39bb13c97 100644 --- a/components/cascader/__tests__/__snapshots__/demo.test.js.snap +++ b/components/cascader/__tests__/__snapshots__/demo.test.js.snap @@ -1,19 +1,19 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`renders ./components/cascader/demo/basic.md correctly 1`] = ` - `; exports[`renders ./components/cascader/demo/change-on-select.md correctly 1`] = ` - `; exports[`renders ./components/cascader/demo/custom-render.md correctly 1`] = ` - + Zhejiang / Hangzhou / @@ -34,7 +34,7 @@ exports[`renders ./components/cascader/demo/custom-trigger.md correctly 1`] = ` `; exports[`renders ./components/cascader/demo/default-value.md correctly 1`] = ` -Zhejiang / Hangzhou / West LakeZhejiang / Hangzhou / West Lake `; exports[`renders ./components/cascader/demo/fields-name.md correctly 1`] = ` - `; exports[`renders ./components/cascader/demo/hover.md correctly 1`] = ` - `; exports[`renders ./components/cascader/demo/lazy.md correctly 1`] = ` - `; exports[`renders ./components/cascader/demo/search.md correctly 1`] = ` - `; exports[`renders ./components/cascader/demo/size.md correctly 1`] = ` -










`; exports[`renders ./components/cascader/demo/suffix.md correctly 1`] = ` -
ab
+
ab
`; diff --git a/components/cascader/__tests__/__snapshots__/index.test.js.snap b/components/cascader/__tests__/__snapshots__/index.test.js.snap index 2c27cf2c1..b457796d9 100644 --- a/components/cascader/__tests__/__snapshots__/index.test.js.snap +++ b/components/cascader/__tests__/__snapshots__/index.test.js.snap @@ -95,7 +95,7 @@ exports[`Cascader popup correctly with defaultValue 1`] = ` `; exports[`Cascader support controlled mode 1`] = ` -Zhejiang / Hangzhou / West LakeZhejiang / Hangzhou / West Lake
-
-
-
@@ -11746,9 +12026,14 @@ exports[`Locale Provider should display the text as nl 1`] = `
0 item
+
+
+
Geen gegevens
+

Geen gegevens

+
+
@@ -12145,9 +12435,14 @@ exports[`Locale Provider should display the text as nl-be 1`] = `
0 item
+
+
+
Geen gegevens
+

Geen gegevens

+
+
@@ -12544,9 +12844,14 @@ exports[`Locale Provider should display the text as pl 1`] = `
0 obiekt
+
+
+
Brak danych
+

Brak danych

+
+
@@ -12943,9 +13253,14 @@ exports[`Locale Provider should display the text as pt 1`] = `
0 item
+
+
+
Sem resultados
+

Sem resultados

+
+
@@ -13342,9 +13662,14 @@ exports[`Locale Provider should display the text as pt-br 1`] = `
0 item
+
+
+
Não há dados
+

Não há dados

+
+
@@ -13741,9 +14071,14 @@ exports[`Locale Provider should display the text as ru 1`] = `
0 элем.
+
+
+
Нет данных
+

Нет данных

+
+
@@ -14140,9 +14480,14 @@ exports[`Locale Provider should display the text as sk 1`] = `
0 položka
+
+
+
Žiadne dáta
+

Žiadne dáta

+
+
@@ -14539,9 +14889,14 @@ exports[`Locale Provider should display the text as sl 1`] = `
0 Objekt
+
+
+
Ni podatkov
+

Ni podatkov

+
+
@@ -14938,9 +15298,14 @@ exports[`Locale Provider should display the text as sr 1`] = `
0 stavka
+
+
+
Nema podataka
+

Nema podataka

+
+
@@ -15337,9 +15707,14 @@ exports[`Locale Provider should display the text as sv 1`] = `
0 element
+
+
+
Ingen information
+

Ingen information

+
+
@@ -15736,9 +16116,14 @@ exports[`Locale Provider should display the text as th 1`] = `
0 ชิ้น
+
+
+
ไม่มีข้อมูล
+

ไม่มีข้อมูล

+
+
@@ -16135,9 +16525,14 @@ exports[`Locale Provider should display the text as tr 1`] = `
0 Öğe
+
+
+
Veri Yok
+

Veri Yok

+
+
@@ -16534,9 +16934,14 @@ exports[`Locale Provider should display the text as uk 1`] = `
0 item
+
+
+
Даних немає
+

Даних немає

+
+
@@ -16933,9 +17343,14 @@ exports[`Locale Provider should display the text as vi 1`] = `
0 mục
+
+
+
Trống
+

Trống

+
+
@@ -17332,9 +17752,14 @@ exports[`Locale Provider should display the text as zh-cn 1`] = `
0 项
+
+
+
暂无数据
+

暂无数据

+
+
@@ -17731,9 +18161,14 @@ exports[`Locale Provider should display the text as zh-tw 1`] = `
0 項目
+
+
+
無此資料
+

無此資料

+
+
diff --git a/components/radio/RadioButton.jsx b/components/radio/RadioButton.jsx index 5c8f66cc4..ffa507bb3 100644 --- a/components/radio/RadioButton.jsx +++ b/components/radio/RadioButton.jsx @@ -25,8 +25,8 @@ export default { }, on: { ...this.$listeners } }; if (this.radioGroupContext) { radioProps.on.change = this.radioGroupContext.onRadioChange; - radioProps.props.checked = props.value === this.radioGroupContext.stateValue; - radioProps.props.disabled = props.disabled || this.radioGroupContext.disabled; + radioProps.props.checked = this.$props.value === this.radioGroupContext.stateValue; + radioProps.props.disabled = this.$props.disabled || this.radioGroupContext.disabled; } return {this.$slots.default}; }, diff --git a/components/rate/__tests__/__snapshots__/demo.test.js.snap b/components/rate/__tests__/__snapshots__/demo.test.js.snap index bd976d3d2..74e0830b8 100644 --- a/components/rate/__tests__/__snapshots__/demo.test.js.snap +++ b/components/rate/__tests__/__snapshots__/demo.test.js.snap @@ -317,4 +317,4 @@ exports[`renders ./components/rate/demo/half.md correctly 1`] = ` `; -exports[`renders ./components/rate/demo/text.md correctly 1`] = `
3 stars
`; +exports[`renders ./components/rate/demo/text.md correctly 1`] = `
normal
`; diff --git a/components/transfer/__tests__/__snapshots__/demo.test.js.snap b/components/transfer/__tests__/__snapshots__/demo.test.js.snap index cccb49b8a..fb7eb5219 100644 --- a/components/transfer/__tests__/__snapshots__/demo.test.js.snap +++ b/components/transfer/__tests__/__snapshots__/demo.test.js.snap @@ -6,7 +6,7 @@ exports[`renders ./components/transfer/demo/advanced.md correctly 1`] = `
20 items
@@ -2180,7 +2187,7 @@ exports[`renders ./components/transfer/demo/search.md correctly 1`] = `
20 items
diff --git a/components/transfer/__tests__/__snapshots__/search.test.js.snap b/components/transfer/__tests__/__snapshots__/search.test.js.snap index 345f13b20..6e6dabbfb 100644 --- a/components/transfer/__tests__/__snapshots__/search.test.js.snap +++ b/components/transfer/__tests__/__snapshots__/search.test.js.snap @@ -1,9 +1,9 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`Search should show cross icon when input value exists 1`] = `
`; +exports[`Search should show cross icon when input value exists 1`] = `
`; exports[`Search should show cross icon when input value exists 2`] = ` -
`; diff --git a/components/upload/__tests__/__snapshots__/uploadlist.test.js.snap b/components/upload/__tests__/__snapshots__/uploadlist.test.js.snap index 1e23a3a78..55f3731d5 100644 --- a/components/upload/__tests__/__snapshots__/uploadlist.test.js.snap +++ b/components/upload/__tests__/__snapshots__/uploadlist.test.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`Upload List handle error 1`] = ` -
foo.png
foo.png
@@ -20,7 +20,7 @@ exports[`Upload List handle error 1`] = ` `; exports[`Upload List handle error 2`] = ` -
foo.png
foo.png
@@ -38,7 +38,7 @@ exports[`Upload List handle error 2`] = ` `; -exports[`Upload List should be uploading when upload a file 1`] = `
`; +exports[`Upload List should be uploading when upload a file 1`] = `
`; exports[`Upload List should non-image format file preview 1`] = `