From 3b49eb5da3064535e37c8861de71bf10735661d8 Mon Sep 17 00:00:00 2001 From: Tacho Date: Tue, 6 Aug 2019 11:19:39 +0300 Subject: [PATCH] feat(esf): update migrations #5448 --- .../migrations/migration-collection.json | 5 ++ .../update-8_2_0/changes/selectors.json | 25 +++++++++ .../migrations/update-8_2_0/index.spec.ts | 53 +++++++++++++++++++ .../migrations/update-8_2_0/index.ts | 17 ++++++ 4 files changed, 100 insertions(+) create mode 100644 projects/igniteui-angular/migrations/update-8_2_0/changes/selectors.json create mode 100644 projects/igniteui-angular/migrations/update-8_2_0/index.spec.ts create mode 100644 projects/igniteui-angular/migrations/update-8_2_0/index.ts diff --git a/projects/igniteui-angular/migrations/migration-collection.json b/projects/igniteui-angular/migrations/migration-collection.json index 3f8599e3284..999c2997364 100644 --- a/projects/igniteui-angular/migrations/migration-collection.json +++ b/projects/igniteui-angular/migrations/migration-collection.json @@ -45,6 +45,11 @@ "version": "7.3.4", "description": "Updates Ignite UI for Angular from v7.2.0 to v7.3.4", "factory": "./update-7_3_4" + }, + "migration-10": { + "version": "8.2.0", + "description": "Updates Ignite UI for Angular from v8.1.x to v8.2.0", + "factory": "./update-8_2_0" } } } diff --git a/projects/igniteui-angular/migrations/update-8_2_0/changes/selectors.json b/projects/igniteui-angular/migrations/update-8_2_0/changes/selectors.json new file mode 100644 index 00000000000..78c0c033e8f --- /dev/null +++ b/projects/igniteui-angular/migrations/update-8_2_0/changes/selectors.json @@ -0,0 +1,25 @@ +{ + "$schema": "../../common/schema/selector.schema.json", + "changes": [ + { + "type": "directive", + "selector": "igxExcelStyleSortingTemplate", + "replaceWith": "igxExcelStyleSorting" + }, + { + "type": "directive", + "selector": "igxExcelStyleMovingTemplate", + "replaceWith": "igxExcelStyleMoving" + }, + { + "type": "directive", + "selector": "igxExcelStyleHidingTemplate", + "replaceWith": "igxExcelStyleHiding" + }, + { + "type": "directive", + "selector": "igxExcelStylePinningTemplate", + "replaceWith": "igxExcelStylePinning" + } + ] +} diff --git a/projects/igniteui-angular/migrations/update-8_2_0/index.spec.ts b/projects/igniteui-angular/migrations/update-8_2_0/index.spec.ts new file mode 100644 index 00000000000..8d9cd5a2eae --- /dev/null +++ b/projects/igniteui-angular/migrations/update-8_2_0/index.spec.ts @@ -0,0 +1,53 @@ +import * as path from 'path'; + +// tslint:disable:no-implicit-dependencies +import { virtualFs } from '@angular-devkit/core'; +import { EmptyTree } from '@angular-devkit/schematics'; +// tslint:disable-next-line:no-submodule-imports +import { SchematicTestRunner, UnitTestTree } from '@angular-devkit/schematics/testing'; + +describe('Update 8.2.0', () => { + let appTree: UnitTestTree; + const schematicRunner = new SchematicTestRunner('ig-migrate', path.join(__dirname, '../migration-collection.json')); + const configJson = { + defaultProject: 'testProj', + projects: { + testProj: { + sourceRoot: '/testSrc' + } + }, + schematics: { + '@schematics/angular:component': { + prefix: 'appPrefix' + } + } + }; + + beforeEach(() => { + appTree = new UnitTestTree(new EmptyTree()); + appTree.create('/angular.json', JSON.stringify(configJson)); + }); + + it('should update Excel Style Filtering template selectors', done => { + appTree.create( + '/testSrc/appPrefix/component/custom.component.html', + ` +
Sorting Template
+
Hiding Template
+
Moving Template
+
Pinning Template
+
`); + + const tree = schematicRunner.runSchematic('migration-10', {}, appTree); + expect(tree.readContent('/testSrc/appPrefix/component/custom.component.html')) + .toEqual( + ` +
Sorting Template
+
Hiding Template
+
Moving Template
+
Pinning Template
+
`); + + done(); + }); +}); diff --git a/projects/igniteui-angular/migrations/update-8_2_0/index.ts b/projects/igniteui-angular/migrations/update-8_2_0/index.ts new file mode 100644 index 00000000000..59cb3c16529 --- /dev/null +++ b/projects/igniteui-angular/migrations/update-8_2_0/index.ts @@ -0,0 +1,17 @@ +import { + Rule, + SchematicContext, + Tree +} from '@angular-devkit/schematics'; +import { UpdateChanges } from '../common/UpdateChanges'; + +const version = '8.2.0'; + +export default function(): Rule { + return (host: Tree, context: SchematicContext) => { + context.logger.info(`Applying migration for Ignite UI for Angular to version ${version}`); + + const update = new UpdateChanges(__dirname, host, context); + update.applyChanges(); + }; +}