diff --git a/packages/intl/.size-limit.json b/packages/intl/.size-limit.json
index 95e98559..37d5d6de 100644
--- a/packages/intl/.size-limit.json
+++ b/packages/intl/.size-limit.json
@@ -3,7 +3,7 @@
"name": "All publics",
"path": "dist/index.js",
"import": "*",
- "limit": "1.8 kB"
+ "limit": "1.85 kB"
},
{
"name": "Minimal set",
diff --git a/packages/intl/src/format/rich.spec.ts b/packages/intl/src/format/rich.spec.ts
index ca67268e..01f76881 100644
--- a/packages/intl/src/format/rich.spec.ts
+++ b/packages/intl/src/format/rich.spec.ts
@@ -24,6 +24,10 @@ const tags = {
strong: (chunks: (string | Node)[]) => ({
type: 'strong',
children: chunks
+ }),
+ br: () => ({
+ type: 'br',
+ children: []
})
}
@@ -93,6 +97,48 @@ describe('intl', () => {
'guidelines.'
])
})
+
+ it('should map self-closing tags', () => {
+ expect(mapTags('First line
second line', tags)).toEqual([
+ 'First line',
+ {
+ type: 'br',
+ children: []
+ },
+ 'second line'
+ ])
+ expect(mapTags('First line
second line', tags)).toEqual([
+ 'First line',
+ {
+ type: 'br',
+ children: []
+ },
+ 'second line'
+ ])
+ })
+
+ it('should map self-closing tags inside other tags', () => {
+ expect(mapTags('First
second', tags)).toEqual([
+ {
+ type: 'strong',
+ children: [
+ 'First',
+ {
+ type: 'br',
+ children: []
+ },
+ 'second'
+ ]
+ }
+ ])
+ })
+
+ it('should ignore unknown self-closing tags', () => {
+ expect(mapTags('First