11import { Component , DebugElement } from '@angular/core' ;
2- import { ComponentFixture , TestBed , fakeAsync , tick } from '@angular/core/testing' ;
2+ import { ComponentFixture , TestBed } from '@angular/core/testing' ;
33import { By } from '@angular/platform-browser' ;
44import { Menu , MenuBar , MenuItem , MenuTrigger } from './menu' ;
55
@@ -102,29 +102,27 @@ describe('Standalone Menu Pattern', () => {
102102 } ) ;
103103
104104 describe ( 'Typeahead' , ( ) => {
105- it ( 'should move the active item to the next item that starts with the typed character' , fakeAsync ( ( ) => {
105+ it ( 'should move the active item to the next item that starts with the typed character' , ( ) => {
106106 const apple = getItem ( 'Apple' ) ;
107107 const banana = getItem ( 'Banana' ) ;
108108
109109 keydown ( apple ! , 'b' ) ;
110110 expect ( document . activeElement ) . toBe ( banana ) ;
111- } ) ) ;
111+ } ) ;
112112
113- it ( 'should support multi-character typeahead' , fakeAsync ( ( ) => {
113+ it ( 'should support multi-character typeahead' , ( ) => {
114114 const apple = getItem ( 'Apple' ) ;
115115 const banana = getItem ( 'Banana' ) ;
116116 const berries = getItem ( 'Berries' ) ;
117117
118118 keydown ( apple ! , 'b' ) ;
119119 expect ( document . activeElement ) . toBe ( banana ) ;
120120
121- tick ( 100 ) ;
122121 keydown ( document . activeElement ! , 'e' ) ;
123-
124122 expect ( document . activeElement ) . toBe ( berries ) ;
125- } ) ) ;
123+ } ) ;
126124
127- it ( 'should wrap when reaching the end of the list during typeahead' , fakeAsync ( ( ) => {
125+ it ( 'should wrap when reaching the end of the list during typeahead' , ( ) => {
128126 const apple = getItem ( 'Apple' ) ;
129127 const cherry = getItem ( 'Cherry' ) ;
130128
@@ -135,14 +133,14 @@ describe('Standalone Menu Pattern', () => {
135133 // Type 'a', which should wrap to 'Apple'
136134 keydown ( document . activeElement ! , 'a' ) ;
137135 expect ( document . activeElement ) . toBe ( apple ) ;
138- } ) ) ;
136+ } ) ;
139137
140- it ( 'should not move the active item if no item matches the typed character' , fakeAsync ( ( ) => {
138+ it ( 'should not move the active item if no item matches the typed character' , ( ) => {
141139 const apple = getItem ( 'Apple' ) ;
142140
143141 keydown ( apple ! , 'z' ) ;
144142 expect ( document . activeElement ) . toBe ( apple ) ;
145- } ) ) ;
143+ } ) ;
146144 } ) ;
147145 } ) ;
148146
@@ -308,12 +306,11 @@ describe('Standalone Menu Pattern', () => {
308306 expect ( document . activeElement ) . toBe ( berries ) ;
309307 } ) ;
310308
311- it ( 'should open submenu on mouseover' , fakeAsync ( ( ) => {
309+ it ( 'should open submenu on mouseover' , ( ) => {
312310 const berries = getItem ( 'Berries' ) ;
313311 mouseover ( berries ! ) ;
314- tick ( ) ;
315312 expect ( isSubmenuExpanded ( ) ) . toBe ( true ) ;
316- } ) ) ;
313+ } ) ;
317314
318315 it ( 'should close on selecting an item on click' , ( ) => {
319316 spyOn ( fixture . componentInstance , 'onSelect' ) ;
@@ -385,34 +382,30 @@ describe('Standalone Menu Pattern', () => {
385382 externalElement . remove ( ) ;
386383 } ) ;
387384
388- it ( 'should close an unfocused submenu on mouse out' , fakeAsync ( ( ) => {
385+ it ( 'should close an unfocused submenu on mouse out' , ( ) => {
389386 const berries = getItem ( 'Berries' ) ;
390387 const submenu = getSubmenu ( ) ;
391388
392389 mouseover ( berries ! ) ;
393- tick ( ) ;
394390 expect ( isSubmenuExpanded ( ) ) . toBe ( true ) ;
395391
396392 mouseout ( berries ! ) ;
397393 mouseout ( submenu ! ) ;
398- tick ( 500 ) ;
399394
400395 expect ( isSubmenuExpanded ( ) ) . toBe ( false ) ;
401- } ) ) ;
396+ } ) ;
402397
403- it ( 'should not close an unfocused submenu on mouse out if the parent menu is hovered' , fakeAsync ( ( ) => {
398+ it ( 'should not close an unfocused submenu on mouse out if the parent menu is hovered' , ( ) => {
404399 const berries = getItem ( 'Berries' ) ;
405400 const submenu = getSubmenu ( ) ;
406401
407402 mouseover ( berries ! ) ;
408- tick ( ) ;
409403 expect ( isSubmenuExpanded ( ) ) . toBe ( true ) ;
410404
411405 mouseout ( berries ! ) ;
412406 mouseover ( submenu ! ) ;
413- tick ( 500 ) ;
414407 expect ( isSubmenuExpanded ( ) ) . toBe ( true ) ;
415- } ) ) ;
408+ } ) ;
416409 } ) ;
417410} ) ;
418411
0 commit comments