@@ -92,7 +92,7 @@ describe('Directive: Mask with Textarea', () => {
92
92
component . clearIfNotMatch . set ( true ) ;
93
93
equalTextarea ( '123' , '123' , fixture ) ;
94
94
equalTextarea ( '12345678' , '1234-5678' , fixture ) ;
95
- equalTextarea ( 'abc' , '' , fixture ) ; // Should clear if doesn't match
95
+ equalTextarea ( 'abc' , '' , fixture ) ;
96
96
} ) ;
97
97
98
98
it ( 'should handle dropSpecialCharacters in textarea' , ( ) => {
@@ -119,7 +119,6 @@ describe('Directive: Mask with Textarea', () => {
119
119
component . mask . set ( '0000.0000' ) ;
120
120
equalTextarea ( '1234567' , '1234.567' , fixture ) ;
121
121
122
- // Change mask dynamically
123
122
component . mask . set ( '00/00/0000' ) ;
124
123
equalTextarea ( '12345678' , '12/34/5678' , fixture ) ;
125
124
} ) ;
@@ -144,44 +143,28 @@ describe('Directive: Mask with Textarea', () => {
144
143
} ) ;
145
144
146
145
it ( 'should handle textarea with no mask' , ( ) => {
147
- // No mask set
148
146
equalTextarea ( 'any text' , 'any text' , fixture ) ;
149
147
equalTextarea ( '123456' , '123456' , fixture ) ;
150
148
151
149
} ) ;
152
150
153
- it ( 'should handle textarea with large content' , ( ) => {
154
- component . mask . set ( 'A*' ) ;
155
- const largeText =
156
- 'This is a very long text that should be handled properly by the textarea with mask. ' . repeat (
157
- 10
158
- ) ;
159
- const expectedText = largeText . replace ( / \s / g, '' ) ; // Remove spaces for A* mask
160
- equalTextarea ( largeText , expectedText , fixture ) ;
161
- } ) ;
162
-
163
151
it ( 'should handle textarea with special characters in content' , ( ) => {
164
152
component . mask . set ( 'A*' ) ;
165
153
const textWithSpecialChars = 'Text with special chars: !@#$%^&*()_+-=[]{}|;:,.<>?' ;
166
- const expectedText = textWithSpecialChars . replace ( / [ ^ a - z A - Z ] / g, '' ) ; // Keep only letters for A* mask
154
+ const expectedText = textWithSpecialChars . replace ( / [ ^ a - z A - Z ] / g, '' ) ;
167
155
equalTextarea ( textWithSpecialChars , expectedText , fixture ) ;
168
156
} ) ;
169
157
170
158
it ( 'should handle textarea with arrow up key (should not be prevented)' , ( ) => {
171
159
component . mask . set ( '0000-0000' ) ;
172
160
const textarea = fixture . debugElement . query ( By . css ( '#masked' ) ) . nativeElement ;
173
161
174
- // Set some content and focus
175
162
textarea . value = '1234-5678' ;
176
163
textarea . focus ( ) ;
177
164
textarea . setSelectionRange ( 5 , 5 ) ;
178
165
179
- // Test arrow up (should work in textarea for line navigation)
180
166
const arrowUpEvent = new KeyboardEvent ( 'keydown' , { key : 'ArrowUp' } ) ;
181
167
textarea . dispatchEvent ( arrowUpEvent ) ;
182
-
183
- // Arrow up should not be prevented in textarea (this is the key test)
184
- // The event should not have defaultPrevented set to true
185
168
} ) ;
186
169
187
170
it ( 'should handle textarea with backspace key' , ( ) => {
@@ -194,8 +177,6 @@ describe('Directive: Mask with Textarea', () => {
194
177
195
178
const backspaceEvent = new KeyboardEvent ( 'keydown' , { key : 'Backspace' } ) ;
196
179
textarea . dispatchEvent ( backspaceEvent ) ;
197
-
198
- // Backspace should work normally in textarea
199
180
} ) ;
200
181
201
182
it ( 'should handle textarea with paste event' , ( ) => {
@@ -204,12 +185,9 @@ describe('Directive: Mask with Textarea', () => {
204
185
205
186
textarea . focus ( ) ;
206
187
207
- // Simulate paste event
208
188
const pasteEvent = new ClipboardEvent ( 'paste' , {
209
189
clipboardData : new DataTransfer ( ) ,
210
190
} ) ;
211
191
textarea . dispatchEvent ( pasteEvent ) ;
212
-
213
- // Paste should be handled
214
192
} ) ;
215
193
} ) ;
0 commit comments