File tree Expand file tree Collapse file tree 1 file changed +17
-1
lines changed Expand file tree Collapse file tree 1 file changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -26,6 +26,22 @@ describe('visibility', function() {
26
26
expect ( $ ( '.selectric-items' ) . is ( ':visible' ) ) . toBe ( true ) ;
27
27
} ) ;
28
28
29
+ it ( 'should add .selectric-focus on focusin' , function ( ) {
30
+ $ ( '.selectric-input' ) . focusin ( ) ;
31
+ expect ( $ ( '.selectric-wrapper' ) . hasClass ( 'selectric-focus' ) ) . toBe ( true ) ;
32
+ } ) ;
33
+
34
+ it ( 'should remove .selectric-focus on focusout' , function ( ) {
35
+ $ ( '.selectric-input' ) . focusin ( ) . focusout ( ) ;
36
+ expect ( $ ( '.selectric-wrapper' ) . hasClass ( 'selectric-focus' ) ) . toBe ( false ) ;
37
+ } ) ;
38
+
39
+ it ( 'should prevent the flicker when focusing out and back again' , function ( ) {
40
+ var spy = spyOn ( $ . fn , 'blur' ) ;
41
+ $ ( '.selectric-input' ) . focusin ( ) . trigger ( 'blur' ) . trigger ( 'blur' ) . trigger ( 'blur' ) ;
42
+ expect ( spy ) . toHaveBeenCalledTimes ( 1 ) ;
43
+ } ) ;
44
+
29
45
it ( 'should open/close on click' , function ( ) {
30
46
$ ( '.selectric' ) . click ( ) ;
31
47
expect ( $ ( '.selectric-items' ) . is ( ':visible' ) ) . toBe ( true ) ;
@@ -58,4 +74,4 @@ describe('visibility', function() {
58
74
done ( ) ;
59
75
} , 40 ) ;
60
76
} ) ;
61
- } ) ;
77
+ } ) ;
You can’t perform that action at this time.
0 commit comments