This repository was archived by the owner on Oct 7, 2020. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +24
-2
lines changed
demos/components/chips-demo Expand file tree Collapse file tree 3 files changed +24
-2
lines changed Original file line number Diff line number Diff line change @@ -95,6 +95,10 @@ <h2>Design & API Documentation</h2>
9595 < td > removable: boolean</ td >
9696 < td > Sets whether a trailing icon click should trigger exit/removal of the chip. (Default is true)</ td >
9797 </ tr >
98+ < tr >
99+ < td > disableRipple: boolean</ td >
100+ < td > Whether ripples are disabled.</ td >
101+ </ tr >
98102 < tr >
99103 < td > primary: boolean</ td >
100104 < td > Colors selected chip with the primary theme color.</ td >
@@ -172,6 +176,7 @@ <h3 class="demo-content__headline">Chip - Theming</h3>
172176 < div class ="demo-layout__row ">
173177 < button mdc-button (click) ="simplechip.primary = !simplechip.primary "> Primary: {{simplechip.primary ? 'On' : 'Off'}}</ button >
174178 < button mdc-button (click) ="simplechip.secondary = !simplechip.secondary "> Secondary: {{simplechip.secondary ? 'On' : 'Off'}}</ button >
179+ < button mdc-button (click) ="simplechip.disableRipple = !simplechip.disableRipple "> Disable Ripple: {{simplechip.disableRipple ? 'On' : 'Off'}}</ button >
175180 </ div >
176181 < mdc-chip-set >
177182 < mdc-chip #simplechip >
Original file line number Diff line number Diff line change @@ -205,6 +205,14 @@ export class MdcChip implements AfterViewInit, OnDestroy {
205205 }
206206 private _disabled : boolean ;
207207
208+ /** Whether the chip ripple is disabled. */
209+ @Input ( )
210+ get disableRipple ( ) : boolean { return this . _disableRipple ; }
211+ set disableRipple ( value : boolean ) {
212+ this . _disableRipple = toBoolean ( value ) ;
213+ }
214+ private _disableRipple : boolean ;
215+
208216 /** Emitted when the chip is selected or deselected. */
209217 @Output ( ) readonly selectionChange : EventEmitter < MdcChipSelectionEvent > =
210218 new EventEmitter < MdcChipSelectionEvent > ( ) ;
@@ -283,7 +291,11 @@ export class MdcChip implements AfterViewInit, OnDestroy {
283291
284292 ngAfterViewInit ( ) : void {
285293 this . _foundation . init ( ) ;
286- this . _ripple . init ( { surface : this . _getHostElement ( ) } ) ;
294+ this . _ripple . init ( {
295+ surface : this . _getHostElement ( )
296+ } , Object . assign ( this . _ripple . createAdapter ( ) , {
297+ isSurfaceDisabled : ( ) => this . _disableRipple
298+ } ) ) ;
287299 this . _loadListeners ( ) ;
288300 }
289301
Original file line number Diff line number Diff line change @@ -80,6 +80,10 @@ describe('Chips', () => {
8080 expect ( testComponent . chipRemoved ) . toHaveBeenCalledTimes ( 1 ) ;
8181 } ) ;
8282
83+ it ( 'expect disableRipple to be true' , ( ) => {
84+ expect ( testInstance . disableRipple ) . toBeUndefined ( ) ;
85+ } ) ;
86+
8387 it ( 'handles focus event' , ( ) => {
8488 testInstance . focus ( ) ;
8589 fixture . detectChanges ( ) ;
@@ -196,7 +200,7 @@ describe('Chips', () => {
196200 <mdc-chip-text>Get Directions</mdc-chip-text>
197201 <mdc-chip-icon #trailingIcon trailing>more_vert</mdc-chip-icon>
198202 </mdc-chip>
199- <mdc-chip id="removableChip" [removable]="removable">
203+ <mdc-chip id="removableChip" [removable]="removable" [disableRipple]="disableRipple" >
200204 <mdc-chip-text>Get Weather</mdc-chip-text>
201205 </mdc-chip>
202206 <mdc-chip id="newsChip">
@@ -213,6 +217,7 @@ class ChipTest {
213217 input : boolean ;
214218 primary : boolean ;
215219 secondary : boolean ;
220+ disableRipple : boolean ;
216221
217222 @ViewChild ( 'trailingIcon' ) trailingIcon : MdcIcon ;
218223
You can’t perform that action at this time.
0 commit comments