diff options
Diffstat (limited to 'spec')
-rw-r--r-- | spec/javascripts/behaviors/autosize_spec.js | 2 | ||||
-rw-r--r-- | spec/javascripts/behaviors/requires_input_spec.js | 6 | ||||
-rw-r--r-- | spec/javascripts/bootstrap_linked_tabs_spec.js.es6 | 1 | ||||
-rw-r--r-- | spec/javascripts/build_spec.js.es6 | 7 | ||||
-rw-r--r-- | spec/javascripts/filtered_search/filtered_search_manager_spec.js.es6 | 10 | ||||
-rw-r--r-- | spec/javascripts/gl_dropdown_spec.js.es6 | 7 | ||||
-rw-r--r-- | spec/javascripts/issuable_spec.js.es6 | 17 | ||||
-rw-r--r-- | spec/javascripts/merge_request_tabs_spec.js | 1 | ||||
-rw-r--r-- | spec/javascripts/search_autocomplete_spec.js | 2 | ||||
-rw-r--r-- | spec/javascripts/smart_interval_spec.js.es6 | 2 | ||||
-rw-r--r-- | spec/javascripts/spec_helper.js | 1 |
11 files changed, 20 insertions, 36 deletions
diff --git a/spec/javascripts/behaviors/autosize_spec.js b/spec/javascripts/behaviors/autosize_spec.js index 51d911792ba..5f2c73634a8 100644 --- a/spec/javascripts/behaviors/autosize_spec.js +++ b/spec/javascripts/behaviors/autosize_spec.js @@ -15,7 +15,7 @@ }); }); return load = function() { - return $(document).trigger('page:load'); + return $(document).trigger('load'); }; }); }).call(this); diff --git a/spec/javascripts/behaviors/requires_input_spec.js b/spec/javascripts/behaviors/requires_input_spec.js index 9467056f04c..b1b1f1f437b 100644 --- a/spec/javascripts/behaviors/requires_input_spec.js +++ b/spec/javascripts/behaviors/requires_input_spec.js @@ -34,11 +34,5 @@ $('#required5').val('1').change(); return expect($('.submit')).not.toBeDisabled(); }); - return it('is called on page:load event', function() { - var spy; - spy = spyOn($.fn, 'requiresInput'); - $(document).trigger('page:load'); - return expect(spy).toHaveBeenCalled(); - }); }); }).call(this); diff --git a/spec/javascripts/bootstrap_linked_tabs_spec.js.es6 b/spec/javascripts/bootstrap_linked_tabs_spec.js.es6 index ea953d0f5a5..cac77cf67a0 100644 --- a/spec/javascripts/bootstrap_linked_tabs_spec.js.es6 +++ b/spec/javascripts/bootstrap_linked_tabs_spec.js.es6 @@ -50,7 +50,6 @@ secondTab.click(); expect(historySpy).toHaveBeenCalledWith({ - turbolinks: true, url: newState, }, document.title, newState); }); diff --git a/spec/javascripts/build_spec.js.es6 b/spec/javascripts/build_spec.js.es6 index 0c556382980..d813d6b39d0 100644 --- a/spec/javascripts/build_spec.js.es6 +++ b/spec/javascripts/build_spec.js.es6 @@ -1,12 +1,11 @@ /* eslint-disable no-new */ /* global Build */ -/* global Turbolinks */ //= require lib/utils/datetime_utility +//= require lib/utils/url_utility //= require build //= require breakpoints //= require jquery.nicescroll -//= require turbolinks describe('Build', () => { const BUILD_URL = `${gl.TEST_HOST}/frontend-fixtures/builds-project/builds/1`; @@ -167,7 +166,7 @@ describe('Build', () => { }); it('reloads the page when the build is done', () => { - spyOn(Turbolinks, 'visit'); + spyOn(gl.utils, 'visitUrl'); jasmine.clock().tick(4001); const [{ success, context }] = $.ajax.calls.argsFor(1); @@ -177,7 +176,7 @@ describe('Build', () => { append: true, }); - expect(Turbolinks.visit).toHaveBeenCalledWith(BUILD_URL); + expect(gl.utils.visitUrl).toHaveBeenCalledWith(BUILD_URL); }); }); }); diff --git a/spec/javascripts/filtered_search/filtered_search_manager_spec.js.es6 b/spec/javascripts/filtered_search/filtered_search_manager_spec.js.es6 index a508dacf7f0..8600c90b926 100644 --- a/spec/javascripts/filtered_search/filtered_search_manager_spec.js.es6 +++ b/spec/javascripts/filtered_search/filtered_search_manager_spec.js.es6 @@ -1,6 +1,4 @@ -/* global Turbolinks */ - -//= require turbolinks +//= require lib/utils/url_utility //= require lib/utils/common_utils //= require filtered_search/filtered_search_token_keys //= require filtered_search/filtered_search_tokenizer @@ -38,7 +36,7 @@ it('should search with a single word', () => { getInput().value = 'searchTerm'; - spyOn(Turbolinks, 'visit').and.callFake((url) => { + spyOn(gl.utils, 'visitUrl').and.callFake((url) => { expect(url).toEqual(`${defaultParams}&search=searchTerm`); }); @@ -48,7 +46,7 @@ it('should search with multiple words', () => { getInput().value = 'awesome search terms'; - spyOn(Turbolinks, 'visit').and.callFake((url) => { + spyOn(gl.utils, 'visitUrl').and.callFake((url) => { expect(url).toEqual(`${defaultParams}&search=awesome+search+terms`); }); @@ -58,7 +56,7 @@ it('should search with special characters', () => { getInput().value = '~!@#$%^&*()_+{}:<>,.?/'; - spyOn(Turbolinks, 'visit').and.callFake((url) => { + spyOn(gl.utils, 'visitUrl').and.callFake((url) => { expect(url).toEqual(`${defaultParams}&search=~!%40%23%24%25%5E%26*()_%2B%7B%7D%3A%3C%3E%2C.%3F%2F`); }); diff --git a/spec/javascripts/gl_dropdown_spec.js.es6 b/spec/javascripts/gl_dropdown_spec.js.es6 index 4e7eed2767c..2073afae333 100644 --- a/spec/javascripts/gl_dropdown_spec.js.es6 +++ b/spec/javascripts/gl_dropdown_spec.js.es6 @@ -1,11 +1,10 @@ /* eslint-disable comma-dangle, no-param-reassign, no-unused-expressions, max-len */ -/* global Turbolinks */ /*= require jquery */ /*= require gl_dropdown */ -/*= require turbolinks */ /*= require lib/utils/common_utils */ /*= require lib/utils/type_utility */ +//= require lib/utils/url_utility (() => { const NON_SELECTABLE_CLASSES = '.divider, .separator, .dropdown-header, .dropdown-menu-empty-link'; @@ -113,13 +112,13 @@ expect(this.dropdownContainerElement).toHaveClass('open'); const randomIndex = Math.floor(Math.random() * (this.projectsData.length - 1)) + 0; navigateWithKeys('down', randomIndex, () => { - spyOn(Turbolinks, 'visit').and.stub(); + spyOn(gl.utils, 'visitUrl').and.stub(); navigateWithKeys('enter', null, () => { expect(this.dropdownContainerElement).not.toHaveClass('open'); const link = $(`${ITEM_SELECTOR}:eq(${randomIndex}) a`, this.$dropdownMenuElement); expect(link).toHaveClass('is-active'); const linkedLocation = link.attr('href'); - if (linkedLocation && linkedLocation !== '#') expect(Turbolinks.visit).toHaveBeenCalledWith(linkedLocation); + if (linkedLocation && linkedLocation !== '#') expect(gl.utils.visitUrl).toHaveBeenCalledWith(linkedLocation); }); }); }); diff --git a/spec/javascripts/issuable_spec.js.es6 b/spec/javascripts/issuable_spec.js.es6 index 917a6267b92..9bea404379b 100644 --- a/spec/javascripts/issuable_spec.js.es6 +++ b/spec/javascripts/issuable_spec.js.es6 @@ -1,8 +1,7 @@ /* global Issuable */ -/* global Turbolinks */ +//= require lib/utils/url_utility //= require issuable -//= require turbolinks (() => { const BASE_URL = '/user/project/issues?scope=all&state=closed'; @@ -42,39 +41,39 @@ }); it('should contain only the default parameters', () => { - spyOn(Turbolinks, 'visit'); + spyOn(gl.utils, 'visitUrl'); Issuable.filterResults($filtersForm); - expect(Turbolinks.visit).toHaveBeenCalledWith(BASE_URL + DEFAULT_PARAMS); + expect(gl.utils.visitUrl).toHaveBeenCalledWith(BASE_URL + DEFAULT_PARAMS); }); it('should filter for the phrase "broken"', () => { - spyOn(Turbolinks, 'visit'); + spyOn(gl.utils, 'visitUrl'); updateForm({ search: 'broken' }, $filtersForm); Issuable.filterResults($filtersForm); const params = `${DEFAULT_PARAMS}&search=broken`; - expect(Turbolinks.visit).toHaveBeenCalledWith(BASE_URL + params); + expect(gl.utils.visitUrl).toHaveBeenCalledWith(BASE_URL + params); }); it('should keep query parameters after modifying filter', () => { - spyOn(Turbolinks, 'visit'); + spyOn(gl.utils, 'visitUrl'); // initial filter updateForm({ milestone_title: 'v1.0' }, $filtersForm); Issuable.filterResults($filtersForm); let params = `${DEFAULT_PARAMS}&milestone_title=v1.0`; - expect(Turbolinks.visit).toHaveBeenCalledWith(BASE_URL + params); + expect(gl.utils.visitUrl).toHaveBeenCalledWith(BASE_URL + params); // update filter updateForm({ label_name: 'Frontend' }, $filtersForm); Issuable.filterResults($filtersForm); params = `${DEFAULT_PARAMS}&milestone_title=v1.0&label_name=Frontend`; - expect(Turbolinks.visit).toHaveBeenCalledWith(BASE_URL + params); + expect(gl.utils.visitUrl).toHaveBeenCalledWith(BASE_URL + params); }); }); }); diff --git a/spec/javascripts/merge_request_tabs_spec.js b/spec/javascripts/merge_request_tabs_spec.js index 98201fb98ed..6009f0dbfc2 100644 --- a/spec/javascripts/merge_request_tabs_spec.js +++ b/spec/javascripts/merge_request_tabs_spec.js @@ -99,7 +99,6 @@ }); newState = this.subject('commits'); expect(this.spies.history).toHaveBeenCalledWith({ - turbolinks: true, url: newState }, document.title, newState); }); diff --git a/spec/javascripts/search_autocomplete_spec.js b/spec/javascripts/search_autocomplete_spec.js index 7ac9710654f..0b48a53f4bc 100644 --- a/spec/javascripts/search_autocomplete_spec.js +++ b/spec/javascripts/search_autocomplete_spec.js @@ -6,8 +6,6 @@ /*= require lib/utils/common_utils */ /*= require lib/utils/type_utility */ /*= require fuzzaldrin-plus */ -/*= require turbolinks */ -/*= require jquery.turbolinks */ (function() { var addBodyAttributes, assertLinks, dashboardIssuesPath, dashboardMRsPath, groupIssuesPath, groupMRsPath, groupName, mockDashboardOptions, mockGroupOptions, mockProjectOptions, projectIssuesPath, projectMRsPath, projectName, userId, widget; diff --git a/spec/javascripts/smart_interval_spec.js.es6 b/spec/javascripts/smart_interval_spec.js.es6 index 39d236986b9..e695454b8f7 100644 --- a/spec/javascripts/smart_interval_spec.js.es6 +++ b/spec/javascripts/smart_interval_spec.js.es6 @@ -164,7 +164,7 @@ const interval = this.smartInterval; setTimeout(() => { - $(document).trigger('page:before-unload'); + $(document).trigger('beforeunload'); expect(interval.state.intervalId).toBeUndefined(); expect(interval.getCurrentInterval()).toBe(interval.cfg.startingInterval); done(); diff --git a/spec/javascripts/spec_helper.js b/spec/javascripts/spec_helper.js index f8e3aca29fa..a89176e9ef4 100644 --- a/spec/javascripts/spec_helper.js +++ b/spec/javascripts/spec_helper.js @@ -8,7 +8,6 @@ // everything in application, however you may get better load performance if you // require the specific files that are being used in the spec that tests them. /*= require jquery */ -/*= require jquery.turbolinks */ /*= require bootstrap */ /*= require underscore */ |