@@ -2304,6 +2304,69 @@ describe('datepicker directive', function() {
2304
2304
expect ( focused ) . toBe ( true ) ;
2305
2305
} ) ;
2306
2306
} ) ;
2307
+
2308
+ describe ( 'pass through attributes' , function ( ) {
2309
+ var wrapElement ;
2310
+ describe ( 'formatting' , function ( ) {
2311
+ beforeEach ( function ( ) {
2312
+ $rootScope . dayTitle = 'MMMM, yy' ;
2313
+ wrapElement = $compile ( '<div><input uib-datepicker-popup ng-model="date"' +
2314
+ 'is-open="true"' +
2315
+ 'format-day="d"' +
2316
+ 'format-day-header="EEEE"' +
2317
+ 'format-day-title="{{dayTitle}}"' +
2318
+ 'format-month="MMM"' +
2319
+ 'format-month-title="yy"' +
2320
+ 'format-year="yy"' +
2321
+ 'year-range="10"></input></div>' ) ( $rootScope ) ;
2322
+ $rootScope . $digest ( ) ;
2323
+ assignElements ( wrapElement ) ;
2324
+ } ) ;
2325
+
2326
+ it ( 'changes the title format in `day` mode' , function ( ) {
2327
+ expect ( getTitle ( ) ) . toBe ( 'September, 10' ) ;
2328
+ } ) ;
2329
+
2330
+ it ( 'changes the title & months format in `month` mode' , function ( ) {
2331
+ clickTitleButton ( ) ;
2332
+ assignElements ( wrapElement ) ;
2333
+ expect ( getTitle ( ) ) . toBe ( '10' ) ;
2334
+ expect ( getOptions ( ) ) . toEqual ( [
2335
+ [ 'Jan' , 'Feb' , 'Mar' ] ,
2336
+ [ 'Apr' , 'May' , 'Jun' ] ,
2337
+ [ 'Jul' , 'Aug' , 'Sep' ] ,
2338
+ [ 'Oct' , 'Nov' , 'Dec' ]
2339
+ ] ) ;
2340
+ } ) ;
2341
+
2342
+ it ( 'changes the title, year format & range in `year` mode' , function ( ) {
2343
+ clickTitleButton ( ) ;
2344
+ assignElements ( wrapElement ) ;
2345
+ clickTitleButton ( ) ;
2346
+ assignElements ( wrapElement ) ;
2347
+ expect ( getTitle ( ) ) . toBe ( '01 - 10' ) ;
2348
+ expect ( getOptions ( ) ) . toEqual ( [
2349
+ [ '01' , '02' , '03' , '04' , '05' ] ,
2350
+ [ '06' , '07' , '08' , '09' , '10' ]
2351
+ ] ) ;
2352
+ } ) ;
2353
+
2354
+ it ( 'shows day labels' , function ( ) {
2355
+ expect ( getLabels ( true ) ) . toEqual ( [ 'Sunday' , 'Monday' , 'Tuesday' , 'Wednesday' , 'Thursday' , 'Friday' , 'Saturday' ] ) ;
2356
+ } ) ;
2357
+
2358
+ it ( 'changes the day format' , function ( ) {
2359
+ expect ( getOptions ( true ) ) . toEqual ( [
2360
+ [ '29' , '30' , '31' , '1' , '2' , '3' , '4' ] ,
2361
+ [ '5' , '6' , '7' , '8' , '9' , '10' , '11' ] ,
2362
+ [ '12' , '13' , '14' , '15' , '16' , '17' , '18' ] ,
2363
+ [ '19' , '20' , '21' , '22' , '23' , '24' , '25' ] ,
2364
+ [ '26' , '27' , '28' , '29' , '30' , '1' , '2' ] ,
2365
+ [ '3' , '4' , '5' , '6' , '7' , '8' , '9' ]
2366
+ ] ) ;
2367
+ } ) ;
2368
+ } ) ;
2369
+ } ) ;
2307
2370
} ) ;
2308
2371
2309
2372
describe ( 'with empty initial state' , function ( ) {
0 commit comments