Skip to content

fix(tab-nav): add constructor back for ripple #3537

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

Merged
merged 1 commit into from
Mar 9, 2017
Merged
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
11 changes: 9 additions & 2 deletions src/lib/tabs/tab-nav-bar/tab-nav-bar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@ import {
ViewChild,
ElementRef,
ViewEncapsulation,
Directive,
Directive, NgZone, Inject, Optional,
} from '@angular/core';
import {MdInkBar} from '../ink-bar';
import {MdRipple} from '../../core/ripple/index';
import {ViewportRuler} from '../../core/overlay/position/viewport-ruler';
import {MD_DISABLE_RIPPLES} from '../../core/ripple/ripple';

/**
* Navigation component matching the styles of the tab group header.
Expand Down Expand Up @@ -79,4 +81,9 @@ export class MdTabLink {
'[class.mat-tab-link]': 'true',
},
})
export class MdTabLinkRipple extends MdRipple {}
export class MdTabLinkRipple extends MdRipple {
constructor(elementRef: ElementRef, ngZone: NgZone, ruler: ViewportRuler,
@Optional() @Inject(MD_DISABLE_RIPPLES) forceDisableRipples: boolean) {
super(elementRef, ngZone, ruler, forceDisableRipples);
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a way to add a test for this?

Copy link
Contributor Author

@andrewseguin andrewseguin Mar 9, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not that I know of, I'm not sure there's supposed to be a behavior difference between having/missing the constructor, or a way to detect it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tried replicating the issue in our tests without any luck. Actually surprised the tests were working before since it appears they would have had issues.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did it fail at all actually?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

An issue in core where the automatic constructor inheritance did not work because the classes span across different modules (Here, a class in MdTabsModule inheriting from MdRippleModule). In practice what was happening is that the elementRef was undefined in the ripple constructor, causing the component and app to fail.

This didn't show up in our demo app but was coming up in some Google apps.

}