From: Eduardo San Martin Morote Date: Wed, 2 Dec 2020 18:02:09 +0000 (+0100) Subject: test: test out-in nested transitions X-Git-Tag: v4.0.0~18 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=70692c344708e173b392357d771388e270e9c988;p=thirdparty%2Fvuejs%2Frouter.git test: test out-in nested transitions --- diff --git a/e2e/specs/transitions.js b/e2e/specs/transitions.js index e5e79546..85067301 100644 --- a/e2e/specs/transitions.js +++ b/e2e/specs/transitions.js @@ -51,4 +51,20 @@ module.exports = { .end() }, + + 'out in transitions': function (browser) { + browser + .url('http://localhost:8080/transitions/') + .waitForElementPresent('#app > *', 1000) + .click('#toggle-transition') + + .click('li:nth-child(7) a') + .assert.containsText('.nested-view', 'foo') + .click('li:nth-child(1) a') + .waitForElementPresent('.view.home', 1000) + .click('li:nth-child(7) a') + .assert.containsText('.nested-view', 'foo') + + .end() + }, } diff --git a/e2e/transitions/index.ts b/e2e/transitions/index.ts index 9a4dc9ca..d45d4b83 100644 --- a/e2e/transitions/index.ts +++ b/e2e/transitions/index.ts @@ -1,6 +1,6 @@ -import { createRouter, createWebHistory, useRoute } from '../../src' +import { createRouter, createWebHistory } from '../../src' import { RouteComponent } from '../../src/types' -import { createApp, nextTick } from 'vue' +import { createApp, defineComponent, nextTick, ref } from 'vue' const Home: RouteComponent = { template: ` @@ -56,6 +56,16 @@ const Parent: RouteComponent = { `, } +const NestedTransition = defineComponent({ + template: ` + + + + + + `, +}) + const Default: RouteComponent = { template: '
default
', } @@ -76,13 +86,28 @@ const router = createRouter({ { path: 'bar', component: Bar }, ], }, + + { + path: '/nested', + component: NestedTransition, + children: [ + { path: '', component: Default }, + { path: 'foo', component: Foo }, + { path: 'bar', component: Bar }, + ], + }, ], }) const app = createApp({ setup() { + const transitionName = ref('fade') + function toggleTransition() { + transitionName.value = transitionName.value === 'fade' ? 'none' : 'fade' + } + return { - show: true, - route: useRoute(), + transitionName, + toggleTransition, } }, @@ -90,15 +115,20 @@ const app = createApp({

Transitions

CI: ${__CI__}
+ - +