Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbitsapien <bitsapien@gmail.com>2018-03-27 21:51:11 +0300
committerClement Ho <clemmakesapps@gmail.com>2018-03-27 21:51:11 +0300
commita30358881c420da686301c51c4e6c5135969d8b9 (patch)
tree25c12e0a18ab3817ce36c2f7c310e8161294d55e /spec/javascripts/gl_dropdown_spec.js
parentc02089af6d19a4df1280ffa01a806cf2c699ab1b (diff)
[FIX] Fixed bug in dropdown selector when selecting the same selection again
Diffstat (limited to 'spec/javascripts/gl_dropdown_spec.js')
-rw-r--r--spec/javascripts/gl_dropdown_spec.js25
1 files changed, 25 insertions, 0 deletions
diff --git a/spec/javascripts/gl_dropdown_spec.js b/spec/javascripts/gl_dropdown_spec.js
index 0e4a7017406..5393502196e 100644
--- a/spec/javascripts/gl_dropdown_spec.js
+++ b/spec/javascripts/gl_dropdown_spec.js
@@ -256,4 +256,29 @@ describe('glDropdown', function describeDropdown() {
});
});
});
+
+ it('should keep selected item after selecting a second time', () => {
+ const options = {
+ isSelectable(item, $el) {
+ return !$el.hasClass('is-active');
+ },
+ toggleLabel(item) {
+ return item && item.id;
+ },
+ };
+ initDropDown.call(this, false, false, options);
+ const $item = $(`${ITEM_SELECTOR}:first() a`, this.$dropdownMenuElement);
+
+ // select item the first time
+ this.dropdownButtonElement.click();
+ $item.click();
+ expect($item).toHaveClass('is-active');
+ // select item the second time
+ this.dropdownButtonElement.click();
+ $item.click();
+ expect($item).toHaveClass('is-active');
+
+ expect($('.dropdown-toggle-text')).toHaveText(this.projectsData[0].id.toString());
+ });
});
+