Skip to content

Commit 9035811

Browse files
committed
fix(migrations): properly restrict start/end tag matching #9239
1 parent edb2e85 commit 9035811

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

projects/igniteui-angular/migrations/common/UpdateChanges.spec.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,10 @@ describe('UpdateChanges', () => {
6565
'test2.component.html',
6666
'<igx-remove attr></igx-remove><igx-component>'
6767
);
68+
appTree.create(
69+
'test3.component.html',
70+
'<igx-remove-me-not attr></igx-remove-me-not> <igx-component> <igx-component-child></igx-component-child> </igx-component>'
71+
);
6872

6973
const update = new UnitUpdateChanges(__dirname, appTree);
7074
expect(fs.existsSync).toHaveBeenCalledWith(jsonPath);
@@ -74,6 +78,9 @@ describe('UpdateChanges', () => {
7478
update.applyChanges();
7579
expect(appTree.readContent('test.component.html')).toEqual('<igx-replaced> <content> </igx-replaced> ');
7680
expect(appTree.readContent('test2.component.html')).toEqual('<igx-replaced>');
81+
expect(appTree.readContent('test3.component.html')).toEqual(
82+
'<igx-remove-me-not attr></igx-remove-me-not> <igx-replaced> <igx-component-child></igx-component-child> </igx-replaced>'
83+
);
7784
done();
7885
});
7986

projects/igniteui-angular/migrations/common/UpdateChanges.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ export class UpdateChanges {
198198
regSource = String.raw`\<${change.selector}[\s\S]*?\<\/${change.selector}\>`;
199199
replace = '';
200200
} else {
201-
regSource = String.raw`\<(\/?)${change.selector}`;
201+
regSource = String.raw`\<(\/?)${change.selector}(?=[\s\>])`;
202202
replace = `<$1${change.replaceWith}`;
203203
}
204204
break;

0 commit comments

Comments
 (0)