Skip to content

Commit

Permalink
feat(esf): update migrations #5448
Browse files Browse the repository at this point in the history
  • Loading branch information
tachojelev committed Aug 6, 2019
1 parent 7c9412a commit 3b49eb5
Show file tree
Hide file tree
Showing 4 changed files with 100 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}
}
Original file line number Diff line number Diff line change
@@ -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"
}
]
}
53 changes: 53 additions & 0 deletions projects/igniteui-angular/migrations/update-8_2_0/index.spec.ts
Original file line number Diff line number Diff line change
@@ -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',
`<igx-grid [data]="data" height="500px" [autoGenerate]="true" [allowFiltering]='true' [filterMode]="'excelStyleFilter'">
<ng-template igxExcelStyleSortingTemplate><div class="esf-custom-sorting">Sorting Template</div></ng-template>
<ng-template igxExcelStyleHidingTemplate><div class="esf-custom-hiding">Hiding Template</div></ng-template>
<ng-template igxExcelStyleMovingTemplate><div class="esf-custom-moving">Moving Template</div></ng-template>
<ng-template igxExcelStylePinningTemplate><div class="esf-custom-pinning">Pinning Template</div></ng-template>
</igx-grid>`);

const tree = schematicRunner.runSchematic('migration-10', {}, appTree);
expect(tree.readContent('/testSrc/appPrefix/component/custom.component.html'))
.toEqual(
`<igx-grid [data]="data" height="500px" [autoGenerate]="true" [allowFiltering]='true' [filterMode]="'excelStyleFilter'">
<ng-template igxExcelStyleSorting><div class="esf-custom-sorting">Sorting Template</div></ng-template>
<ng-template igxExcelStyleHiding><div class="esf-custom-hiding">Hiding Template</div></ng-template>
<ng-template igxExcelStyleMoving><div class="esf-custom-moving">Moving Template</div></ng-template>
<ng-template igxExcelStylePinning><div class="esf-custom-pinning">Pinning Template</div></ng-template>
</igx-grid>`);

done();
});
});
17 changes: 17 additions & 0 deletions projects/igniteui-angular/migrations/update-8_2_0/index.ts
Original file line number Diff line number Diff line change
@@ -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();
};
}

0 comments on commit 3b49eb5

Please sign in to comment.