Skip to content
代码片段 群组 项目
提交 7891a537 编辑于 作者: Eduardo Sanz García's avatar Eduardo Sanz García
浏览文件

Refactor `Wrapper#find` for `Wrapper#findComponent`

Part 4

Automatic conversion of Vue Test Util `Wrapper#find` for
`Wrapper#findComponent` when applied to a Vue component.

From the Vue Test Util page:
https://v1.test-utils.vuejs.org/api/wrapper/#find

```
Deprecation warning

Using find to search for a Component is deprecated and will be removed.
Use findComponent instead. The find method will continue to work for
finding elements using any valid selector.
```
上级 01978650
No related branches found
No related tags found
无相关合并请求
...@@ -38,7 +38,7 @@ export function stubComponent(Component, options = {}) { ...@@ -38,7 +38,7 @@ export function stubComponent(Component, options = {}) {
// Do not render any slots/scoped slots except default // Do not render any slots/scoped slots except default
// This differs from VTU behavior which renders all slots // This differs from VTU behavior which renders all slots
template: '<div><slot></slot></div>', template: '<div><slot></slot></div>',
// allows wrapper.find(Component) to work for stub // allows wrapper.findComponent(Component) to work for stub
$_vueTestUtils_original: Component, $_vueTestUtils_original: Component,
...options, ...options,
}; };
......
...@@ -137,9 +137,11 @@ describe('Deployment component', () => { ...@@ -137,9 +137,11 @@ describe('Deployment component', () => {
if (actionButtons.includes(DeploymentViewButton)) { if (actionButtons.includes(DeploymentViewButton)) {
it('renders the View button with expected text', () => { it('renders the View button with expected text', () => {
if (status === SUCCESS) { if (status === SUCCESS) {
expect(wrapper.find(DeploymentViewButton).text()).toContain('View app'); expect(wrapper.findComponent(DeploymentViewButton).text()).toContain('View app');
} else { } else {
expect(wrapper.find(DeploymentViewButton).text()).toContain('View latest app'); expect(wrapper.findComponent(DeploymentViewButton).text()).toContain(
'View latest app',
);
} }
}); });
} }
......
0% 加载中 .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册