Skip to content

Commit 0a15f47

Browse files
authored
Merge pull request #129 from gearsdigital/add-additional-tests
add some more test cases
2 parents 07bb40e + e70f8be commit 0a15f47

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

test/visibility.spec.js

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,22 @@ describe('visibility', function() {
2626
expect($('.selectric-items').is(':visible')).toBe(true);
2727
});
2828

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+
2945
it('should open/close on click', function() {
3046
$('.selectric').click();
3147
expect($('.selectric-items').is(':visible')).toBe(true);
@@ -58,4 +74,4 @@ describe('visibility', function() {
5874
done();
5975
}, 40);
6076
});
61-
});
77+
});

0 commit comments

Comments
 (0)