diff options
author | Mike Greiling <mike@pixelcog.com> | 2018-10-17 10:16:21 +0300 |
---|---|---|
committer | Mike Greiling <mike@pixelcog.com> | 2018-10-17 19:18:17 +0300 |
commit | 024c31fe79b0e4026c9bff0802424efe6e127a4c (patch) | |
tree | 30c429f57324cecb928cdc775cb311f9996c740b /spec/javascripts/labels_issue_sidebar_spec.js | |
parent | f666026d71ebefd70219d5078b1f0c83fa01f84d (diff) |
Remove superfluous IIFEs
Diffstat (limited to 'spec/javascripts/labels_issue_sidebar_spec.js')
-rw-r--r-- | spec/javascripts/labels_issue_sidebar_spec.js | 158 |
1 files changed, 78 insertions, 80 deletions
diff --git a/spec/javascripts/labels_issue_sidebar_spec.js b/spec/javascripts/labels_issue_sidebar_spec.js index 519a55d8069..e5678ee5379 100644 --- a/spec/javascripts/labels_issue_sidebar_spec.js +++ b/spec/javascripts/labels_issue_sidebar_spec.js @@ -12,108 +12,106 @@ import '~/api'; import '~/create_label'; import '~/users_select'; -(() => { - let saveLabelCount = 0; - let mock; +let saveLabelCount = 0; +let mock; - describe('Issue dropdown sidebar', () => { - preloadFixtures('static/issue_sidebar_label.html.raw'); +describe('Issue dropdown sidebar', () => { + preloadFixtures('static/issue_sidebar_label.html.raw'); - beforeEach(() => { - loadFixtures('static/issue_sidebar_label.html.raw'); + beforeEach(() => { + loadFixtures('static/issue_sidebar_label.html.raw'); - mock = new MockAdapter(axios); + mock = new MockAdapter(axios); - new IssuableContext('{"id":1,"name":"Administrator","username":"root"}'); - new LabelsSelect(); + new IssuableContext('{"id":1,"name":"Administrator","username":"root"}'); + new LabelsSelect(); - mock.onGet('/root/test/labels.json').reply(() => { - const labels = Array(10) - .fill() - .map((_, i) => ({ - id: i, - title: `test ${i}`, - color: '#5CB85C', - })); + mock.onGet('/root/test/labels.json').reply(() => { + const labels = Array(10) + .fill() + .map((_, i) => ({ + id: i, + title: `test ${i}`, + color: '#5CB85C', + })); - return [200, labels]; - }); + return [200, labels]; + }); - mock.onPut('/root/test/issues/2.json').reply(() => { - const labels = Array(saveLabelCount) - .fill() - .map((_, i) => ({ - id: i, - title: `test ${i}`, - color: '#5CB85C', - })); + mock.onPut('/root/test/issues/2.json').reply(() => { + const labels = Array(saveLabelCount) + .fill() + .map((_, i) => ({ + id: i, + title: `test ${i}`, + color: '#5CB85C', + })); - return [200, { labels }]; - }); + return [200, { labels }]; }); + }); - afterEach(() => { - mock.restore(); - }); + afterEach(() => { + mock.restore(); + }); + + it('changes collapsed tooltip when changing labels when less than 5', done => { + saveLabelCount = 5; + $('.edit-link') + .get(0) + .click(); + + setTimeout(() => { + expect($('.dropdown-content a').length).toBe(10); + + $('.dropdown-content a').each(function(i) { + if (i < saveLabelCount) { + $(this) + .get(0) + .click(); + } + }); - it('changes collapsed tooltip when changing labels when less than 5', done => { - saveLabelCount = 5; $('.edit-link') .get(0) .click(); setTimeout(() => { - expect($('.dropdown-content a').length).toBe(10); - - $('.dropdown-content a').each(function(i) { - if (i < saveLabelCount) { - $(this) - .get(0) - .click(); - } - }); - - $('.edit-link') - .get(0) - .click(); - - setTimeout(() => { - expect($('.sidebar-collapsed-icon').attr('data-original-title')).toBe( - 'test 0, test 1, test 2, test 3, test 4', - ); - done(); - }, 0); + expect($('.sidebar-collapsed-icon').attr('data-original-title')).toBe( + 'test 0, test 1, test 2, test 3, test 4', + ); + done(); }, 0); - }); + }, 0); + }); + + it('changes collapsed tooltip when changing labels when more than 5', done => { + saveLabelCount = 6; + $('.edit-link') + .get(0) + .click(); + + setTimeout(() => { + expect($('.dropdown-content a').length).toBe(10); + + $('.dropdown-content a').each(function(i) { + if (i < saveLabelCount) { + $(this) + .get(0) + .click(); + } + }); - it('changes collapsed tooltip when changing labels when more than 5', done => { - saveLabelCount = 6; $('.edit-link') .get(0) .click(); setTimeout(() => { - expect($('.dropdown-content a').length).toBe(10); - - $('.dropdown-content a').each(function(i) { - if (i < saveLabelCount) { - $(this) - .get(0) - .click(); - } - }); - - $('.edit-link') - .get(0) - .click(); - - setTimeout(() => { - expect($('.sidebar-collapsed-icon').attr('data-original-title')).toBe( - 'test 0, test 1, test 2, test 3, test 4, and 1 more', - ); - done(); - }, 0); + expect($('.sidebar-collapsed-icon').attr('data-original-title')).toBe( + 'test 0, test 1, test 2, test 3, test 4, and 1 more', + ); + done(); }, 0); - }); + }, 0); }); -})(); +}); |