Skip to content

Commit 1b27d02

Browse files
jkzinghaoqunjiang
authored andcommitted
test: add test for multi page history api fallback (#3472)
1 parent ea5d9f7 commit 1b27d02

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

packages/@vue/cli-service/__tests__/multiPage.spec.js

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ async function makeProjectMultiPage (project) {
1414
pages: {
1515
index: { entry: 'src/main.js' },
1616
foo: { entry: 'src/foo.js' },
17-
bar: { entry: 'src/bar.js' }
17+
bar: { entry: 'src/bar.js' },
18+
foobar: { entry: 'src/foobar.js' }
1819
},
1920
chainWebpack: config => {
2021
const splitOptions = config.optimization.get('splitChunks')
@@ -39,6 +40,13 @@ async function makeProjectMultiPage (project) {
3940
render: h => h(App)
4041
})
4142
`)
43+
await project.write('src/foobar.js', `
44+
import Vue from 'vue'
45+
new Vue({
46+
el: '#app',
47+
render: h => h('h1', 'FooBar')
48+
})
49+
`)
4250
const app = await project.read('src/App.vue')
4351
await project.write('src/App.vue', app.replace(
4452
`import HelloWorld from './components/HelloWorld.vue'`,
@@ -61,6 +69,15 @@ test('serve w/ multi page', async () => {
6169

6270
await page.goto(`${url}/bar.html`)
6371
expect(await helpers.getText('h1')).toMatch(`Welcome to Your Vue.js App`)
72+
73+
await page.goto(`${url}foo`)
74+
expect(await helpers.getText('h1')).toMatch(`Foo`)
75+
76+
await page.goto(`${url}bar`)
77+
expect(await helpers.getText('h1')).toMatch(`Welcome to Your Vue.js App`)
78+
79+
await page.goto(`${url}foobar`)
80+
expect(await helpers.getText('h1')).toMatch(`FooBar`)
6481
}
6582
)
6683
})

0 commit comments

Comments
 (0)