File tree Expand file tree Collapse file tree 2 files changed +13
-1
lines changed
projects/igniteui-angular/migrations/common Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -182,7 +182,7 @@ describe('UpdateChanges', () => {
182182 } ) ;
183183 spyOn < any > ( fs , 'readFileSync' ) . and . callFake ( ( ) => JSON . stringify ( inputJson ) ) ;
184184
185- const fileContent = `<one [replaceMe]="a"> <comp\r\ntag [replaceMe]="dwdw" [oldProp]=''> </other> <another oldProp="b" />` ;
185+ let fileContent = `<one [replaceMe]="a"> <comp\r\ntag [replaceMe]="dwdw" [oldProp]=''> </other> <another oldProp="b" />` ;
186186 appTree . create ( 'test.component.html' , fileContent ) ;
187187
188188 const update = new UnitUpdateChanges ( __dirname , appTree ) ;
@@ -220,6 +220,15 @@ describe('UpdateChanges', () => {
220220 update4 . applyChanges ( ) ;
221221 expect ( appTree . readContent ( 'test.component.html' ) ) . toEqual (
222222 `<comp\r\ntag [oldProp]="g" [replaced]="NOT.replaceMe" ><another [otherProp]="oldProp" /></comp>` ) ;
223+
224+
225+ fileContent = `<span [bait]="replaceMe"><ng-container ngProjectAs="comp"> sike! </ng-container></span>` ;
226+ appTree . overwrite ( 'test.component.html' , fileContent ) ;
227+ update4 . applyChanges ( ) ;
228+ expect ( appTree . readContent ( 'test.component.html' ) ) . toEqual (
229+ `<span [bait]="replaceMe"><ng-container ngProjectAs="comp"> sike! </ng-container></span>`
230+ ) ;
231+
223232 done ( ) ;
224233 } ) ;
225234
Original file line number Diff line number Diff line change @@ -276,6 +276,9 @@ export class UpdateChanges {
276276 }
277277
278278 const matches = fileContent . match ( new RegExp ( searchPattern , 'g' ) ) ;
279+ if ( ! matches ) {
280+ continue ;
281+ }
279282
280283 for ( const match of matches ) {
281284 let replaceStatement = replace ;
You can’t perform that action at this time.
0 commit comments