@@ -314,9 +314,96 @@ test('issue #819: v-for', async () => {
314
314
)
315
315
} )
316
316
317
+ describe ( 'issue #853' , ( ) => {
318
+ test ( 'legacy' , async ( ) => {
319
+ const mockWarn = warn as jest . MockedFunction < typeof warn >
320
+ mockWarn . mockImplementation ( ( ) => { } ) // eslint-disable-line @typescript-eslint/no-empty-function
321
+
322
+ const i18n = createI18n ( {
323
+ locale : 'en' ,
324
+ fallbackLocale : 'en' ,
325
+ warnHtmlInMessage : 'off' ,
326
+ messages : {
327
+ en : {
328
+ hello : '<p>hello</p>'
329
+ }
330
+ }
331
+ } )
332
+
333
+ const Child = defineComponent ( {
334
+ i18n : {
335
+ messages : {
336
+ en : { child : '<p>child</p>' }
337
+ }
338
+ } ,
339
+ template : `<div v-html="$t('child')"></div>`
340
+ } )
341
+
342
+ const App = defineComponent ( {
343
+ components : {
344
+ Child
345
+ } ,
346
+ template : `
347
+ <div>
348
+ <Child />
349
+ <div v-html="$t('hello')"></div>
350
+ </div>`
351
+ } )
352
+
353
+ await mount ( App , i18n )
354
+
355
+ expect ( mockWarn ) . toHaveBeenCalledTimes ( 0 )
356
+ } )
357
+
358
+ test ( 'compostion' , async ( ) => {
359
+ const mockWarn = warn as jest . MockedFunction < typeof warn >
360
+ mockWarn . mockImplementation ( ( ) => { } ) // eslint-disable-line @typescript-eslint/no-empty-function
361
+
362
+ const i18n = createI18n ( {
363
+ legacy : false ,
364
+ locale : 'en' ,
365
+ fallbackLocale : 'en' ,
366
+ globalInjection : true ,
367
+ warnHtmlMessage : false ,
368
+ messages : {
369
+ en : {
370
+ hello : '<p>hello</p>'
371
+ }
372
+ }
373
+ } )
374
+
375
+ const Child = defineComponent ( {
376
+ setup ( ) {
377
+ const { t } = useI18n ( {
378
+ messages : {
379
+ en : { child : '<p>child</p>' }
380
+ }
381
+ } )
382
+ return { t }
383
+ } ,
384
+ template : `<div v-html="t('child')"></div>`
385
+ } )
386
+
387
+ const App = defineComponent ( {
388
+ components : {
389
+ Child
390
+ } ,
391
+ template : `
392
+ <div>
393
+ <Child />
394
+ <div v-html="$t('hello')"></div>
395
+ </div>`
396
+ } )
397
+
398
+ await mount ( App , i18n )
399
+
400
+ expect ( mockWarn ) . toHaveBeenCalledTimes ( 0 )
401
+ } )
402
+ } )
403
+
317
404
test ( 'issue #854' , async ( ) => {
318
405
const mockWarn = warn as jest . MockedFunction < typeof warn >
319
- mockWarn . mockImplementation ( ( ) => { } )
406
+ mockWarn . mockImplementation ( ( ) => { } ) // eslint-disable-line @typescript-eslint/no-empty-function
320
407
321
408
const i18n = createI18n ( {
322
409
legacy : false ,
0 commit comments