11import { MutationObserverFactory } from '@angular/cdk/observers' ;
2- import { Component , Input } from '@angular/core' ;
2+ import { Component } from '@angular/core' ;
33import { ComponentFixture , fakeAsync , flush , inject , TestBed , tick } from '@angular/core/testing' ;
44import { By } from '@angular/platform-browser' ;
55import { A11yModule } from '../index' ;
@@ -288,7 +288,7 @@ describe('CdkAriaLive', () => {
288288 invokeMutationCallbacks ( ) ;
289289 flush ( ) ;
290290
291- expect ( announcer . announce ) . toHaveBeenCalledWith ( 'New content' , 'polite' ) ;
291+ expect ( announcer . announce ) . toHaveBeenCalledWith ( 'New content' , 'polite' , undefined ) ;
292292
293293 announcerSpy . calls . reset ( ) ;
294294 fixture . componentInstance . politeness = 'off' ;
@@ -306,7 +306,7 @@ describe('CdkAriaLive', () => {
306306 invokeMutationCallbacks ( ) ;
307307 flush ( ) ;
308308
309- expect ( announcer . announce ) . toHaveBeenCalledWith ( 'Newest content' , 'assertive' ) ;
309+ expect ( announcer . announce ) . toHaveBeenCalledWith ( 'Newest content' , 'assertive' , undefined ) ;
310310 } ) ) ;
311311
312312 it ( 'should not announce the same text multiple times' , fakeAsync ( ( ) => {
@@ -324,6 +324,16 @@ describe('CdkAriaLive', () => {
324324 expect ( announcer . announce ) . toHaveBeenCalledTimes ( 1 ) ;
325325 } ) ) ;
326326
327+ it ( 'should be able to pass in a duration' , fakeAsync ( ( ) => {
328+ fixture . componentInstance . content = 'New content' ;
329+ fixture . componentInstance . duration = 1337 ;
330+ fixture . detectChanges ( ) ;
331+ invokeMutationCallbacks ( ) ;
332+ flush ( ) ;
333+
334+ expect ( announcer . announce ) . toHaveBeenCalledWith ( 'New content' , 'polite' , 1337 ) ;
335+ } ) ) ;
336+
327337} ) ;
328338
329339
@@ -340,8 +350,11 @@ class TestApp {
340350 }
341351}
342352
343- @Component ( { template : `<div [cdkAriaLive]="politeness">{{content}}</div>` } )
353+ @Component ( {
354+ template : `<div [cdkAriaLive]="politeness" [cdkAriaLiveDuration]="duration">{{content}}</div>`
355+ } )
344356class DivWithCdkAriaLive {
345- @Input ( ) politeness = 'polite' ;
346- @Input ( ) content = 'Initial content' ;
357+ politeness = 'polite' ;
358+ content = 'Initial content' ;
359+ duration : number ;
347360}
0 commit comments