|
| 1 | +import * as path from 'path'; |
| 2 | + |
| 3 | +// tslint:disable:no-implicit-dependencies |
| 4 | +import { virtualFs } from '@angular-devkit/core'; |
| 5 | +import { EmptyTree } from '@angular-devkit/schematics'; |
| 6 | +// tslint:disable-next-line:no-submodule-imports |
| 7 | +import { SchematicTestRunner, UnitTestTree } from '@angular-devkit/schematics/testing'; |
| 8 | + |
| 9 | +describe('Update 7.3.4', () => { |
| 10 | + let appTree: UnitTestTree; |
| 11 | + const schematicRunner = new SchematicTestRunner('ig-migrate', path.join(__dirname, '../migration-collection.json')); |
| 12 | + const configJson = { |
| 13 | + defaultProject: 'testProj', |
| 14 | + projects: { |
| 15 | + testProj: { |
| 16 | + sourceRoot: '/testSrc' |
| 17 | + } |
| 18 | + }, |
| 19 | + schematics: { |
| 20 | + '@schematics/angular:component': { |
| 21 | + prefix: 'appPrefix' |
| 22 | + } |
| 23 | + } |
| 24 | + }; |
| 25 | + |
| 26 | + beforeEach(() => { |
| 27 | + appTree = new UnitTestTree(new EmptyTree()); |
| 28 | + appTree.create('/angular.json', JSON.stringify(configJson)); |
| 29 | + }); |
| 30 | + |
| 31 | + it('should update time picker events', done => { |
| 32 | + appTree.create( |
| 33 | + '/testSrc/appPrefix/component/test.component.html', |
| 34 | + `<igx-time-picker (onOpen)="handler" (onClose)="handler"></igx-time-picker>` |
| 35 | + ); |
| 36 | + const tree = schematicRunner.runSchematic('migration-09', {}, appTree); |
| 37 | + expect(tree.readContent('/testSrc/appPrefix/component/test.component.html')) |
| 38 | + .toEqual( |
| 39 | + `<igx-time-picker (onOpened)="handler" (onClosed)="handler"></igx-time-picker>`); |
| 40 | + done(); |
| 41 | + }); |
| 42 | + |
| 43 | + it('should update date picker events', done => { |
| 44 | + appTree.create( |
| 45 | + '/testSrc/appPrefix/component/test.component.html', |
| 46 | + `<igx-date-picker (onOpen)="handler" (onClose)="handler"></igx-date-picker>` |
| 47 | + ); |
| 48 | + const tree = schematicRunner.runSchematic('migration-09', {}, appTree); |
| 49 | + expect(tree.readContent('/testSrc/appPrefix/component/test.component.html')) |
| 50 | + .toEqual( |
| 51 | + `<igx-date-picker (onOpened)="handler" (onClosed)="handler"></igx-date-picker>`); |
| 52 | + done(); |
| 53 | + }); |
| 54 | +}); |
0 commit comments