From 6522b6e51b00d944118cff98548f97ac85d5186d Mon Sep 17 00:00:00 2001 From: Illya Klymov Date: Mon, 10 Oct 2022 15:11:10 +0300 Subject: [PATCH] Address comments * fix wording * fix tests * improve types --- docs/guide/advanced/stubs-shallow-mount.md | 8 ++++---- src/mount.ts | 2 +- src/utils.ts | 4 ++-- src/utils/find.ts | 4 +--- .../stubDirectivesTransformer.ts | 5 ++++- tests/mountingOptions/global.stubs.spec.ts | 19 ++++++++++++++++++- 6 files changed, 30 insertions(+), 12 deletions(-) diff --git a/docs/guide/advanced/stubs-shallow-mount.md b/docs/guide/advanced/stubs-shallow-mount.md index d0aef7d3dc..3319d696de 100644 --- a/docs/guide/advanced/stubs-shallow-mount.md +++ b/docs/guide/advanced/stubs-shallow-mount.md @@ -255,7 +255,7 @@ const App = { } ``` -We do not want `Tooltip` directive code to be executed in this test, we just want to assert the message is rendered. In this case, we could use the `stubs`, which appears in the `global` mounting option passing `vTooltip`. +We do not want the `Tooltip` directive code to be executed in this test, we just want to assert the message is rendered. In this case, we could use the `stubs`, which appears in the `global` mounting option passing `vTooltip`. ```js test('stubs component with custom template', () => { @@ -268,7 +268,7 @@ test('stubs component with custom template', () => { }) console.log(wrapper.html()) - //

Welcome to Vue.js 3

+ //

Welcome to Vue.js 3

expect(wrapper.html()).toContain('Welcome to Vue.js 3') }) @@ -298,7 +298,7 @@ test('stubs component with custom template', () => { // 'directive called' logged to console console.log(wrapper.html()) - //

Welcome to Vue.js 3

+ //

Welcome to Vue.js 3

expect(wrapper.classes('with-tooltip')).toBe(true) }) @@ -307,7 +307,7 @@ test('stubs component with custom template', () => { We've just swapped our directive implementation with own one! ::: warning -Stubbing directives won't work on functional components due to lack of directive name inside of [withDirectives](https://vuejs.org/api/render-function.html#withdirectives) function. Consider mocking directive module via your testing framework if you need to mock directive used in functional component +Stubbing directives won't work on functional components or `