@@ -376,6 +376,11 @@ describe('timepicker directive', function () {
376
376
expect ( getModelState ( ) ) . toEqual ( [ 14 , 40 ] ) ;
377
377
} ) ;
378
378
379
+ it ( 'displays arrows controls by default correctly' , function ( ) {
380
+ $rootScope . $digest ( ) ;
381
+ expect ( element . find ( 'tr' ) . length ) . toBe ( 3 ) ;
382
+ } ) ;
383
+
379
384
describe ( 'attributes' , function ( ) {
380
385
beforeEach ( function ( ) {
381
386
$rootScope . hstep = 2 ;
@@ -874,73 +879,32 @@ describe('timepicker directive', function () {
874
879
} ) ;
875
880
} ) ;
876
881
877
- describe ( 'setting timepickerConfig arrow controls default visibility' , function ( ) {
878
-
879
- beforeEach ( inject ( function ( _$compile_ , _$rootScope_ , timepickerConfig ) {
880
- element = $compile ( '<timepicker ng-model="time" ng-required="true"></timepicker>' ) ( $rootScope ) ;
881
- $rootScope . $digest ( ) ;
882
- } ) ) ;
883
-
884
- function countElementsTr ( isUp ) {
885
- return element . find ( 'tr' ) . length ;
886
- }
887
-
888
- it ( 'displays arrows controls by default correctly' , function ( ) {
889
- $rootScope . $digest ( ) ;
890
-
891
- var upElementsCount = countElementsTr ( true ) ;
892
- var downElementsCount = countElementsTr ( false ) ;
893
-
894
- expect ( upElementsCount ) . toBe ( 3 ) ;
895
- expect ( downElementsCount ) . toBe ( 3 ) ;
896
- } ) ;
897
-
898
- } ) ;
899
-
900
882
describe ( 'setting timepickerConfig arrow controls check initial show' , function ( ) {
901
883
902
- beforeEach ( inject ( function ( _$compile_ , _$rootScope_ , timepickerConfig ) {
884
+ beforeEach ( inject ( function ( _$compile_ , _$rootScope_ ) {
903
885
$rootScope . showArrowsControls = true ;
904
886
element = $compile ( '<timepicker ng-model="time" ng-required="true" show-arrows-controls="showArrowsControls"></timepicker>' ) ( $rootScope ) ;
905
887
$rootScope . $digest ( ) ;
906
888
} ) ) ;
907
889
908
- function countElementsTr ( isUp ) {
909
- return element . find ( 'tr' ) . length ;
910
- }
911
-
912
890
it ( 'displays arrows controls correctly' , function ( ) {
913
891
$rootScope . $digest ( ) ;
914
-
915
- var upElementsCount = countElementsTr ( true ) ;
916
- var downElementsCount = countElementsTr ( false ) ;
917
-
918
- expect ( upElementsCount ) . toBe ( 3 ) ;
919
- expect ( downElementsCount ) . toBe ( 3 ) ;
892
+ expect ( element . find ( 'tr' ) . length ) . toBe ( 3 ) ;
920
893
} ) ;
921
894
922
895
} ) ;
923
896
924
897
describe ( 'setting timepickerConfig arrow controls check initial hide' , function ( ) {
925
898
926
- beforeEach ( inject ( function ( _$compile_ , _$rootScope_ , timepickerConfig ) {
899
+ beforeEach ( inject ( function ( _$compile_ , _$rootScope_ ) {
927
900
$rootScope . showArrowsControls = false ;
928
901
element = $compile ( '<timepicker ng-model="time" ng-required="true" show-arrows-controls="showArrowsControls"></timepicker>' ) ( $rootScope ) ;
929
902
$rootScope . $digest ( ) ;
930
903
} ) ) ;
931
904
932
- function countElementsTr ( isUp ) {
933
- return element . find ( 'tr' ) . length ;
934
- }
935
-
936
905
it ( 'hides arrows controls correctly' , function ( ) {
937
906
$rootScope . $digest ( ) ;
938
-
939
- var upElementsCount = countElementsTr ( true ) ;
940
- var downElementsCount = countElementsTr ( false ) ;
941
-
942
- expect ( upElementsCount ) . toBe ( 1 ) ;
943
- expect ( downElementsCount ) . toBe ( 1 ) ;
907
+ expect ( element . find ( 'tr' ) . length ) . toBe ( 1 ) ;
944
908
} ) ;
945
909
946
910
} ) ;
0 commit comments