@@ -168,13 +168,13 @@ describe('mdSidenav', function() {
168
168
169
169
describe ( 'controller' , function ( ) {
170
170
it ( 'should create controller' , function ( ) {
171
- var el = setup ( '' ) ;
171
+ var el = setup ( ) ;
172
172
var controller = el . controller ( 'mdSidenav' ) ;
173
173
expect ( controller ) . not . toBe ( undefined ) ;
174
174
} ) ;
175
175
176
176
it ( 'should open and close and toggle' , inject ( function ( $timeout ) {
177
- var el = setup ( '' ) ;
177
+ var el = setup ( ) ;
178
178
var scope = el . isolateScope ( ) ;
179
179
var controller = el . controller ( 'mdSidenav' ) ;
180
180
@@ -213,7 +213,7 @@ describe('mdSidenav', function() {
213
213
} ) ) ;
214
214
215
215
it ( 'should open(), close(), and toggle() with promises' , function ( ) {
216
- var el = setup ( '' ) ;
216
+ var el = setup ( ) ;
217
217
var scope = el . isolateScope ( ) ;
218
218
var controller = el . controller ( 'mdSidenav' ) ;
219
219
@@ -257,7 +257,7 @@ describe('mdSidenav', function() {
257
257
} ) ;
258
258
259
259
it ( 'should open() to work multiple times before close()' , function ( ) {
260
- var el = setup ( '' ) ;
260
+ var el = setup ( ) ;
261
261
var controller = el . controller ( 'mdSidenav' ) ;
262
262
263
263
var openDone = 0 , closeDone = 0 ;
@@ -351,23 +351,32 @@ describe('mdSidenav', function() {
351
351
} ) ;
352
352
353
353
describe ( '$mdSidenav lookups' , function ( ) {
354
- var $rootScope , $timeout ;
354
+ var $rootScope , $timeout , $mdSidenav ;
355
355
356
- beforeEach ( inject ( function ( _$rootScope_ , _$timeout_ ) {
356
+ beforeEach ( inject ( function ( _$rootScope_ , _$timeout_ , _$mdSidenav_ ) {
357
357
$rootScope = _$rootScope_ ;
358
358
$timeout = _$timeout_ ;
359
+ $mdSidenav = _$mdSidenav_ ;
359
360
} ) ) ;
360
361
361
- it ( 'should find an instantiation using `$mdSidenav(id)`' , inject ( function ( $mdSidenav ) {
362
+ it ( 'should find an instantiation using `$mdSidenav(id)`' , function ( ) {
362
363
var el = setup ( 'md-component-id="left"' ) ;
363
364
$timeout . flush ( ) ;
364
365
365
366
// Lookup instance still available in the component registry
366
367
var instance = $mdSidenav ( 'left' ) ;
367
368
expect ( instance ) . toBeTruthy ( ) ;
368
- } ) ) ;
369
+ } ) ;
370
+
371
+ it ( 'should find an instance that contains a data binding' , function ( ) {
372
+ var leftComponentId = $rootScope . leftComponentId = 'left' ;
373
+ var el = setup ( 'md-component-id="{{ leftComponentId }}"' ) ;
374
+ var instance = $mdSidenav ( leftComponentId , false ) ;
375
+
376
+ expect ( instance ) . toBeTruthy ( ) ;
377
+ } ) ;
369
378
370
- it ( 'should find a deferred instantiation using `$mdSidenav(id, true)`' , inject ( function ( $mdSidenav ) {
379
+ it ( 'should find a deferred instantiation using `$mdSidenav(id, true)`' , function ( ) {
371
380
var instance ;
372
381
373
382
// Lookup deferred (not existing) instance
@@ -386,9 +395,9 @@ describe('mdSidenav', function() {
386
395
// Lookup instance still available in the component registry
387
396
instance = $mdSidenav ( 'left' , true ) ;
388
397
expect ( instance ) . toBeTruthy ( ) ;
389
- } ) ) ;
398
+ } ) ;
390
399
391
- it ( 'should find a deferred instantiation using `$mdSidenav().waitFor(id)` ' , inject ( function ( $mdSidenav ) {
400
+ it ( 'should find a deferred instantiation using `$mdSidenav().waitFor(id)` ' , function ( ) {
392
401
var instance ;
393
402
394
403
// Lookup deferred (not existing) instance
@@ -409,9 +418,9 @@ describe('mdSidenav', function() {
409
418
instance = $mdSidenav ( 'left' ) ;
410
419
411
420
expect ( instance ) . toBeTruthy ( ) ;
412
- } ) ) ;
421
+ } ) ;
413
422
414
- it ( 'should not find a lazy instantiation without waiting `$mdSidenav(id)`' , inject ( function ( $mdSidenav ) {
423
+ it ( 'should not find a lazy instantiation without waiting `$mdSidenav(id)`' , function ( ) {
415
424
var instance = $mdSidenav ( 'left' ) ;
416
425
expect ( instance . isOpen ) . toBeDefined ( ) ; // returns legacy API with noops
417
426
@@ -425,9 +434,9 @@ describe('mdSidenav', function() {
425
434
instance = $mdSidenav ( 'left' ) ; // returns instance
426
435
expect ( instance ) . toBeDefined ( ) ;
427
436
expect ( instance . isOpen ( ) ) . toBeFalsy ( ) ;
428
- } ) ) ;
437
+ } ) ;
429
438
430
- it ( 'should not find a lazy instantiation without waiting `$mdSidenav().find(id)`' , inject ( function ( $mdSidenav ) {
439
+ it ( 'should not find a lazy instantiation without waiting `$mdSidenav().find(id)`' , function ( ) {
431
440
var instance = $mdSidenav ( ) . find ( 'left' ) ;
432
441
expect ( instance ) . toBeUndefined ( ) ;
433
442
@@ -438,7 +447,7 @@ describe('mdSidenav', function() {
438
447
instance = $mdSidenav ( ) . find ( 'left' ) ;
439
448
expect ( instance ) . toBeDefined ( ) ;
440
449
expect ( instance . isOpen ( ) ) . toBeFalsy ( ) ;
441
- } ) ) ;
450
+ } ) ;
442
451
443
452
describe ( 'onClose' , function ( ) {
444
453
it ( 'should call callback on escape' , inject ( function ( $mdSidenav , $rootScope , $material , $mdConstant , $timeout ) {
0 commit comments