@@ -29,7 +29,10 @@ define([
29
29
30
30
describe ( 'Colorpicker binding' , function ( ) {
31
31
it ( 'Should call spectrum on $input with disabled configuration if view model disabled' , function ( ) {
32
- var valueAccessor = jasmine . createSpy ( ) . and . returnValue ( { } ) ,
32
+ var value = {
33
+ configStuffInHere : true
34
+ } ,
35
+ valueAccessor = jasmine . createSpy ( ) . and . returnValue ( value ) ,
33
36
viewModel = {
34
37
disabled : jasmine . createSpy ( ) . and . returnValue ( true )
35
38
} ;
@@ -39,9 +42,13 @@ define([
39
42
40
43
ko . bindingHandlers . colorPicker . init ( $input , valueAccessor , null , viewModel ) ;
41
44
42
- expect ( $ . fn . spectrum ) . toHaveBeenCalledWith ( {
43
- disabled : true
44
- } ) ;
45
+ expect ( value . change ) . toEqual ( jasmine . any ( Function ) ) ;
46
+ expect ( value . hide ) . toEqual ( jasmine . any ( Function ) ) ;
47
+ expect ( value . show ) . toEqual ( jasmine . any ( Function ) ) ;
48
+ expect ( value . change ) . toBe ( value . hide ) ;
49
+
50
+ expect ( $ . fn . spectrum . calls . allArgs ( ) ) . toEqual ( [ [ value ] , [ 'disable' ] ] ) ;
51
+ expect ( viewModel . disabled ) . toHaveBeenCalled ( ) ;
45
52
46
53
$ . fn . init = jasmine . createSpy ( ) . and . returnValue ( $ . fn ) ;
47
54
@@ -69,7 +76,8 @@ define([
69
76
expect ( value . show ) . toEqual ( jasmine . any ( Function ) ) ;
70
77
expect ( value . change ) . toBe ( value . hide ) ;
71
78
72
- expect ( $ . fn . spectrum ) . toHaveBeenCalledWith ( value ) ;
79
+ expect ( $ . fn . spectrum . calls . allArgs ( ) ) . toEqual ( [ [ value ] , [ 'enable' ] ] ) ;
80
+ expect ( viewModel . disabled ) . toHaveBeenCalled ( ) ;
73
81
74
82
$ . fn . init = jasmine . createSpy ( ) . and . returnValue ( $ . fn ) ;
75
83
0 commit comments