Skip to content

Commit

Permalink
test(ui): switch error message for chinese to english
Browse files Browse the repository at this point in the history
  • Loading branch information
chouchouji committed Aug 28, 2024
1 parent 09902fb commit b0836fb
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions packages/varlet-ui/src/counter/__tests__/index.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ test('test counter readonly', async () => {
test('test counter validation', async () => {
const wrapper = mount({
...Wrapper,
template: `<var-counter ref="counter" :rules="[v => v > 0 || '必须大于0']" v-model="value" />`,
template: `<var-counter ref="counter" :rules="[v => v > 0 || 'The value must be more that zero']" v-model="value" />`,
})

const { counter } = wrapper.vm.$refs
Expand All @@ -156,7 +156,7 @@ test('test counter validation', async () => {
await delay(16)

expect(wrapper.html()).toMatchSnapshot()

Check failure on line 158 in packages/varlet-ui/src/counter/__tests__/index.spec.js

View workflow job for this annotation

GitHub Actions / test

src/counter/__tests__/index.spec.js > test counter validation

Error: Snapshot `test counter validation 1` mismatched - Expected + Received @@ -10,11 +10,11 @@ </button></div> <transition-stub name="var-form-details" appear="false" persisted="false" css="true"> <div class="var-form-details"> <div class="var-form-details__error-message"> <transition-stub name="var-form-details__message" appear="false" persisted="false" css="true"> - <div>必须大于0</div> + <div>The value must be more that zero</div> </transition-stub> </div> <div class="var-form-details__extra-message"> <transition-stub name="var-form-details__message" appear="false" persisted="false" css="true"> <!--v-if--> ❯ src/counter/__tests__/index.spec.js:158:26
expect(wrapper.find('.var-form-details__error-message').text()).toBe('必须大于0')
expect(wrapper.find('.var-form-details__error-message').text()).toBe('The value must be more that zero')

await wrapper.find('.var-counter__increment-button').trigger('click')
await delay(16)
Expand Down
4 changes: 2 additions & 2 deletions packages/varlet-ui/src/rate/__tests__/index.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -248,14 +248,14 @@ describe('test rate component props', () => {
const wrapper = mount(VarRate, {
props: {
modelValue: 0,
rules: [(v) => v >= 1 || '至少选择一分'],
rules: [(v) => v >= 1 || 'The lowest score is one'],
'onUpdate:modelValue': onUpdateModelValue,
},
})

wrapper.vm.validate()
await delay(16)
expect(wrapper.find('.var-form-details__error-message').text()).toBe('至少选择一分')
expect(wrapper.find('.var-form-details__error-message').text()).toBe('The lowest score is one')
await wrapper.find('.var-rate__content').trigger('click')
await delay(16)
expect(wrapper.find('.var-form-details__error-message').exists()).toBeFalsy()
Expand Down
8 changes: 4 additions & 4 deletions packages/varlet-ui/src/uploader/__tests__/index.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -246,15 +246,15 @@ test('test uploader validation', async () => {
const wrapper = mount(VarUploader, {
props: {
modelValue: [],
rules: [(v) => v.length >= 1 || '您至少上传一个'],
rules: [(v) => v.length >= 1 || 'You must upload one file at least'],
'onUpdate:modelValue': onUpdateModelValue,
},
})

wrapper.vm.validate()
await delay(16)
expect(wrapper.html()).toMatchSnapshot()

Check failure on line 256 in packages/varlet-ui/src/uploader/__tests__/index.spec.js

View workflow job for this annotation

GitHub Actions / test

src/uploader/__tests__/index.spec.js > test uploader validation

Error: Snapshot `test uploader validation 1` mismatched - Expected + Received @@ -6,11 +6,11 @@ </div> <transition-stub name="var-form-details" appear="false" persisted="false" css="true"> <div class="var-form-details"> <div class="var-form-details__error-message"> <transition-stub name="var-form-details__message" appear="false" persisted="false" css="true"> - <div>您至少上传一个</div> + <div>You must upload one file at least</div> </transition-stub> </div> <div class="var-form-details__extra-message"> <transition-stub name="var-form-details__message" appear="false" persisted="false" css="true"> <!--v-if--> ❯ src/uploader/__tests__/index.spec.js:256:26
expect(wrapper.find('.var-form-details__error-message').text()).toBe('您至少上传一个')
expect(wrapper.find('.var-form-details__error-message').text()).toBe('You must upload one file at least')

await wrapper.vm.handleChange(createEvent('cat.png', 'image/png'))
await delay(16)
Expand Down Expand Up @@ -409,12 +409,12 @@ test('test uploader progress', () => {
test('test uploader extra slot', async () => {
const wrapper = mount(VarUploader, {
slots: {
'extra-message': () => '还能上传3个文件',
'extra-message': () => 'There are three files rest to upload',
},
})

await delay(100)
expect(wrapper.find('.var-form-details__extra-message').text()).toBe('还能上传3个文件')
expect(wrapper.find('.var-form-details__extra-message').text()).toBe('There are three files rest to upload')

wrapper.unmount()
})
Expand Down

0 comments on commit b0836fb

Please sign in to comment.