From: Eduardo San Martin Morote Date: Thu, 19 Mar 2020 22:26:54 +0000 (+0100) Subject: test: fix e2e paths X-Git-Tag: v4.0.0-alpha.4~37 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a3e0be998aa868a219cb2ae4bfdc4c881819b526;p=thirdparty%2Fvuejs%2Frouter.git test: fix e2e paths --- diff --git a/e2e/encoding/index.html b/e2e/encoding/index.html index 9c304ecd..88fa6a68 100644 --- a/e2e/encoding/index.html +++ b/e2e/encoding/index.html @@ -9,6 +9,9 @@ + << Back to Homepage +
+
Name: @@ -64,12 +67,13 @@
  • /n/%E2%82%AC (force reload)/documents/%E2%82%AC (force reload)
  • /n/€ (force reload. not valid but should not crash the router)/documents/€ (force reload. not valid but should not crash the + router)
  • diff --git a/e2e/hash/index.html b/e2e/hash/index.html index 8c60324b..8acb5abf 100644 --- a/e2e/hash/index.html +++ b/e2e/hash/index.html @@ -9,35 +9,38 @@ + << Back to Homepage +
    +
    Name: -
    {{ $route.name }}
    +
    {{ route.name }}
    Params: -
    {{ $route.params }}
    +
    {{ route.params }}
    Query: -
    {{ $route.query }}
    +
    {{ route.query }}
    Hash: -
    {{ $route.hash }}
    +
    {{ route.hash }}
    FullPath: -
    {{ $route.fullPath }}
    +
    {{ route.fullPath }}
    path: -
    {{ $route.path }}
    +
    {{ route.path }}

    @@ -63,10 +66,14 @@ >
  • - /n/%E2%82%AC (force reload) + /documents/%E2%82%AC (force reload)
  • - /n/€ (force reload): not valid tho + /documents/€ (force reload): not valid tho
  • diff --git a/e2e/hash/index.ts b/e2e/hash/index.ts index a174b191..06b13ca4 100644 --- a/e2e/hash/index.ts +++ b/e2e/hash/index.ts @@ -1,4 +1,4 @@ -import { createRouter, createWebHistory } from '../../src' +import { createRouter, useRoute, createWebHashHistory } from '../../src' import { RouteComponent } from '../../src/types' import { createApp } from 'vue' @@ -11,11 +11,15 @@ const Home: RouteComponent = { } const Document: RouteComponent = { - template: `
    Document: {{ $route.params.id }}
    `, + setup() { + const route = useRoute() + return { route } + }, + template: `
    Document: {{ route.params.id }}
    `, } const router = createRouter({ - history: createWebHistory('/' + __dirname), + history: createWebHashHistory('/' + __dirname), routes: [ { path: '/', component: Home, name: 'home' }, { path: '/documents/:id', name: 'docs', component: Document }, @@ -23,7 +27,12 @@ const router = createRouter({ ], }) -const app = createApp({}) +const app = createApp({ + setup() { + const route = useRoute() + return { route } + }, +}) app.use(router) window.vm = app.mount('#app') diff --git a/e2e/runner.js b/e2e/runner.js index c8de873c..c9465735 100644 --- a/e2e/runner.js +++ b/e2e/runner.js @@ -26,7 +26,7 @@ const Nightwatch = require('nightwatch') const args = process.argv.slice(2) // if we are running yarn dev locally, we can pass --dev to avoid launching another server instance -const server = args.indexOf('--dev') > -1 ? null : require('../examples/server') +const server = args.indexOf('--dev') > -1 ? null : require('./server') // allow running browserstack local const isLocal = args.indexOf('--local') > -1 diff --git a/package.json b/package.json index 4450efe8..d28ed137 100644 --- a/package.json +++ b/package.json @@ -21,7 +21,7 @@ "release": "bash scripts/release.sh", "changelog": "conventional-changelog -p angular -i CHANGELOG.md -s -r 2", "build:playground": "webpack --env.prod", - "dev:examples": "webpack-dev-server --mode=development --config examples/webpack.config.js", + "dev:e2e": "webpack-dev-server --mode=development --config e2e/webpack.config.js", "lint": "prettier -c --parser typescript \"{src,__tests__,e2e}/**/*.[jt]s?(x)\"", "lint:fix": "yarn run lint --write", "test:types": "tsc --build tsconfig.json",