Skip to content

chore(snack-bar): rename MdSnackBarRef instance to componentInstance #7138

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

Closed
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 src/lib/snack-bar/snack-bar-ref.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import {MdSnackBarContainer} from './snack-bar-container';
*/
export class MdSnackBarRef<T> {
/** The instance of the component making up the content of the snack bar. */
instance: T;
componentInstance: T;

/**
* The instance of the component making up the content of the snack bar.
Expand Down
16 changes: 8 additions & 8 deletions src/lib/snack-bar/snack-bar.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,9 @@ describe('MdSnackBar', () => {

viewContainerFixture.detectChanges();

expect(snackBarRef.instance instanceof SimpleSnackBar)
expect(snackBarRef.componentInstance instanceof SimpleSnackBar)
.toBe(true, 'Expected the snack bar content component to be SimpleSnackBar');
expect(snackBarRef.instance.snackBarRef)
expect(snackBarRef.componentInstance.snackBarRef)
.toBe(snackBarRef,
'Expected the snack bar reference to be placed in the component instance');

Expand All @@ -119,9 +119,9 @@ describe('MdSnackBar', () => {

viewContainerFixture.detectChanges();

expect(snackBarRef.instance instanceof SimpleSnackBar)
expect(snackBarRef.componentInstance instanceof SimpleSnackBar)
.toBe(true, 'Expected the snack bar content component to be SimpleSnackBar');
expect(snackBarRef.instance.snackBarRef)
expect(snackBarRef.componentInstance.snackBarRef)
.toBe(snackBarRef, 'Expected the snack bar reference to be placed in the component instance');

let messageElement = overlayContainerElement.querySelector('snack-bar-container')!;
Expand Down Expand Up @@ -391,7 +391,7 @@ describe('MdSnackBar', () => {
it('should open a custom component', () => {
const snackBarRef = snackBar.openFromComponent(BurritosNotification);

expect(snackBarRef.instance instanceof BurritosNotification)
expect(snackBarRef.componentInstance instanceof BurritosNotification)
.toBe(true, 'Expected the snack bar content component to be BurritosNotification');
expect(overlayContainerElement.textContent!.trim())
.toBe('Burritos are on the way.', 'Expected component to have the proper text.');
Expand All @@ -400,7 +400,7 @@ describe('MdSnackBar', () => {
it('should inject the snack bar reference into the component', () => {
const snackBarRef = snackBar.openFromComponent(BurritosNotification);

expect(snackBarRef.instance.snackBarRef)
expect(snackBarRef.componentInstance.snackBarRef)
.toBe(snackBarRef, 'Expected component to have an injected snack bar reference.');
});

Expand All @@ -411,8 +411,8 @@ describe('MdSnackBar', () => {
}
});

expect(snackBarRef.instance.data).toBeTruthy('Expected component to have a data object.');
expect(snackBarRef.instance.data.burritoType)
expect(snackBarRef.componentInstance.data).toBeTruthy('Expected component to have a data object.');
expect(snackBarRef.componentInstance.data.burritoType)
.toBe('Chimichanga', 'Expected the injected data object to be the one the user provided.');
});

Expand Down
2 changes: 1 addition & 1 deletion src/lib/snack-bar/snack-bar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ export class MdSnackBar {
const contentRef = container.attachComponentPortal(portal);

// We can't pass this via the injector, because the injector is created earlier.
snackBarRef.instance = contentRef.instance;
snackBarRef.componentInstance = contentRef.instance;

return snackBarRef;
}
Expand Down