summaryrefslogtreecommitdiff
path: root/spec/javascripts/droplab/drop_down_spec.js
diff options
context:
space:
mode:
Diffstat (limited to 'spec/javascripts/droplab/drop_down_spec.js')
-rw-r--r--spec/javascripts/droplab/drop_down_spec.js17
1 files changed, 16 insertions, 1 deletions
diff --git a/spec/javascripts/droplab/drop_down_spec.js b/spec/javascripts/droplab/drop_down_spec.js
index bbf953658c8..802e2435672 100644
--- a/spec/javascripts/droplab/drop_down_spec.js
+++ b/spec/javascripts/droplab/drop_down_spec.js
@@ -130,7 +130,7 @@ describe('DropDown', function () {
beforeEach(function () {
this.list = { dispatchEvent: () => {} };
this.dropdown = { hide: () => {}, list: this.list, addSelectedClass: () => {} };
- this.event = { preventDefault: () => {}, target: 'target' };
+ this.event = { preventDefault: () => {}, target: {} };
this.customEvent = {};
this.closestElement = {};
@@ -168,6 +168,21 @@ describe('DropDown', function () {
expect(this.list.dispatchEvent).toHaveBeenCalledWith(this.customEvent);
});
+ describe('if the target is a UL element', function () {
+ beforeEach(function () {
+ this.event = { preventDefault: () => {}, target: { tagName: 'UL' } };
+
+ spyOn(this.event, 'preventDefault');
+ utils.closest.calls.reset();
+
+ DropDown.prototype.clickEvent.call(this.dropdown, this.event);
+ });
+
+ it('should return immediately', function () {
+ expect(utils.closest).not.toHaveBeenCalled();
+ });
+ });
+
describe('if no selected element exists', function () {
beforeEach(function () {
this.event.preventDefault.calls.reset();