1313 - ` {Object|Array<string>} stubs `
1414 - ` {Vue} localVue `
1515
16- - ** Возвращает:** ` {string} `
16+ - ** Возвращает:** ` {Promise< string> } `
1717
1818- ** Опции:**
1919
@@ -34,9 +34,9 @@ import { renderToString } from '@vue/server-test-utils'
3434import Foo from ' ./Foo.vue'
3535
3636describe (' Foo' , () => {
37- it (' renders a div' , () => {
38- const renderedString = renderToString (Foo)
39- expect (renderedString ).toContain (' <div></div>' )
37+ it (' renders a div' , async () => {
38+ const str = await renderToString (Foo)
39+ expect (str ).toContain (' <div></div>' )
4040 })
4141})
4242```
@@ -48,13 +48,13 @@ import { renderToString } from '@vue/server-test-utils'
4848import Foo from ' ./Foo.vue'
4949
5050describe (' Foo' , () => {
51- it (' renders a div' , () => {
52- const renderedString = renderToString (Foo, {
51+ it (' renders a div' , async () => {
52+ const str = await renderToString (Foo, {
5353 propsData: {
5454 color: ' red'
5555 }
5656 })
57- expect (renderedString ).toContain (' red' )
57+ expect (str ).toContain (' red' )
5858 })
5959})
6060```
@@ -68,15 +68,15 @@ import Bar from './Bar.vue'
6868import FooBar from ' ./FooBar.vue'
6969
7070describe (' Foo' , () => {
71- it (' renders a div' , () => {
72- const renderedString = renderToString (Foo, {
71+ it (' renders a div' , async () => {
72+ const str = await renderToString (Foo, {
7373 slots: {
7474 default: [Bar, FooBar],
7575 fooBar: FooBar, // Будет соответствовать <slot name="FooBar" />,
7676 foo: ' <div />'
7777 }
7878 })
79- expect (renderedString ).toContain (' <div></div>' )
79+ expect (str ).toContain (' <div></div>' )
8080 })
8181})
8282```
@@ -88,14 +88,14 @@ import { renderToString } from '@vue/server-test-utils'
8888import Foo from ' ./Foo.vue'
8989
9090describe (' Foo' , () => {
91- it (' renders a div' , () => {
91+ it (' renders a div' , async () => {
9292 const $route = { path: ' http://www.example-path.com' }
93- const renderedString = renderToString (Foo, {
93+ const str = await renderToString (Foo, {
9494 mocks: {
9595 $route
9696 }
9797 })
98- expect (renderedString ).toContain ($route .path )
98+ expect (str ).toContain ($route .path )
9999 })
100100})
101101```
0 commit comments