@@ -35,6 +35,19 @@ Is it _me_ you're looking for?
35
35
expect ( plain ( tree ) ) . toBe ( 'Title Some body' ) ;
36
36
} ) ;
37
37
38
+ it ( 'compiles JSX callouts' , ( ) => {
39
+ const txt = `
40
+ <Callout icon="📘">
41
+ Title
42
+
43
+ Some body
44
+ </Callout>
45
+ ` ;
46
+ const tree = hast ( txt ) ;
47
+
48
+ expect ( plain ( tree ) ) . toBe ( 'Title Some body' ) ;
49
+ } ) ;
50
+
38
51
it ( 'compiles markdown tables' , ( ) => {
39
52
const txt = `
40
53
| Header 1 | Header 2 |
@@ -53,4 +66,41 @@ Is it _me_ you're looking for?
53
66
54
67
expect ( plain ( tree ) ) . toBe ( 'entitled kittens' ) ;
55
68
} ) ;
69
+
70
+ it ( 'compiles JSX images to their title' , ( ) => {
71
+ const txt = `
72
+ <Image src="http://placekitten.com/600/600" alt="image **label**" title="entitled kittens" />
73
+ ` ;
74
+ const tree = hast ( txt ) ;
75
+
76
+ expect ( plain ( tree ) ) . toBe ( 'entitled kittens' ) ;
77
+ } ) ;
78
+
79
+ it ( 'compiles html blocks to their plain text' , ( ) => {
80
+ const txt = `
81
+ <HTMLBlock>{\`
82
+ <p>Paragraph text</p>
83
+ \`}</HTMLBlock>
84
+ ` ;
85
+
86
+ expect ( plain ( hast ( txt ) ) ) . toBe ( 'Paragraph text' ) ;
87
+ } ) ;
88
+
89
+ it ( 'compiles glossary items to their term' , ( ) => {
90
+ const txt = '<Glossary>parliament</Glossary>' ;
91
+
92
+ expect ( plain ( hast ( txt ) ) ) . toBe ( 'parliament' ) ;
93
+ } ) ;
94
+
95
+ it ( 'compiles variables to their name' , ( ) => {
96
+ const txt = '{user.name}' ;
97
+
98
+ expect ( plain ( hast ( txt ) ) ) . toBe ( 'name' ) ;
99
+ } ) ;
100
+
101
+ it ( 'compiles provided variables to their values' , ( ) => {
102
+ const txt = '{user.name}' ;
103
+
104
+ expect ( plain ( hast ( txt ) , { variables : { name : 'Owlbert' } } ) ) . toBe ( 'Owlbert' ) ;
105
+ } ) ;
56
106
} ) ;
0 commit comments