From cdc0ceee776388b771725d415794f021e64dc798 Mon Sep 17 00:00:00 2001 From: Konstantin Pavlyuts Date: Mon, 12 Feb 2024 16:09:08 +0300 Subject: [PATCH 1/2] feat: add teleport stub possibility, https://github.com/vuejs/test-utils/issues/2335 --- docs/guide/advanced/teleport.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/docs/guide/advanced/teleport.md b/docs/guide/advanced/teleport.md index f4b10fa84..94ed350d1 100644 --- a/docs/guide/advanced/teleport.md +++ b/docs/guide/advanced/teleport.md @@ -187,6 +187,22 @@ test('teleport', async () => { }) ``` +You have a possibility to stub teleport without creating any external HTML + +```ts +import { mount } from '@vue/test-utils' +import Navbar from './Navbar.vue' + +test('teleport', async () => { + const wrapper = mount(Navbar, { + stubs: { + teleport: true + } + }) +}) + +``` + ## Conclusion - Create a teleport target with `document.createElement`. From f4cf9beb8d2a8014f4c8f07de4ddadbc25de4e80 Mon Sep 17 00:00:00 2001 From: Konstantin Pavlyuts Date: Mon, 12 Feb 2024 17:26:26 +0300 Subject: [PATCH 2/2] feat: change description and add french translation, https://github.com/vuejs/test-utils/issues/2335 --- docs/fr/guide/advanced/teleport.md | 14 ++++++++++++++ docs/guide/advanced/teleport.md | 3 +-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/docs/fr/guide/advanced/teleport.md b/docs/fr/guide/advanced/teleport.md index 2cc205fc8..bd3cefb81 100644 --- a/docs/fr/guide/advanced/teleport.md +++ b/docs/fr/guide/advanced/teleport.md @@ -188,6 +188,20 @@ test('teleport', async () => { }); ``` +Vous pouvez remplacer teleport par un stub en utilisant `teleport: true`: +```ts +import { mount } from '@vue/test-utils' +import Navbar from './Navbar.vue' + +test('teleport', async () => { + const wrapper = mount(Navbar, { + stubs: { + teleport: true + } + }) +}) +``` + ## Conclusion - Créez une cible de téléportation avec `document.createElement`. diff --git a/docs/guide/advanced/teleport.md b/docs/guide/advanced/teleport.md index 94ed350d1..e6bc3f9dc 100644 --- a/docs/guide/advanced/teleport.md +++ b/docs/guide/advanced/teleport.md @@ -187,7 +187,7 @@ test('teleport', async () => { }) ``` -You have a possibility to stub teleport without creating any external HTML +You can stub teleport by using `teleport: true`: ```ts import { mount } from '@vue/test-utils' @@ -200,7 +200,6 @@ test('teleport', async () => { } }) }) - ``` ## Conclusion