Skip to content
This repository was archived by the owner on Oct 2, 2019. It is now read-only.

Commit 2f10304

Browse files
committed
test: testing if dropdown closes even when propagation of event stops
1 parent 32829a3 commit 2f10304

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

test/select.spec.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -740,6 +740,28 @@ describe('ui-select tests', function () {
740740
el2.remove();
741741
});
742742

743+
it('should close an opened select clicking outside with stopPropagation()', function () {
744+
var el1 = createUiSelect();
745+
var el2 = $('<div></div>');
746+
el1.appendTo(document.body);
747+
el2.appendTo(document.body);
748+
749+
el2.on('click', function (e) {
750+
e.stopPropagation()
751+
});
752+
753+
expect(isDropdownOpened(el1)).toEqual(false);
754+
clickMatch(el1);
755+
expect(isDropdownOpened(el1)).toEqual(true);
756+
757+
// Using a native dom click() to make sure the test fails when it should.
758+
el2[0].click();
759+
760+
expect(isDropdownOpened(el1)).toEqual(false);
761+
el1.remove();
762+
el2.remove();
763+
});
764+
743765
it('should bind model correctly (with object as source)', function () {
744766
var el = compileTemplate(
745767
'<ui-select ng-model="selection.selected"> \

0 commit comments

Comments
 (0)