Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(material/schematics): rename references in MDC generate schematic #25773

Merged
merged 1 commit into from
Oct 10, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion integration/mdc-migration/golden/src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import {MatRadioModule} from '@angular/material/radio';
import {MatSelectModule} from '@angular/material/select';
import {MatSlideToggleModule} from '@angular/material/slide-toggle';
import {MatSliderModule} from '@angular/material/slider';
import {MatLegacySnackBarModule as MatSnackBarModule} from '@angular/material/legacy-snack-bar';
import {MatSnackBarModule} from '@angular/material/snack-bar';
import {MatTableModule} from '@angular/material/table';
import {MatTabsModule} from '@angular/material/tabs';
import {MatTooltipModule} from '@angular/material/tooltip';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {ComponentFixture, TestBed} from '@angular/core/testing';
import {BrowserAnimationsModule} from '@angular/platform-browser/animations';
import {MatSnackBarModule} from '@angular/material/legacy-snack-bar';
import {MatSnackBarModule} from '@angular/material/snack-bar';
import {SnackBarComponent} from './snack-bar.component';

describe('SnackBarComponent', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {Component} from '@angular/core';
import {MatLegacySnackBar as MatSnackBar} from '@angular/material/legacy-snack-bar';
import {MatSnackBar} from '@angular/material/snack-bar';

@Component({
selector: 'snack-bar-example',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,18 @@
*/

import {SchematicTestRunner, UnitTestTree} from '@angular-devkit/schematics/testing';
import {join} from 'path';

import {runfiles} from '@bazel/runfiles';

const TS_CONFIG = '/projects/material/tsconfig.app.json';
const PROJECT_ROOT = '/projects/material';
const SRC = join(PROJECT_ROOT, 'src');

export const THEME_FILE = '/projects/material/src/theme.scss';
export const APP_MODULE_FILE = '/projects/material/src/app/app.module.ts';
export const TEMPLATE_FILE = '/projects/material/src/app/app.component.html';
export const APP_ROOT = join(SRC, 'app');
export const TS_CONFIG = join(PROJECT_ROOT, 'tsconfig.app.json');
export const THEME_FILE = join(SRC, 'theme.scss');
export const APP_MODULE_FILE = join(APP_ROOT, 'app.module.ts');
export const TEMPLATE_FILE = join(APP_ROOT, 'app.component.html');

export function createNewTestRunner(): SchematicTestRunner {
return new SchematicTestRunner(
Expand Down
73 changes: 49 additions & 24 deletions src/material/schematics/ng-generate/mdc-migration/rules/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ import {PaginatorStylesMigrator} from './components/paginator/paginator-styles';
import {ProgressBarStylesMigrator} from './components/progress-bar/progress-bar-styles';
import {ProgressSpinnerStylesMigrator} from './components/progress-spinner/progress-spinner-styles';
import {RadioStylesMigrator} from './components/radio/radio-styles';
import {RuntimeMigrator} from './ts-migration/runtime-migrator';
import {SelectStylesMigrator} from './components/select/select-styles';
import {SlideToggleStylesMigrator} from './components/slide-toggle/slide-toggle-styles';
import {SliderStylesMigrator} from './components/slider/slider-styles';
Expand All @@ -41,106 +40,135 @@ export interface ComponentMigrator {
component: string;
styles: StyleMigrator;
template?: TemplateMigrator;
runtime?: RuntimeMigrator;
}

export const LEGACY_MODULES = new Set(
[
'legacy-autocomplete',
'legacy-autocomplete/testing',
'legacy-button',
'legacy-button/testing',
'legacy-card',
'legacy-card/testing',
'legacy-checkbox',
'legacy-checkbox/testing',
'legacy-chips',
'legacy-chips/testing',
'legacy-core',
'legacy-core/testing',
'legacy-dialog',
'legacy-dialog/testing',
'legacy-form-field',
'legacy-form-field/testing',
'legacy-input',
'legacy-input/testing',
'legacy-list',
'legacy-list/testing',
'legacy-menu',
'legacy-menu/testing',
'legacy-paginator',
'legacy-paginator/testing',
'legacy-progress-bar',
'legacy-progress-bar/testing',
'legacy-progress-spinner',
'legacy-progress-spinner/testing',
'legacy-radio',
'legacy-radio/testing',
'legacy-select',
'legacy-select/testing',
'legacy-slide-toggle',
'legacy-slide-toggle/testing',
'legacy-slider',
'legacy-slider/testing',
'legacy-snack-bar',
'legacy-snack-bar/testing',
'legacy-table',
'legacy-table/testing',
'legacy-tabs',
'legacy-tabs/testing',
'legacy-tooltip',
'legacy-tooltip/testing',
].map(name => `@angular/material/${name}`),
);

export const MIGRATORS: ComponentMigrator[] = [
{
component: 'autocomplete',
styles: new AutocompleteStylesMigrator(),
runtime: new RuntimeMigrator('autocomplete'),
},
{
component: 'button',
styles: new ButtonStylesMigrator(),
runtime: new RuntimeMigrator('button'),
},
{
component: 'card',
styles: new CardStylesMigrator(),
runtime: new RuntimeMigrator('card'),
template: new CardTemplateMigrator(),
},
{
component: 'checkbox',
styles: new CheckboxStylesMigrator(),
runtime: new RuntimeMigrator('checkbox'),
},
{
component: 'chips',
styles: new ChipsStylesMigrator(),
runtime: new RuntimeMigrator('chips'),
template: new ChipsTemplateMigrator(),
},
{
component: 'dialog',
styles: new DialogStylesMigrator(),
runtime: new RuntimeMigrator('dialog'),
},
{
component: 'form-field',
styles: new FormFieldStylesMigrator(),
runtime: new RuntimeMigrator('form-field'),
},
{
component: 'input',
styles: new InputStylesMigrator(),
runtime: new RuntimeMigrator('input'),
},
{
component: 'list',
styles: new ListStylesMigrator(),
runtime: new RuntimeMigrator('list'),
},
{
component: 'menu',
styles: new MenuStylesMigrator(),
runtime: new RuntimeMigrator('menu'),
},
{
component: 'optgroup',
styles: new OptgroupStylesMigrator(),
runtime: new RuntimeMigrator('optgroup'),
},
{
component: 'option',
styles: new OptionStylesMigrator(),
runtime: new RuntimeMigrator('option'),
},
{
component: 'paginator',
styles: new PaginatorStylesMigrator(),
runtime: new RuntimeMigrator('paginator'),
},
{
component: 'progress-bar',
styles: new ProgressBarStylesMigrator(),
runtime: new RuntimeMigrator('progress-bar'),
},
{
component: 'progress-spinner',
styles: new ProgressSpinnerStylesMigrator(),
runtime: new RuntimeMigrator('progress-spinner'),
},
{
component: 'radio',
styles: new RadioStylesMigrator(),
runtime: new RuntimeMigrator('radio'),
},
{
component: 'select',
styles: new SelectStylesMigrator(),
runtime: new RuntimeMigrator('select'),
},
{
component: 'slide-toggle',
styles: new SlideToggleStylesMigrator(),
runtime: new RuntimeMigrator('slide-toggle'),
},
{
component: 'slider',
styles: new SliderStylesMigrator(),
runtime: new RuntimeMigrator('slider'),
},
{
component: 'snack-bar',
Expand All @@ -149,16 +177,13 @@ export const MIGRATORS: ComponentMigrator[] = [
{
component: 'table',
styles: new TableStylesMigrator(),
runtime: new RuntimeMigrator('table'),
},
{
component: 'tabs',
styles: new TabsStylesMigrator(),
runtime: new RuntimeMigrator('tabs'),
},
{
component: 'tooltip',
styles: new TooltipStylesMigrator(),
runtime: new RuntimeMigrator('tooltip'),
},
];

This file was deleted.

Loading