|
| 1 | +import * as path from 'path'; |
| 2 | +// tslint:disable:no-implicit-dependencies |
| 3 | +import { virtualFs } from '@angular-devkit/core'; |
| 4 | +import { EmptyTree } from '@angular-devkit/schematics'; |
| 5 | +// tslint:disable-next-line:no-submodule-imports |
| 6 | +import { SchematicTestRunner, UnitTestTree } from '@angular-devkit/schematics/testing'; |
| 7 | + |
| 8 | +describe('Update 8.2.6', () => { |
| 9 | + let appTree: UnitTestTree; |
| 10 | + const schematicRunner = new SchematicTestRunner('ig-migrate', path.join(__dirname, '../migration-collection.json')); |
| 11 | + const configJson = { |
| 12 | + defaultProject: 'testProj', |
| 13 | + projects: { |
| 14 | + testProj: { |
| 15 | + sourceRoot: '/testSrc' |
| 16 | + } |
| 17 | + }, |
| 18 | + schematics: { |
| 19 | + '@schematics/angular:component': { |
| 20 | + prefix: 'appPrefix' |
| 21 | + } |
| 22 | + } |
| 23 | + }; |
| 24 | + |
| 25 | + beforeEach(() => { |
| 26 | + appTree = new UnitTestTree(new EmptyTree()); |
| 27 | + appTree.create('/angular.json', JSON.stringify(configJson)); |
| 28 | + }); |
| 29 | + |
| 30 | + it('should update igx-carousel-theme prop', done => { |
| 31 | + appTree.create( |
| 32 | + '/testSrc/appPrefix/component/test.component.scss', |
| 33 | + `$my-toolbar-theme: igx-grid-toolbar-theme( |
| 34 | + $background-color: null, |
| 35 | + $button-background: null, |
| 36 | + $title-text-color: null, |
| 37 | + $button-text-color: null, |
| 38 | + $button-hover-background: null, |
| 39 | + $button-hover-text-color: null, |
| 40 | + $button-focus-background: null, |
| 41 | + $button-focus-text-color: null, |
| 42 | + $dropdown-background: null, |
| 43 | + $item-text-color: null, |
| 44 | + $item-hover-background: null, |
| 45 | + $item-hover-text-color: null, |
| 46 | + $item-focus-background: null, |
| 47 | + $item-focus-text-color: null |
| 48 | + );` |
| 49 | + ); |
| 50 | + const tree = schematicRunner.runSchematic('migration-12', {}, appTree); |
| 51 | + expect(tree.readContent('/testSrc/appPrefix/component/test.component.scss')) |
| 52 | + .toEqual( |
| 53 | + `$my-toolbar-theme: igx-grid-toolbar-theme( |
| 54 | + $background-color: null, |
| 55 | + $title-text-color: null, |
| 56 | + $dropdown-background: null, |
| 57 | + $item-text-color: null, |
| 58 | + $item-hover-background: null, |
| 59 | + $item-hover-text-color: null, |
| 60 | + $item-focus-background: null, |
| 61 | + $item-focus-text-color: null |
| 62 | + );` |
| 63 | + ); |
| 64 | + done(); |
| 65 | + }); |
| 66 | + |
| 67 | + it('should update igx-grid-paginator-theme', done => { |
| 68 | + appTree.create( |
| 69 | + '/testSrc/appPrefix/component/test.component.scss', |
| 70 | + `$dark-grid-paginator: igx-grid-paginator-theme($color: black); |
| 71 | + @include igx-grid-paginator($dark-grid-paginator); |
| 72 | + .igx-grid-paginator__pager { |
| 73 | + @include igx-button($dark-button); |
| 74 | + } |
| 75 | + $dark-grid-paginator-schema: extend($_dark-grid-pagination,());` |
| 76 | + ); |
| 77 | + const tree = schematicRunner.runSchematic('migration-12', {}, appTree); |
| 78 | + expect(tree.readContent('/testSrc/appPrefix/component/test.component.scss')) |
| 79 | + .toEqual( |
| 80 | + `$dark-grid-paginator: igx-paginator-theme($color: black); |
| 81 | + @include igx-paginator($dark-grid-paginator); |
| 82 | + .igx-grid-paginator__pager { |
| 83 | + @include igx-button($dark-button); |
| 84 | + } |
| 85 | + $dark-grid-paginator-schema: extend($_dark-pagination,());` |
| 86 | + ); |
| 87 | + done(); |
| 88 | + }); |
| 89 | +}); |
0 commit comments