mirror of
https://github.com/vuejs/vue-cli.git
synced 2026-05-04 19:10:01 -05:00
test: update tests to search for the <nav> element
This commit is contained in:
@@ -13,7 +13,7 @@ test('base', async () => {
|
||||
expect(files['src/views/HomeView.vue']).toBeTruthy()
|
||||
expect(files['src/App.vue']).toMatch('<router-link to="/">Home</router-link>')
|
||||
expect(files['src/App.vue']).not.toMatch('<script>')
|
||||
expect(files['src/App.vue']).toMatch('#nav a.router-link-exact-active')
|
||||
expect(files['src/App.vue']).toMatch('nav a.router-link-exact-active')
|
||||
|
||||
expect(pkg.dependencies).toHaveProperty('vue-router')
|
||||
})
|
||||
@@ -33,7 +33,7 @@ test('history mode', async () => {
|
||||
expect(files['src/views/HomeView.vue']).toBeTruthy()
|
||||
expect(files['src/App.vue']).toMatch('<router-link to="/">Home</router-link>')
|
||||
expect(files['src/App.vue']).not.toMatch('<script>')
|
||||
expect(files['src/App.vue']).toMatch('#nav a.router-link-exact-active')
|
||||
expect(files['src/App.vue']).toMatch('nav a.router-link-exact-active')
|
||||
|
||||
expect(pkg.dependencies).toHaveProperty('vue-router')
|
||||
})
|
||||
@@ -58,7 +58,7 @@ test('use with Babel', async () => {
|
||||
expect(files['src/views/HomeView.vue']).toBeTruthy()
|
||||
expect(files['src/App.vue']).toMatch('<router-link to="/">Home</router-link>')
|
||||
expect(files['src/App.vue']).not.toMatch('<script>')
|
||||
expect(files['src/App.vue']).toMatch('#nav a.router-link-exact-active')
|
||||
expect(files['src/App.vue']).toMatch('nav a.router-link-exact-active')
|
||||
|
||||
expect(pkg.dependencies).toHaveProperty('vue-router')
|
||||
})
|
||||
|
||||
@@ -48,14 +48,14 @@ test('serve with router', async () => {
|
||||
() => project.run('vue-cli-service serve'),
|
||||
async ({ page, helpers }) => {
|
||||
expect(await helpers.getText('h1')).toMatch(`Welcome to Your Vue.js App`)
|
||||
expect(await helpers.hasElement('#nav')).toBe(true)
|
||||
expect(await helpers.hasElement('nav')).toBe(true)
|
||||
expect(await helpers.hasClass('a[href="#/"]', 'router-link-exact-active')).toBe(true)
|
||||
expect(await helpers.hasClass('a[href="#/about"]', 'router-link-exact-active')).toBe(false)
|
||||
|
||||
await page.click('a[href="#/about"]')
|
||||
await sleep(1000)
|
||||
expect(await helpers.getText('h1')).toMatch(`This is an about page`)
|
||||
expect(await helpers.hasElement('#nav')).toBe(true)
|
||||
expect(await helpers.hasElement('nav')).toBe(true)
|
||||
expect(await helpers.hasClass('a[href="#/"]', 'router-link-exact-active')).toBe(false)
|
||||
expect(await helpers.hasClass('a[href="#/about"]', 'router-link-exact-active')).toBe(true)
|
||||
}
|
||||
@@ -72,14 +72,14 @@ test('serve with legacy router option', async () => {
|
||||
() => project.run('vue-cli-service serve'),
|
||||
async ({ page, helpers }) => {
|
||||
expect(await helpers.getText('h1')).toMatch(`Welcome to Your Vue.js App`)
|
||||
expect(await helpers.hasElement('#nav')).toBe(true)
|
||||
expect(await helpers.hasElement('nav')).toBe(true)
|
||||
expect(await helpers.hasClass('a[href="/"]', 'router-link-exact-active')).toBe(true)
|
||||
expect(await helpers.hasClass('a[href="/about"]', 'router-link-exact-active')).toBe(false)
|
||||
|
||||
await page.click('a[href="/about"]')
|
||||
await sleep(1000)
|
||||
expect(await helpers.getText('h1')).toMatch(`This is an about page`)
|
||||
expect(await helpers.hasElement('#nav')).toBe(true)
|
||||
expect(await helpers.hasElement('nav')).toBe(true)
|
||||
expect(await helpers.hasClass('a[href="/"]', 'router-link-exact-active')).toBe(false)
|
||||
expect(await helpers.hasClass('a[href="/about"]', 'router-link-exact-active')).toBe(true)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user