This repository was archived by the owner on May 29, 2019. It is now read-only.
File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -601,6 +601,20 @@ describe('timepicker directive', function () {
601601 } ) ;
602602 } ) ;
603603
604+ describe ( '`readonly-input` attribute' , function ( ) {
605+ beforeEach ( inject ( function ( ) {
606+ $rootScope . meridiansArray = [ 'am' , 'pm' ] ;
607+ element = $compile ( '<timepicker ng-model="time" readonly-input="true"></timepicker>' ) ( $rootScope ) ;
608+ $rootScope . $digest ( ) ;
609+ } ) ) ;
610+
611+ it ( 'should make inputs readonly' , function ( ) {
612+ var inputs = element . find ( 'input' ) ;
613+ expect ( inputs . eq ( 0 ) . attr ( 'readonly' ) ) . toBe ( 'readonly' ) ;
614+ expect ( inputs . eq ( 1 ) . attr ( 'readonly' ) ) . toBe ( 'readonly' ) ;
615+ } ) ;
616+ } ) ;
617+
604618 describe ( 'setting timepickerConfig steps' , function ( ) {
605619 var originalConfig = { } ;
606620 beforeEach ( inject ( function ( _$compile_ , _$rootScope_ , timepickerConfig ) {
Original file line number Diff line number Diff line change @@ -26,7 +26,7 @@ angular.module('ui.bootstrap.timepicker', [])
2626 this . setupMousewheelEvents ( hoursInputEl , minutesInputEl ) ;
2727 }
2828
29- $scope . readonlyInput = angular . isDefined ( $attrs . readonlyInput ) ? scope . $parent . $eval ( $attrs . readonlyInput ) : timepickerConfig . readonlyInput ;
29+ $scope . readonlyInput = angular . isDefined ( $attrs . readonlyInput ) ? $ scope. $parent . $eval ( $attrs . readonlyInput ) : timepickerConfig . readonlyInput ;
3030 this . setupInputEvents ( hoursInputEl , minutesInputEl ) ;
3131 } ;
3232
@@ -243,7 +243,7 @@ angular.module('ui.bootstrap.timepicker', [])
243243 replace : true ,
244244 scope : { } ,
245245 templateUrl : 'template/timepicker/timepicker.html' ,
246- link : function ( sscope , element , attrs , ctrls ) {
246+ link : function ( scope , element , attrs , ctrls ) {
247247 var timepickerCtrl = ctrls [ 0 ] , ngModelCtrl = ctrls [ 1 ] ;
248248
249249 if ( ngModelCtrl ) {
You can’t perform that action at this time.
0 commit comments