1- import { MenuPage } from './menu-page' ;
1+ import { browser , Key , protractor } from 'protractor' ;
2+ import { MenuPage } from './menu-page' ;
23
34describe ( 'menu' , ( ) => {
45 let page : MenuPage ;
@@ -57,7 +58,7 @@ describe('menu', () => {
5758
5859 it ( 'should mirror classes on host to menu template in overlay' , ( ) => {
5960 page . trigger ( ) . click ( ) ;
60- page . menu ( ) . getAttribute ( 'class' ) . then ( classes => {
61+ page . menu ( ) . getAttribute ( 'class' ) . then ( ( classes : string ) => {
6162 expect ( classes ) . toContain ( 'md-menu-panel custom' ) ;
6263 } ) ;
6364 } ) ;
@@ -66,16 +67,16 @@ describe('menu', () => {
6667 beforeEach ( ( ) => {
6768 // click start button to avoid tabbing past navigation
6869 page . start ( ) . click ( ) ;
69- page . pressKey ( protractor . Key . TAB ) ;
70+ page . pressKey ( Key . TAB ) ;
7071 } ) ;
7172
7273 it ( 'should auto-focus the first item when opened with ENTER' , ( ) => {
73- page . pressKey ( protractor . Key . ENTER ) ;
74+ page . pressKey ( Key . ENTER ) ;
7475 page . expectFocusOn ( page . items ( 0 ) ) ;
7576 } ) ;
7677
7778 it ( 'should auto-focus the first item when opened with SPACE' , ( ) => {
78- page . pressKey ( protractor . Key . SPACE ) ;
79+ page . pressKey ( Key . SPACE ) ;
7980 page . expectFocusOn ( page . items ( 0 ) ) ;
8081 } ) ;
8182
@@ -85,60 +86,60 @@ describe('menu', () => {
8586 } ) ;
8687
8788 it ( 'should focus subsequent items when down arrow is pressed' , ( ) => {
88- page . pressKey ( protractor . Key . ENTER ) ;
89- page . pressKey ( protractor . Key . DOWN ) ;
89+ page . pressKey ( Key . ENTER ) ;
90+ page . pressKey ( Key . DOWN ) ;
9091 page . expectFocusOn ( page . items ( 1 ) ) ;
9192 } ) ;
9293
9394 it ( 'should focus previous items when up arrow is pressed' , ( ) => {
94- page . pressKey ( protractor . Key . ENTER ) ;
95- page . pressKey ( protractor . Key . DOWN ) ;
96- page . pressKey ( protractor . Key . UP ) ;
95+ page . pressKey ( Key . ENTER ) ;
96+ page . pressKey ( Key . DOWN ) ;
97+ page . pressKey ( Key . UP ) ;
9798 page . expectFocusOn ( page . items ( 0 ) ) ;
9899 } ) ;
99100
100101 it ( 'should skip disabled items using arrow keys' , ( ) => {
101- page . pressKey ( protractor . Key . ENTER ) ;
102- page . pressKey ( protractor . Key . DOWN ) ;
103- page . pressKey ( protractor . Key . DOWN ) ;
102+ page . pressKey ( Key . ENTER ) ;
103+ page . pressKey ( Key . DOWN ) ;
104+ page . pressKey ( Key . DOWN ) ;
104105 page . expectFocusOn ( page . items ( 3 ) ) ;
105106
106- page . pressKey ( protractor . Key . UP ) ;
107+ page . pressKey ( Key . UP ) ;
107108 page . expectFocusOn ( page . items ( 1 ) ) ;
108109 } ) ;
109110
110111 it ( 'should close the menu when tabbing past items' , ( ) => {
111- page . pressKey ( protractor . Key . ENTER ) ;
112- page . pressKey ( protractor . Key . TAB ) ;
112+ page . pressKey ( Key . ENTER ) ;
113+ page . pressKey ( Key . TAB ) ;
113114 page . expectMenuPresent ( false ) ;
114115
115- page . pressKey ( protractor . Key . TAB ) ;
116- page . pressKey ( protractor . Key . ENTER ) ;
116+ page . pressKey ( Key . TAB ) ;
117+ page . pressKey ( Key . ENTER ) ;
117118 page . expectMenuPresent ( true ) ;
118119
119- page . pressKey ( protractor . Key . chord ( protractor . Key . SHIFT , protractor . Key . TAB ) ) ;
120+ page . pressKey ( protractor . Key . chord ( Key . SHIFT , Key . TAB ) ) ;
120121 page . expectMenuPresent ( false ) ;
121122 } ) ;
122123
123124 it ( 'should wrap back to menu when arrow keying past items' , ( ) => {
124- page . pressKey ( protractor . Key . ENTER ) ;
125- page . pressKey ( protractor . Key . DOWN ) ;
126- page . pressKey ( protractor . Key . DOWN ) ;
127- page . pressKey ( protractor . Key . DOWN ) ;
125+ page . pressKey ( Key . ENTER ) ;
126+ page . pressKey ( Key . DOWN ) ;
127+ page . pressKey ( Key . DOWN ) ;
128+ page . pressKey ( Key . DOWN ) ;
128129 page . expectFocusOn ( page . items ( 0 ) ) ;
129130
130- page . pressKey ( protractor . Key . UP ) ;
131+ page . pressKey ( Key . UP ) ;
131132 page . expectFocusOn ( page . items ( 3 ) ) ;
132133 } ) ;
133134
134135 it ( 'should focus before and after trigger when tabbing past items' , ( ) => {
135- page . pressKey ( protractor . Key . ENTER ) ;
136- page . pressKey ( protractor . Key . TAB ) ;
136+ page . pressKey ( Key . ENTER ) ;
137+ page . pressKey ( Key . TAB ) ;
137138 page . expectFocusOn ( page . triggerTwo ( ) ) ;
138139
139140 // navigate back to trigger
140141 page . pressKey ( protractor . Key . chord ( protractor . Key . SHIFT , protractor . Key . TAB ) ) ;
141- page . pressKey ( protractor . Key . ENTER ) ;
142+ page . pressKey ( Key . ENTER ) ;
142143
143144 page . pressKey ( protractor . Key . chord ( protractor . Key . SHIFT , protractor . Key . TAB ) ) ;
144145 page . expectFocusOn ( page . start ( ) ) ;
0 commit comments