diff options
author | Luke "Jared" Bennett <lbennett@gitlab.com> | 2017-04-07 04:50:10 +0300 |
---|---|---|
committer | Luke "Jared" Bennett <lbennett@gitlab.com> | 2017-04-07 04:50:10 +0300 |
commit | 907b754173ed4185574c38ded0a173360d073085 (patch) | |
tree | df3fc2ffb07a48cad1d812e34cdf2bb796dbbdfd /spec/javascripts | |
parent | bb4bc215f853da509592d1698cfe9cc860bc67bd (diff) |
Fixed bugs and added tests
Diffstat (limited to 'spec/javascripts')
-rw-r--r-- | spec/javascripts/droplab/drop_down_spec.js | 17 | ||||
-rw-r--r-- | spec/javascripts/droplab/plugins/input_setter_spec.js | 2 |
2 files changed, 17 insertions, 2 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(); diff --git a/spec/javascripts/droplab/plugins/input_setter_spec.js b/spec/javascripts/droplab/plugins/input_setter_spec.js index 412d1054385..bd625f4ae80 100644 --- a/spec/javascripts/droplab/plugins/input_setter_spec.js +++ b/spec/javascripts/droplab/plugins/input_setter_spec.js @@ -2,7 +2,7 @@ import InputSetter from '~/droplab/plugins/input_setter'; -fdescribe('InputSetter', function () { +describe('InputSetter', function () { describe('init', function () { beforeEach(function () { this.config = { InputSetter: {} }; |