-
Notifications
You must be signed in to change notification settings - Fork 833
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
141 additions
and
233 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,46 +1,48 @@ | ||
import { mount } from '@vue/test-utils'; | ||
import Empty from '../../empty/index.vue'; | ||
|
||
describe('Empty', () => { | ||
test('should be shown when passing image and description', () => { | ||
const wrapper = mount(Empty, { | ||
props: { | ||
image: 'empty', | ||
description: '这是文字描述' | ||
} | ||
}); | ||
|
||
expect(wrapper.html()).toContain('img'); | ||
expect(wrapper.html()).toContain('这是文字描述'); | ||
test('Empty: should be shown when passing image and description', () => { | ||
const wrapper = mount(Empty, { | ||
props: { | ||
image: 'empty', | ||
imageSize: '50', | ||
description: '这是文字描述' | ||
} | ||
}); | ||
|
||
test('should be shown when passing slot image', () => { | ||
const wrapper = mount(Empty, { | ||
slots: { | ||
image: '<img src="https://abc.png"/>' | ||
} | ||
}); | ||
expect(wrapper.html()).toContain('img'); | ||
expect(wrapper.html()).toContain('这是文字描述'); | ||
}); | ||
|
||
expect(wrapper.html()).toContain('abc.png'); | ||
test('Empty: should be shown when passing slot image', () => { | ||
const wrapper = mount(Empty, { | ||
slots: { | ||
image: '<img src="https://abc.png"/>' | ||
} | ||
}); | ||
|
||
test('should be shown when passing slot description', () => { | ||
const wrapper = mount(Empty, { | ||
slots: { | ||
description: 'test' | ||
} | ||
}); | ||
expect(wrapper.html()).toContain('abc.png'); | ||
}); | ||
|
||
expect(wrapper.html()).toContain('test'); | ||
test('Empty: should be shown when passing slot description', () => { | ||
const wrapper = mount(Empty, { | ||
props: { | ||
image: 'https://abc.png' | ||
}, | ||
slots: { | ||
description: 'test' | ||
} | ||
}); | ||
|
||
test('should be shown when passing slot defalut', () => { | ||
const wrapper = mount(Empty, { | ||
slots: { | ||
default: '加载失败,请刷新页面' | ||
} | ||
}); | ||
expect(wrapper.html()).toContain('test'); | ||
}); | ||
|
||
expect(wrapper.html()).toContain('加载失败'); | ||
test('Empty: should be shown when passing slot defalut', () => { | ||
const wrapper = mount(Empty, { | ||
slots: { | ||
default: '加载失败,请刷新页面' | ||
} | ||
}); | ||
|
||
expect(wrapper.html()).toContain('加载失败'); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.