Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Improvement] Rebuild test system (#1051)
- Loading branch information
1 parent
360f2f4
commit a55eda8
Showing
185 changed files
with
4,990 additions
and
7,951 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
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
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 |
---|---|---|
|
@@ -30,7 +30,7 @@ export default { | |
data() { | ||
return { | ||
value: '', | ||
value: '123', | ||
showKeyboard: true | ||
}; | ||
}, | ||
|
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 |
---|---|---|
|
@@ -76,7 +76,7 @@ export default { | |
data() { | ||
return { | ||
active: 0 | ||
active: 1 | ||
}; | ||
}, | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,7 +24,7 @@ Vue.use(Step).use(Steps); | |
export default { | ||
data() { | ||
return { | ||
active: 0 | ||
active: 1 | ||
}; | ||
} | ||
} | ||
|
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 |
---|---|---|
|
@@ -24,7 +24,7 @@ Vue.use(Step).use(Steps); | |
export default { | ||
data() { | ||
return { | ||
active: 0 | ||
active: 1 | ||
}; | ||
} | ||
} | ||
|
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
67 changes: 67 additions & 0 deletions
67
packages/actionsheet/test/__snapshots__/index.spec.js.snap
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 |
---|---|---|
@@ -0,0 +1,67 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`callback events 1`] = ` | ||
<div class="van-actionsheet" style="display: none;" name="van-slide-bottom"> | ||
<ul class="van-hairline--bottom"> | ||
<li class="van-actionsheet__item van-hairline--top"><span class="van-actionsheet__name">Option</span> | ||
<!----> | ||
</li> | ||
<li class="van-actionsheet__item van-hairline--top"><span class="van-actionsheet__name">Option</span> | ||
<!----> | ||
</li> | ||
</ul> | ||
<div class="van-actionsheet__cancel van-hairline--top">Cancel</div> | ||
</div> | ||
`; | ||
|
||
exports[`renders actionsheet correctly 1`] = ` | ||
<div> | ||
<div> | ||
<button class="van-button van-button--default van-button--normal"> | ||
<!----><span class="van-button__text">弹出 Actionsheet</span></button> | ||
<div class="van-actionsheet" style="display:none;"> | ||
<ul class="van-hairline--bottom"> | ||
<li class="van-actionsheet__item van-hairline--top"><span class="van-actionsheet__name">选项</span> | ||
<!----> | ||
</li> | ||
<li class="van-actionsheet__item van-hairline--top"><span class="van-actionsheet__name">选项</span> <span class="van-actionsheet__subname">描述信息</span></li> | ||
<li class="van-actionsheet__item van-hairline--top"> | ||
<div class="van-loading van-loading--circular van-loading--black van-actionsheet__loading" style="width:20px;height:20px;"><span class="van-loading__spinner van-loading__spinner--circular"> <svg viewBox="25 25 50 50" class="van-loading__circular"><circle cx="50" cy="50" r="20" fill="none"></circle></svg></span></div> | ||
</li> | ||
</ul> | ||
<div class="van-actionsheet__content"></div> | ||
</div> | ||
</div> | ||
<div> | ||
<button class="van-button van-button--default van-button--normal"> | ||
<!----><span class="van-button__text">弹出带取消按钮的 Actionsheet</span></button> | ||
<div class="van-actionsheet" style="display:none;"> | ||
<ul class="van-hairline--bottom"> | ||
<li class="van-actionsheet__item van-hairline--top"><span class="van-actionsheet__name">选项</span> | ||
<!----> | ||
</li> | ||
<li class="van-actionsheet__item van-hairline--top"><span class="van-actionsheet__name">选项</span> <span class="van-actionsheet__subname">描述信息</span></li> | ||
<li class="van-actionsheet__item van-hairline--top"> | ||
<div class="van-loading van-loading--circular van-loading--black van-actionsheet__loading" style="width:20px;height:20px;"><span class="van-loading__spinner van-loading__spinner--circular"> <svg viewBox="25 25 50 50" class="van-loading__circular"><circle cx="50" cy="50" r="20" fill="none"></circle></svg></span></div> | ||
</li> | ||
</ul> | ||
<div class="van-actionsheet__cancel van-hairline--top">取消</div> | ||
</div> | ||
</div> | ||
<div> | ||
<button class="van-button van-button--default van-button--normal"> | ||
<!----><span class="van-button__text">弹出带标题的 Actionsheet</span></button> | ||
<div class="van-actionsheet van-actionsheet--withtitle" style="display:none;"> | ||
<div class="van-hairline--top-bottom van-actionsheet__header"> | ||
<div>标题</div> | ||
<i class="van-icon van-icon-close" style="color:undefined;"> | ||
<!----> | ||
</i> | ||
</div> | ||
<div class="van-actionsheet__content"> | ||
<p>内容</p> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
`; |
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 |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { shallow } from '@vue/test-utils'; | ||
import Actionsheet from '../'; | ||
import demoTest from '../../../test/demo-test'; | ||
|
||
demoTest(Actionsheet); | ||
|
||
test('callback events', () => { | ||
const callback = jest.fn(); | ||
const wrapper = shallow(Actionsheet, { | ||
propsData: { | ||
actions: [ | ||
{ name: 'Option', callback }, | ||
{ name: 'Option' } | ||
], | ||
cancelText: 'Cancel' | ||
} | ||
}); | ||
|
||
wrapper.findAll('li').trigger('click'); | ||
wrapper.find('.van-actionsheet__cancel').trigger('click'); | ||
|
||
expect(callback.mock.calls.length).toBe(1); | ||
expect(wrapper.emitted('cancel')).toBeTruthy(); | ||
expect(wrapper.emitted('input')[0][0]).toBeFalsy(); | ||
expect(wrapper.html()).toMatchSnapshot(); | ||
}); |
Oops, something went wrong.