@@ -44,7 +44,7 @@ describe('MdChipList', () => {
4444 setupStandardList ( ) ;
4545 } ) ) ;
4646
47- it ( 'adds the `mat-chip-list` class' , ( ) => {
47+ it ( 'should add the `mat-chip-list` class' , ( ) => {
4848 expect ( chipListNativeElement . classList ) . toContain ( 'mat-chip-list' ) ;
4949 } ) ;
5050 } ) ;
@@ -58,7 +58,7 @@ describe('MdChipList', () => {
5858 manager = chipListInstance . _keyManager ;
5959 } ) ;
6060
61- it ( 'focuses the first chip on focus' , ( ) => {
61+ it ( 'should focus the first chip on focus' , ( ) => {
6262 let FOCUS_EVENT = { } as Event ;
6363
6464 chipListInstance . focus ( FOCUS_EVENT ) ;
@@ -67,7 +67,7 @@ describe('MdChipList', () => {
6767 expect ( manager . activeItemIndex ) . toBe ( 0 ) ;
6868 } ) ;
6969
70- it ( 'watches for chip focus' , ( ) => {
70+ it ( 'should watch for chip focus' , ( ) => {
7171 let array = chips . toArray ( ) ;
7272 let lastIndex = array . length - 1 ;
7373 let lastItem = array [ lastIndex ] ;
@@ -79,7 +79,7 @@ describe('MdChipList', () => {
7979 } ) ;
8080
8181 describe ( 'on chip destroy' , ( ) => {
82- it ( 'focuses the next item' , ( ) => {
82+ it ( 'should focus the next item' , ( ) => {
8383 let array = chips . toArray ( ) ;
8484 let midItem = array [ 2 ] ;
8585
@@ -95,7 +95,7 @@ describe('MdChipList', () => {
9595 } ) ;
9696
9797
98- it ( 'focuses the previous item' , ( ) => {
98+ it ( 'should focus the previous item' , ( ) => {
9999 let array = chips . toArray ( ) ;
100100 let lastIndex = array . length - 1 ;
101101 let lastItem = array [ lastIndex ] ;
@@ -121,7 +121,7 @@ describe('MdChipList', () => {
121121 manager = chipListInstance . _keyManager ;
122122 } ) ) ;
123123
124- it ( 'LEFT ARROW focuses previous item' , ( ) => {
124+ it ( 'should focus previous item when press LEFT ARROW ' , ( ) => {
125125 let nativeChips = chipListNativeElement . querySelectorAll ( 'md-chip' ) ;
126126 let lastNativeChip = nativeChips [ nativeChips . length - 1 ] as HTMLElement ;
127127
@@ -142,7 +142,7 @@ describe('MdChipList', () => {
142142 expect ( manager . activeItemIndex ) . toEqual ( lastIndex - 1 ) ;
143143 } ) ;
144144
145- it ( 'RIGHT ARROW focuses next item' , ( ) => {
145+ it ( 'should focus next item when press RIGHT ARROW ' , ( ) => {
146146 let nativeChips = chipListNativeElement . querySelectorAll ( 'md-chip' ) ;
147147 let firstNativeChip = nativeChips [ 0 ] as HTMLElement ;
148148
@@ -172,7 +172,7 @@ describe('MdChipList', () => {
172172 manager = chipListInstance . _keyManager ;
173173 } ) ) ;
174174
175- it ( 'RIGHT ARROW focuses previous item' , ( ) => {
175+ it ( 'should focus previous item when press RIGHT ARROW ' , ( ) => {
176176 let nativeChips = chipListNativeElement . querySelectorAll ( 'md-chip' ) ;
177177 let lastNativeChip = nativeChips [ nativeChips . length - 1 ] as HTMLElement ;
178178
@@ -194,7 +194,7 @@ describe('MdChipList', () => {
194194 expect ( manager . activeItemIndex ) . toEqual ( lastIndex - 1 ) ;
195195 } ) ;
196196
197- it ( 'LEFT ARROW focuses next item' , ( ) => {
197+ it ( 'should focus next item when press LEFT ARROW ' , ( ) => {
198198 let nativeChips = chipListNativeElement . querySelectorAll ( 'md-chip' ) ;
199199 let firstNativeChip = nativeChips [ 0 ] as HTMLElement ;
200200
@@ -215,7 +215,7 @@ describe('MdChipList', () => {
215215 expect ( manager . activeItemIndex ) . toEqual ( 1 ) ;
216216 } ) ;
217217
218- it ( 'allow focus to escape when tabbing away' , fakeAsync ( ( ) => {
218+ it ( 'should allow focus to escape when tabbing away' , fakeAsync ( ( ) => {
219219 chipListInstance . _keyManager . onKeydown ( createKeyboardEvent ( 'keydown' , TAB ) ) ;
220220
221221 expect ( chipListInstance . _tabIndex )
@@ -240,15 +240,10 @@ describe('MdChipList', () => {
240240 manager = chipListInstance . _keyManager ;
241241 } ) ;
242242
243- it ( 'SPACE ignores selection' , ( ) => {
244- let SPACE_EVENT = createKeyboardEvent ( 'keydown' , SPACE ) ;
245- let firstChip : MdChip = chips . toArray ( ) [ 0 ] ;
246- } ) ;
247-
248243 describe ( 'when the input has focus' , ( ) => {
249244
250- it ( 'DELETE focuses the last chip' , ( ) => {
251- let nativeInput = chipListNativeElement . querySelector ( 'input' ) ;
245+ it ( 'should focus the last chip when press DELETE ' , ( ) => {
246+ let nativeInput = fixture . nativeElement . querySelector ( 'input' ) ;
252247 let DELETE_EVENT : KeyboardEvent =
253248 createKeyboardEvent ( 'keydown' , DELETE , nativeInput ) ;
254249
@@ -264,8 +259,8 @@ describe('MdChipList', () => {
264259 expect ( manager . activeItemIndex ) . toEqual ( chips . length - 1 ) ;
265260 } ) ;
266261
267- it ( 'BACKSPACE focuses the last chip' , ( ) => {
268- let nativeInput = chipListNativeElement . querySelector ( 'input' ) ;
262+ it ( 'should focus the last chip when press BACKSPACE ' , ( ) => {
263+ let nativeInput = fixture . nativeElement . querySelector ( 'input' ) ;
269264 let BACKSPACE_EVENT : KeyboardEvent =
270265 createKeyboardEvent ( 'keydown' , BACKSPACE , nativeInput ) ;
271266
@@ -336,12 +331,12 @@ class StandardChipList {
336331@Component ( {
337332 template : `
338333 <md-input-container>
339- <md-chip-list>
334+ <md-chip-list mdPrefix #chipList >
340335 <md-chip>Chip 1</md-chip>
341336 <md-chip>Chip 1</md-chip>
342337 <md-chip>Chip 1</md-chip>
343- <input mdInput name="test" />
344338 </md-chip-list>
339+ <input mdInput name="test" [mdChipList]="chipList"/>
345340 </md-input-container>
346341 `
347342} )
0 commit comments