File tree 2 files changed +15
-9
lines changed
2 files changed +15
-9
lines changed Original file line number Diff line number Diff line change @@ -75,16 +75,14 @@ export default function createMixin(Vue, options) {
75
75
this . $root . _vueMeta . initialized = this . $isServer
76
76
77
77
if ( ! this . $root . _vueMeta . initialized ) {
78
- ensuredPush ( this . $options , 'beforeMount' , ( ) => {
78
+ // we use the mounted hook here as on page load
79
+ ensuredPush ( this . $options , 'mounted' , ( ) => {
79
80
// if this Vue-app was server rendered, set the appId to 'ssr'
80
81
// only one SSR app per page is supported
81
82
if ( this . $root . $el && this . $root . $el . hasAttribute ( 'data-server-rendered' ) ) {
82
83
this . $root . _vueMeta . appId = 'ssr'
83
84
}
84
- } )
85
85
86
- // we use the mounted hook here as on page load
87
- ensuredPush ( this . $options , 'mounted' , ( ) => {
88
86
if ( ! this . $root . _vueMeta . initialized ) {
89
87
// used in triggerUpdate to check if a change was triggered
90
88
// during initialization
Original file line number Diff line number Diff line change @@ -102,12 +102,15 @@ describe('client', () => {
102
102
103
103
test ( 'doesnt update when ssr attribute is set' , ( ) => {
104
104
html . setAttribute ( defaultOptions . ssrAttribute , 'true' )
105
- const wrapper = mount ( HelloWorld , { localVue : Vue } )
105
+ const wrapper = mount ( HelloWorld , {
106
+ localVue : Vue ,
107
+ attrs : {
108
+ 'data-server-rendered' : true
109
+ }
110
+ } )
106
111
107
112
const { tags } = wrapper . vm . $meta ( ) . refresh ( )
108
- // TODO: fix this test, not sure how to create a wrapper with a attri
109
- // bute data-server-rendered="true"
110
- expect ( tags ) . not . toBe ( false )
113
+ expect ( tags ) . toBe ( false )
111
114
} )
112
115
113
116
test ( 'changed function is called' , async ( ) => {
@@ -229,7 +232,12 @@ describe('client', () => {
229
232
}
230
233
} )
231
234
232
- const wrapper = mount ( component , { localVue : Vue } )
235
+ const wrapper = mount ( component , {
236
+ localVue : Vue ,
237
+ attrs : {
238
+ 'data-server-rendered' : true
239
+ }
240
+ } )
233
241
expect ( html . getAttribute ( 'theme' ) ) . not . toBe ( 'dark' )
234
242
235
243
await vmTick ( wrapper . vm )
You can’t perform that action at this time.
0 commit comments