@@ -91,7 +91,7 @@ describe('Hot Reload', () => {
9191
9292 const expectedSectionEvent = `data: {"sync":"local","themeId":"${ THEME_ID } ","type":"update","key":"${ testSectionFileKey } ","payload":{"sectionNames":["first","second"],"replaceTemplates":${ JSON . stringify (
9393 getInMemoryTemplates ( ctx ) ,
94- ) } },"version":"${ HOT_RELOAD_VERSION } "}`
94+ ) } ,"updatedFileParts":{"stylesheetTag":false,"javascriptTag":false} },"version":"${ HOT_RELOAD_VERSION } "}`
9595
9696 // Verify local sync event
9797 expect ( hotReloadEvents . at ( - 1 ) ) . toMatch ( expectedSectionEvent )
@@ -142,7 +142,7 @@ describe('Hot Reload', () => {
142142 // Since this is a template, sectionNames will be empty (no sections to reload)
143143 const expectedTemplateEvent = `data: {"sync":"local","themeId":"${ THEME_ID } ","type":"update","key":"${ templateKey } ","payload":{"sectionNames":[],"replaceTemplates":${ JSON . stringify (
144144 getInMemoryTemplates ( ctx ) ,
145- ) } },"version":"${ HOT_RELOAD_VERSION } "}`
145+ ) } ,"updatedFileParts":{"stylesheetTag":false,"javascriptTag":false} },"version":"${ HOT_RELOAD_VERSION } "}`
146146
147147 // Verify local sync event for JSON update
148148 expect ( hotReloadEvents . at ( - 1 ) ) . toMatch ( expectedTemplateEvent )
@@ -163,7 +163,7 @@ describe('Hot Reload', () => {
163163 // Since this is a section group, sectionNames will contain all the section names
164164 const expectedSectionGroupEvent = `data: {"sync":"local","themeId":"${ THEME_ID } ","type":"update","key":"${ sectionGroupKey } ","payload":{"sectionNames":["first","second"],"replaceTemplates":${ JSON . stringify (
165165 getInMemoryTemplates ( ctx ) ,
166- ) } },"version":"${ HOT_RELOAD_VERSION } "}`
166+ ) } ,"updatedFileParts":{"stylesheetTag":false,"javascriptTag":false} },"version":"${ HOT_RELOAD_VERSION } "}`
167167
168168 // Verify local sync event for JSON update
169169 expect ( hotReloadEvents . at ( - 1 ) ) . toMatch ( expectedSectionGroupEvent )
@@ -178,7 +178,7 @@ describe('Hot Reload', () => {
178178 expect ( hotReloadEvents . at ( - 1 ) ) . toMatch (
179179 `data: {"sync":"local","themeId":"${ THEME_ID } ","type":"update","key":"${ anotherSectionKey } ","payload":{"sectionNames":["first","second"],"replaceTemplates":${ JSON . stringify (
180180 getInMemoryTemplates ( ctx ) ,
181- ) } },"version":"${ HOT_RELOAD_VERSION } "}`,
181+ ) } ,"updatedFileParts":{"stylesheetTag":false,"javascriptTag":false} },"version":"${ HOT_RELOAD_VERSION } "}`,
182182 )
183183 // Wait for remote sync
184184 await nextTick ( )
@@ -197,7 +197,7 @@ describe('Hot Reload', () => {
197197 expect ( getInMemoryTemplates ( ctx ) ) . toEqual ( { [ anotherSectionKey ] : 'default-value' } )
198198 const expectedUnreferencedSectionEvent = `data: {"sync":"local","themeId":"${ THEME_ID } ","type":"update","key":"${ anotherSectionKey } ","payload":{"sectionNames":[],"replaceTemplates":${ JSON . stringify (
199199 getInMemoryTemplates ( ctx ) ,
200- ) } },"version":"${ HOT_RELOAD_VERSION } "}`
200+ ) } ,"updatedFileParts":{"stylesheetTag":false,"javascriptTag":false} },"version":"${ HOT_RELOAD_VERSION } "}`
201201 expect ( hotReloadEvents . at ( - 1 ) ) . toMatch ( expectedUnreferencedSectionEvent )
202202 await nextTick ( )
203203 expect ( hotReloadEvents . at ( - 1 ) ) . toMatch ( expectedUnreferencedSectionEvent . replace ( 'local' , 'remote' ) )
@@ -207,7 +207,7 @@ describe('Hot Reload', () => {
207207 await triggerFileEvent ( 'add' , cssFileKey )
208208 // It does not add assets to the in-memory templates:
209209 expect ( getInMemoryTemplates ( ctx ) ) . toEqual ( { } )
210- const expectedCssEvent = `data: {"sync":"local","themeId":"${ THEME_ID } ","type":"update","key":"${ cssFileKey } ","payload":{"sectionNames":[],"replaceTemplates":{}},"version":"${ HOT_RELOAD_VERSION } "}`
210+ const expectedCssEvent = `data: {"sync":"local","themeId":"${ THEME_ID } ","type":"update","key":"${ cssFileKey } ","payload":{"sectionNames":[],"replaceTemplates":{},"updatedFileParts":{"stylesheetTag":false,"javascriptTag":false} },"version":"${ HOT_RELOAD_VERSION } "}`
211211 expect ( hotReloadEvents . at ( - 1 ) ) . toMatch ( expectedCssEvent )
212212 // Wait for remote sync
213213 await nextTick ( )
@@ -218,7 +218,7 @@ describe('Hot Reload', () => {
218218 await triggerFileEvent ( 'add' , cssLiquidFileKey )
219219 // It does not add assets to the in-memory templates:
220220 expect ( getInMemoryTemplates ( ctx ) ) . toEqual ( { } )
221- const expectedCssLiquidEvent = `data: {"sync":"local","themeId":"${ THEME_ID } ","type":"update","key":"${ cssLiquidFileKey } ","payload":{"sectionNames":[],"replaceTemplates":{}},"version":"${ HOT_RELOAD_VERSION } "}`
221+ const expectedCssLiquidEvent = `data: {"sync":"local","themeId":"${ THEME_ID } ","type":"update","key":"${ cssLiquidFileKey } ","payload":{"sectionNames":[],"replaceTemplates":{},"updatedFileParts":{"stylesheetTag":false,"javascriptTag":false} },"version":"${ HOT_RELOAD_VERSION } "}`
222222 expect ( hotReloadEvents . at ( - 1 ) ) . toMatch ( expectedCssLiquidEvent )
223223 // Wait for remote sync
224224 await nextTick ( )
@@ -227,7 +227,7 @@ describe('Hot Reload', () => {
227227 // -- Test other file types (e.g. JS) --
228228 const jsFileKey = 'assets/something.js'
229229 await triggerFileEvent ( 'add' , jsFileKey )
230- const expectedJsEvent = `data: {"sync":"local","themeId":"${ THEME_ID } ","type":"update","key":"${ jsFileKey } ","payload":{"sectionNames":[],"replaceTemplates":{}},"version":"${ HOT_RELOAD_VERSION } "}`
230+ const expectedJsEvent = `data: {"sync":"local","themeId":"${ THEME_ID } ","type":"update","key":"${ jsFileKey } ","payload":{"sectionNames":[],"replaceTemplates":{},"updatedFileParts":{"stylesheetTag":false,"javascriptTag":false} },"version":"${ HOT_RELOAD_VERSION } "}`
231231 expect ( hotReloadEvents . at ( - 1 ) ) . toMatch ( expectedJsEvent )
232232 // Wait for remote sync
233233 await nextTick ( )
0 commit comments