fix(vue-app): add id attribute to noopApp (#8596)

This commit is contained in:
Ahad Birang 2021-01-05 16:44:39 +03:30 committed by GitHub
parent c15078fa64
commit 746b14319a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 4 deletions

View File

@ -31,7 +31,7 @@ Vue.component(NuxtLink.name, NuxtLink)
<% if (fetch.server) { %>if (!global.fetch) { global.fetch = fetch }<% } %> <% if (fetch.server) { %>if (!global.fetch) { global.fetch = fetch }<% } %>
const noopApp = () => new Vue({ render: h => h('div') }) const noopApp = () => new Vue({ render: h => h('div', { domProps: { id: '<%= globals.id %>' } }) })
function urlJoin () { function urlJoin () {
return Array.prototype.slice.call(arguments).join('/').replace(/\/+/g, '/') return Array.prototype.slice.call(arguments).join('/').replace(/\/+/g, '/')

View File

@ -183,21 +183,21 @@ describe('basic ssr', () => {
const { html } = await nuxt.server.renderRoute('/redirect-external', renderContext) const { html } = await nuxt.server.renderRoute('/redirect-external', renderContext)
expect(_status).toBe(302) expect(_status).toBe(302)
expect(_headers.Location).toBe('https://nuxtjs.org/docs/2.x/features/data-fetching/') expect(_headers.Location).toBe('https://nuxtjs.org/docs/2.x/features/data-fetching/')
expect(html).toContain('<div data-server-rendered="true"></div>') expect(html).toContain('<div data-server-rendered="true" id="__nuxt"></div>')
}) })
test('/redirect -> external link without trailing slash', async () => { test('/redirect -> external link without trailing slash', async () => {
const { html } = await nuxt.server.renderRoute('/redirect-external-no-slash', renderContext) const { html } = await nuxt.server.renderRoute('/redirect-external-no-slash', renderContext)
expect(_status).toBe(302) expect(_status).toBe(302)
expect(_headers.Location).toBe('https://nuxtjs.org/docs/2.x/features/data-fetching') expect(_headers.Location).toBe('https://nuxtjs.org/docs/2.x/features/data-fetching')
expect(html).toContain('<div data-server-rendered="true"></div>') expect(html).toContain('<div data-server-rendered="true" id="__nuxt"></div>')
}) })
test('/redirect -> external link with root domain url', async () => { test('/redirect -> external link with root domain url', async () => {
const { html } = await nuxt.server.renderRoute('/redirect-external-root', renderContext) const { html } = await nuxt.server.renderRoute('/redirect-external-root', renderContext)
expect(_status).toBe(302) expect(_status).toBe(302)
expect(_headers.Location).toBe('https://nuxtjs.org/') expect(_headers.Location).toBe('https://nuxtjs.org/')
expect(html).toContain('<div data-server-rendered="true"></div>') expect(html).toContain('<div data-server-rendered="true" id="__nuxt"></div>')
}) })
}) })