Skip to content

Commit

Permalink
fix: remove deprecated forRoot functions (#3539)
Browse files Browse the repository at this point in the history
* In beta.2 the `forRoot` calls have been deprecated, and it was stated that those will be removed in the next release (https://goo.gl/2yFPFc)
  • Loading branch information
devversion authored and mmalerba committed Apr 28, 2017
1 parent 29e503a commit c94f471
Show file tree
Hide file tree
Showing 63 changed files with 97 additions and 412 deletions.
2 changes: 1 addition & 1 deletion src/demo-app/demo-app-module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ import {StyleDemo} from './style/style-demo';
HttpModule,
ReactiveFormsModule,
RouterModule.forRoot(DEMO_APP_ROUTES),
MaterialModule.forRoot(),
MaterialModule,
MdSelectionModule,
],
declarations: [
Expand Down
2 changes: 1 addition & 1 deletion src/e2e-app/e2e-app-module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import {InputE2E} from './input/input-e2e';
imports: [
BrowserModule,
RouterModule.forRoot(E2E_APP_ROUTES),
MaterialModule.forRoot(),
MaterialModule,
NoopAnimationsModule,
],
declarations: [
Expand Down
4 changes: 2 additions & 2 deletions src/lib/autocomplete/autocomplete.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ describe('MdAutocomplete', () => {
dir = 'ltr';
TestBed.configureTestingModule({
imports: [
MdAutocompleteModule.forRoot(),
MdInputModule.forRoot(),
MdAutocompleteModule,
MdInputModule,
FormsModule,
ReactiveFormsModule,
NoopAnimationsModule
Expand Down
15 changes: 3 additions & 12 deletions src/lib/autocomplete/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import {ModuleWithProviders, NgModule} from '@angular/core';

import {MdOptionModule, OverlayModule, OVERLAY_PROVIDERS, MdCommonModule} from '../core';
import {NgModule} from '@angular/core';
import {MdOptionModule, OverlayModule, MdCommonModule} from '../core';
import {CommonModule} from '@angular/common';
import {MdAutocomplete} from './autocomplete';
import {MdAutocompleteTrigger} from './autocomplete-trigger';
Expand All @@ -10,15 +9,7 @@ import {MdAutocompleteTrigger} from './autocomplete-trigger';
exports: [MdAutocomplete, MdOptionModule, MdAutocompleteTrigger, MdCommonModule],
declarations: [MdAutocomplete, MdAutocompleteTrigger],
})
export class MdAutocompleteModule {
/** @deprecated */
static forRoot(): ModuleWithProviders {
return {
ngModule: MdAutocompleteModule,
providers: [OVERLAY_PROVIDERS]
};
}
}
export class MdAutocompleteModule {}


export * from './autocomplete';
Expand Down
2 changes: 1 addition & 1 deletion src/lib/button-toggle/button-toggle.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ describe('MdButtonToggle', () => {

beforeEach(async(() => {
TestBed.configureTestingModule({
imports: [MdButtonToggleModule.forRoot(), FormsModule, ReactiveFormsModule],
imports: [MdButtonToggleModule, FormsModule, ReactiveFormsModule],
declarations: [
ButtonTogglesInsideButtonToggleGroup,
ButtonToggleGroupWithNgModel,
Expand Down
12 changes: 2 additions & 10 deletions src/lib/button-toggle/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {NgModule, ModuleWithProviders} from '@angular/core';
import {NgModule} from '@angular/core';
import {FormsModule} from '@angular/forms';
import {MdButtonToggleGroup, MdButtonToggleGroupMultiple, MdButtonToggle} from './button-toggle';
import {
Expand All @@ -19,15 +19,7 @@ import {
declarations: [MdButtonToggleGroup, MdButtonToggleGroupMultiple, MdButtonToggle],
providers: [UNIQUE_SELECTION_DISPATCHER_PROVIDER, FocusOriginMonitor]
})
export class MdButtonToggleModule {
/** @deprecated */
static forRoot(): ModuleWithProviders {
return {
ngModule: MdButtonToggleModule,
providers: []
};
}
}
export class MdButtonToggleModule {}


export * from './button-toggle';
2 changes: 1 addition & 1 deletion src/lib/button/button.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ describe('MdButton', () => {

beforeEach(async(() => {
TestBed.configureTestingModule({
imports: [MdButtonModule.forRoot()],
imports: [MdButtonModule],
declarations: [TestApp],
providers: [
{provide: ViewportRuler, useClass: FakeViewportRuler},
Expand Down
12 changes: 2 additions & 10 deletions src/lib/button/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {ModuleWithProviders, NgModule} from '@angular/core';
import {NgModule} from '@angular/core';
import {CommonModule} from '@angular/common';
import {MdCommonModule, MdRippleModule, StyleModule} from '../core';
import {
Expand Down Expand Up @@ -42,12 +42,4 @@ export * from './button';
MdMiniFabCssMatStyler,
],
})
export class MdButtonModule {
/** @deprecated */
static forRoot(): ModuleWithProviders {
return {
ngModule: MdButtonModule,
providers: []
};
}
}
export class MdButtonModule {}
12 changes: 2 additions & 10 deletions src/lib/card/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {NgModule, ModuleWithProviders} from '@angular/core';
import {NgModule} from '@angular/core';
import {MdCommonModule} from '../core';
import {
MdCard,
Expand Down Expand Up @@ -43,15 +43,7 @@ import {
MdCardXlImage, MdCardAvatar,
],
})
export class MdCardModule {
/** @deprecated */
static forRoot(): ModuleWithProviders {
return {
ngModule: MdCardModule,
providers: []
};
}
}
export class MdCardModule {}


export * from './card';
2 changes: 1 addition & 1 deletion src/lib/checkbox/checkbox.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ describe('MdCheckbox', () => {

beforeEach(async(() => {
TestBed.configureTestingModule({
imports: [MdCheckboxModule.forRoot(), FormsModule, ReactiveFormsModule],
imports: [MdCheckboxModule, FormsModule, ReactiveFormsModule],
declarations: [
SingleCheckbox,
CheckboxWithFormDirectives,
Expand Down
12 changes: 2 additions & 10 deletions src/lib/checkbox/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {NgModule, ModuleWithProviders} from '@angular/core';
import {NgModule} from '@angular/core';
import {CommonModule} from '@angular/common';
import {MdRippleModule, MdCommonModule, FocusOriginMonitor} from '../core';
import {MdCheckbox} from './checkbox';
Expand All @@ -10,15 +10,7 @@ import {MdCheckbox} from './checkbox';
declarations: [MdCheckbox],
providers: [FocusOriginMonitor]
})
export class MdCheckboxModule {
/** @deprecated */
static forRoot(): ModuleWithProviders {
return {
ngModule: MdCheckboxModule,
providers: []
};
}
}
export class MdCheckboxModule {}


export * from './checkbox';
2 changes: 1 addition & 1 deletion src/lib/chips/chip-list.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ describe('MdChipList', () => {

beforeEach(async(() => {
TestBed.configureTestingModule({
imports: [MdChipsModule.forRoot()],
imports: [MdChipsModule],
declarations: [
StaticChipList
]
Expand Down
2 changes: 1 addition & 1 deletion src/lib/chips/chip.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ describe('Chips', () => {

beforeEach(async(() => {
TestBed.configureTestingModule({
imports: [MdChipsModule.forRoot()],
imports: [MdChipsModule],
declarations: [
BasicChip, SingleChip
]
Expand Down
12 changes: 2 additions & 10 deletions src/lib/chips/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {NgModule, ModuleWithProviders} from '@angular/core';
import {NgModule} from '@angular/core';
import {MdChipList} from './chip-list';
import {MdChip} from './chip';

Expand All @@ -8,15 +8,7 @@ import {MdChip} from './chip';
exports: [MdChipList, MdChip],
declarations: [MdChipList, MdChip]
})
export class MdChipsModule {
/** @deprecated */
static forRoot(): ModuleWithProviders {
return {
ngModule: MdChipsModule,
providers: []
};
}
}
export class MdChipsModule {}


export * from './chip-list';
Expand Down
12 changes: 2 additions & 10 deletions src/lib/core/a11y/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {NgModule, ModuleWithProviders} from '@angular/core';
import {NgModule} from '@angular/core';
import {FocusTrapDirective, FocusTrapDeprecatedDirective, FocusTrapFactory} from './focus-trap';
import {LIVE_ANNOUNCER_PROVIDER} from './live-announcer';
import {InteractivityChecker} from './interactivity-checker';
Expand All @@ -11,12 +11,4 @@ import {PlatformModule} from '../platform/index';
exports: [FocusTrapDirective, FocusTrapDeprecatedDirective],
providers: [InteractivityChecker, FocusTrapFactory, LIVE_ANNOUNCER_PROVIDER]
})
export class A11yModule {
/** @deprecated */
static forRoot(): ModuleWithProviders {
return {
ngModule: A11yModule,
providers: [],
};
}
}
export class A11yModule {}
6 changes: 3 additions & 3 deletions src/lib/core/compatibility/compatibility.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ describe('Style compatibility', () => {
TestBed.configureTestingModule({
// Specifically do *not* directly import the DefaultStyleCompatibilityModeModule
// to ensure that it is the default behavior.
imports: [MdCheckboxModule.forRoot()],
imports: [MdCheckboxModule],
declarations: [ComponentWithMdCheckbox, ComponentWithMatCheckbox],
});

Expand All @@ -45,7 +45,7 @@ describe('Style compatibility', () => {
describe('in no-conflict mode', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
imports: [MdCheckboxModule.forRoot(), NoConflictStyleCompatibilityMode],
imports: [MdCheckboxModule, NoConflictStyleCompatibilityMode],
declarations: [ComponentWithMdCheckbox, ComponentWithMatCheckbox],
});

Expand Down Expand Up @@ -97,7 +97,7 @@ class ComponentWithMatCheckbox { }


@NgModule({
imports: [MdCheckboxModule.forRoot()],
imports: [MdCheckboxModule],
exports: [ComponentWithMdCheckbox, ComponentWithMatCheckbox],
declarations: [ComponentWithMdCheckbox, ComponentWithMatCheckbox],
})
Expand Down
8 changes: 0 additions & 8 deletions src/lib/core/compatibility/compatibility.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import {
NgModule,
ModuleWithProviders,
Directive,
Inject,
Optional,
Expand Down Expand Up @@ -196,13 +195,6 @@ export class CompatibilityModule {
/** Whether we've done the global sanity checks (e.g. a theme is loaded, there is a doctype). */
private _hasDoneGlobalChecks = false;

static forRoot(): ModuleWithProviders {
return {
ngModule: CompatibilityModule,
providers: [],
};
}

constructor(
@Optional() @Inject(DOCUMENT) private _document: any,
@Optional() @Inject(MATERIAL_SANITY_CHECKS) _sanityChecksEnabled: boolean) {
Expand Down
12 changes: 2 additions & 10 deletions src/lib/core/core.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {NgModule, ModuleWithProviders} from '@angular/core';
import {NgModule} from '@angular/core';
import {MdLineModule} from './line/line';
import {RtlModule} from './rtl/dir';
import {ObserveContentModule} from './observe-content/observe-content';
Expand Down Expand Up @@ -141,12 +141,4 @@ export {MdCommonModule} from './common-behaviors/common-module';
MdSelectionModule,
],
})
export class MdCoreModule {
/** @deprecated */
static forRoot(): ModuleWithProviders {
return {
ngModule: MdCoreModule,
providers: [],
};
}
}
export class MdCoreModule {}
11 changes: 1 addition & 10 deletions src/lib/core/observe-content/observe-content.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import {
Directive,
ElementRef,
NgModule,
ModuleWithProviders,
Output,
EventEmitter,
OnDestroy,
Expand Down Expand Up @@ -45,12 +44,4 @@ export class ObserveContent implements AfterContentInit, OnDestroy {
exports: [ObserveContent],
declarations: [ObserveContent]
})
export class ObserveContentModule {
/** @deprecated */
static forRoot(): ModuleWithProviders {
return {
ngModule: ObserveContentModule,
providers: []
};
}
}
export class ObserveContentModule {}
10 changes: 1 addition & 9 deletions src/lib/core/option/option.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import {
Input,
Output,
NgModule,
ModuleWithProviders,
ViewEncapsulation,
Inject,
Optional,
Expand Down Expand Up @@ -179,11 +178,4 @@ export class MdOption {
exports: [MdOption],
declarations: [MdOption]
})
export class MdOptionModule {
static forRoot(): ModuleWithProviders {
return {
ngModule: MdOptionModule,
providers: []
};
}
}
export class MdOptionModule {}
2 changes: 1 addition & 1 deletion src/lib/core/overlay/overlay-directives.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ describe('Overlay directives', () => {

beforeEach(() => {
TestBed.configureTestingModule({
imports: [OverlayModule.forRoot()],
imports: [OverlayModule],
declarations: [ConnectedOverlayDirectiveTest],
providers: [
{provide: OverlayContainer, useFactory: () => {
Expand Down
11 changes: 1 addition & 10 deletions src/lib/core/overlay/overlay-directives.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import {
NgModule,
ModuleWithProviders,
Directive,
EventEmitter,
TemplateRef,
Expand Down Expand Up @@ -321,12 +320,4 @@ export class ConnectedOverlayDirective implements OnDestroy {
declarations: [ConnectedOverlayDirective, OverlayOrigin, Scrollable],
providers: [OVERLAY_PROVIDERS],
})
export class OverlayModule {
/** @deprecated */
static forRoot(): ModuleWithProviders {
return {
ngModule: OverlayModule,
providers: [],
};
}
}
export class OverlayModule {}
2 changes: 1 addition & 1 deletion src/lib/core/overlay/overlay.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ describe('Overlay', () => {

beforeEach(async(() => {
TestBed.configureTestingModule({
imports: [OverlayModule.forRoot(), PortalModule, OverlayTestModule],
imports: [OverlayModule, PortalModule, OverlayTestModule],
providers: [
{provide: OverlayContainer, useFactory: () => {
overlayContainerElement = document.createElement('div');
Expand Down
2 changes: 1 addition & 1 deletion src/lib/core/overlay/scroll/scroll-dispatcher.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ describe('Scroll Dispatcher', () => {

beforeEach(async(() => {
TestBed.configureTestingModule({
imports: [OverlayModule.forRoot(), ScrollTestModule],
imports: [OverlayModule, ScrollTestModule],
});

TestBed.compileComponents();
Expand Down
Loading

0 comments on commit c94f471

Please sign in to comment.