@@ -60,8 +60,11 @@ describe('TextComponent', () => {
6060 await fixture . whenStable ( ) ;
6161 fixture . detectChanges ( ) ;
6262
63- const span = fixture . debugElement . query ( By . css ( 'span' ) ) ;
64- expect ( span . nativeElement . innerHTML . trim ( ) ) . toBe ( '<p>Hello World</p>' ) ;
63+ const element = fixture . debugElement . query ( By . css ( '.a2ui-text' ) ) ;
64+ expect ( element ) . toBeTruthy ( ) ;
65+ const p = element . query ( By . css ( 'p' ) ) ;
66+ expect ( p ) . toBeTruthy ( ) ;
67+ expect ( p . nativeElement . textContent . trim ( ) ) . toBe ( 'Hello World' ) ;
6568 expect ( mockMarkdownRenderer . render ) . toHaveBeenCalledWith ( 'Hello World' ) ;
6669 } ) ;
6770
@@ -74,7 +77,12 @@ describe('TextComponent', () => {
7477 await fixture . whenStable ( ) ;
7578 fixture . detectChanges ( ) ;
7679
77- expect ( mockMarkdownRenderer . render ) . toHaveBeenCalledWith ( '# Heading' ) ;
80+ expect ( mockMarkdownRenderer . render ) . not . toHaveBeenCalled ( ) ;
81+ const element = fixture . debugElement . query ( By . css ( '.a2ui-text.h1' ) ) ;
82+ expect ( element ) . toBeTruthy ( ) ;
83+ const h1 = element . query ( By . css ( 'h1' ) ) ;
84+ expect ( h1 ) . toBeTruthy ( ) ;
85+ expect ( h1 . nativeElement . textContent . trim ( ) ) . toBe ( 'Heading' ) ;
7886 } ) ;
7987
8088 it ( 'should handle variant caption' , async ( ) => {
@@ -86,7 +94,12 @@ describe('TextComponent', () => {
8694 await fixture . whenStable ( ) ;
8795 fixture . detectChanges ( ) ;
8896
89- expect ( mockMarkdownRenderer . render ) . toHaveBeenCalledWith ( '*Caption*' ) ;
97+ expect ( mockMarkdownRenderer . render ) . not . toHaveBeenCalled ( ) ;
98+ const element = fixture . debugElement . query ( By . css ( '.a2ui-text.caption' ) ) ;
99+ expect ( element ) . toBeTruthy ( ) ;
100+ const em = element . query ( By . css ( 'em' ) ) ;
101+ expect ( em ) . toBeTruthy ( ) ;
102+ expect ( em . nativeElement . textContent . trim ( ) ) . toBe ( 'Caption' ) ;
90103 } ) ;
91104
92105 it ( 'should handle variant h2' , async ( ) => {
@@ -98,7 +111,12 @@ describe('TextComponent', () => {
98111 await fixture . whenStable ( ) ;
99112 fixture . detectChanges ( ) ;
100113
101- expect ( mockMarkdownRenderer . render ) . toHaveBeenCalledWith ( '## Heading' ) ;
114+ expect ( mockMarkdownRenderer . render ) . not . toHaveBeenCalled ( ) ;
115+ const element = fixture . debugElement . query ( By . css ( '.a2ui-text.h2' ) ) ;
116+ expect ( element ) . toBeTruthy ( ) ;
117+ const h2 = element . query ( By . css ( 'h2' ) ) ;
118+ expect ( h2 ) . toBeTruthy ( ) ;
119+ expect ( h2 . nativeElement . textContent . trim ( ) ) . toBe ( 'Heading' ) ;
102120 } ) ;
103121
104122 it ( 'should handle variant h3' , async ( ) => {
@@ -110,7 +128,12 @@ describe('TextComponent', () => {
110128 await fixture . whenStable ( ) ;
111129 fixture . detectChanges ( ) ;
112130
113- expect ( mockMarkdownRenderer . render ) . toHaveBeenCalledWith ( '### Heading' ) ;
131+ expect ( mockMarkdownRenderer . render ) . not . toHaveBeenCalled ( ) ;
132+ const element = fixture . debugElement . query ( By . css ( '.a2ui-text.h3' ) ) ;
133+ expect ( element ) . toBeTruthy ( ) ;
134+ const h3 = element . query ( By . css ( 'h3' ) ) ;
135+ expect ( h3 ) . toBeTruthy ( ) ;
136+ expect ( h3 . nativeElement . textContent . trim ( ) ) . toBe ( 'Heading' ) ;
114137 } ) ;
115138
116139 it ( 'should handle variant h4' , async ( ) => {
@@ -122,7 +145,12 @@ describe('TextComponent', () => {
122145 await fixture . whenStable ( ) ;
123146 fixture . detectChanges ( ) ;
124147
125- expect ( mockMarkdownRenderer . render ) . toHaveBeenCalledWith ( '#### Heading' ) ;
148+ expect ( mockMarkdownRenderer . render ) . not . toHaveBeenCalled ( ) ;
149+ const element = fixture . debugElement . query ( By . css ( '.a2ui-text.h4' ) ) ;
150+ expect ( element ) . toBeTruthy ( ) ;
151+ const h4 = element . query ( By . css ( 'h4' ) ) ;
152+ expect ( h4 ) . toBeTruthy ( ) ;
153+ expect ( h4 . nativeElement . textContent . trim ( ) ) . toBe ( 'Heading' ) ;
126154 } ) ;
127155
128156 it ( 'should handle variant h5' , async ( ) => {
@@ -134,7 +162,12 @@ describe('TextComponent', () => {
134162 await fixture . whenStable ( ) ;
135163 fixture . detectChanges ( ) ;
136164
137- expect ( mockMarkdownRenderer . render ) . toHaveBeenCalledWith ( '##### Heading' ) ;
165+ expect ( mockMarkdownRenderer . render ) . not . toHaveBeenCalled ( ) ;
166+ const element = fixture . debugElement . query ( By . css ( '.a2ui-text.h5' ) ) ;
167+ expect ( element ) . toBeTruthy ( ) ;
168+ const h5 = element . query ( By . css ( 'h5' ) ) ;
169+ expect ( h5 ) . toBeTruthy ( ) ;
170+ expect ( h5 . nativeElement . textContent . trim ( ) ) . toBe ( 'Heading' ) ;
138171 } ) ;
139172
140173 it ( 'should handle missing text property' , async ( ) => {
0 commit comments