@@ -415,7 +415,7 @@ describe('serializeI18nMessageForLocalize', () => {
415
415
} ) ;
416
416
417
417
418
- it ( 'should serialize ICU with nested HTML for `$localize()`' , ( ) => {
418
+ it ( 'should serialize ICU with embedded HTML for `$localize()`' , ( ) => {
419
419
expect ( serialize ( '{age, plural, 10 {<b>ten</b>} other {<div class="A">other</div>}}' ) ) . toEqual ( {
420
420
messageParts : [
421
421
'{VAR_PLURAL, plural, 10 {{START_BOLD_TEXT}ten{CLOSE_BOLD_TEXT}} other {{START_TAG_DIV}other{CLOSE_TAG_DIV}}}'
@@ -424,6 +424,15 @@ describe('serializeI18nMessageForLocalize', () => {
424
424
} ) ;
425
425
} ) ;
426
426
427
+ it ( 'should serialize ICU with embedded interpolation for `$localize()`' , ( ) => {
428
+ expect ( serialize ( '{age, plural, 10 {<b>ten</b>} other {{{age}} years old}}' ) ) . toEqual ( {
429
+ messageParts : [
430
+ '{VAR_PLURAL, plural, 10 {{START_BOLD_TEXT}ten{CLOSE_BOLD_TEXT}} other {{INTERPOLATION} years old}}'
431
+ ] ,
432
+ placeHolders : [ ]
433
+ } ) ;
434
+ } ) ;
435
+
427
436
it ( 'should serialize ICU with nested HTML containing further ICUs for `$localize()`' , ( ) => {
428
437
expect (
429
438
serialize (
@@ -433,6 +442,18 @@ describe('serializeI18nMessageForLocalize', () => {
433
442
placeHolders : [ 'ICU' , 'START_TAG_DIV' , 'ICU' , 'CLOSE_TAG_DIV' ]
434
443
} ) ;
435
444
} ) ;
445
+
446
+ it ( 'should serialize nested ICUs with embedded interpolation for `$localize()`' , ( ) => {
447
+ expect (
448
+ serialize (
449
+ '{age, plural, 10 {ten {size, select, 1 {{{ varOne }}} 2 {{{ varTwo }}} other {2+}}} other {other}}' ) )
450
+ . toEqual ( {
451
+ messageParts : [
452
+ '{VAR_PLURAL, plural, 10 {ten {VAR_SELECT, select, 1 {{INTERPOLATION}} 2 {{INTERPOLATION_1}} other {2+}}} other {other}}'
453
+ ] ,
454
+ placeHolders : [ ]
455
+ } ) ;
456
+ } ) ;
436
457
} ) ;
437
458
438
459
describe ( 'serializeIcuNode' , ( ) => {
@@ -447,7 +468,7 @@ describe('serializeIcuNode', () => {
447
468
. toEqual ( '{VAR_PLURAL, plural, 10 {ten} other {other}}' ) ;
448
469
} ) ;
449
470
450
- it ( 'should serialize a next ICU' , ( ) => {
471
+ it ( 'should serialize a nested ICU' , ( ) => {
451
472
expect ( serialize (
452
473
'{age, plural, 10 {ten {size, select, 1 {one} 2 {two} other {2+}}} other {other}}' ) )
453
474
. toEqual (
@@ -459,4 +480,9 @@ describe('serializeIcuNode', () => {
459
480
. toEqual (
460
481
'{VAR_PLURAL, plural, 10 {{START_BOLD_TEXT}ten{CLOSE_BOLD_TEXT}} other {{START_TAG_DIV}other{CLOSE_TAG_DIV}}}' ) ;
461
482
} ) ;
483
+
484
+ it ( 'should serialize an ICU with embedded interpolations' , ( ) => {
485
+ expect ( serialize ( '{age, select, 10 {ten} other {{{age}} years old}}' ) )
486
+ . toEqual ( '{VAR_SELECT, select, 10 {ten} other {{INTERPOLATION} years old}}' ) ;
487
+ } ) ;
462
488
} ) ;
0 commit comments