diff options
author | Mike Greiling <mike@pixelcog.com> | 2017-01-28 20:38:30 +0300 |
---|---|---|
committer | Mike Greiling <mike@pixelcog.com> | 2017-01-28 20:38:30 +0300 |
commit | 7c5d4942742cf8d5c942fba0888eaab5e1133fb4 (patch) | |
tree | 11dfd207b7e9805bb5784bbbeb10e119fbb2a69b /spec/javascripts | |
parent | c454dec170da32fc83b8d78c61c3f452c819f0ed (diff) |
fix frontend tests
Diffstat (limited to 'spec/javascripts')
-rw-r--r-- | spec/javascripts/commits_spec.js.es6 | 20 | ||||
-rw-r--r-- | spec/javascripts/filtered_search/filtered_search_manager_spec.js.es6 | 11 |
2 files changed, 21 insertions, 10 deletions
diff --git a/spec/javascripts/commits_spec.js.es6 b/spec/javascripts/commits_spec.js.es6 index bb9a9072f3a..05260760c43 100644 --- a/spec/javascripts/commits_spec.js.es6 +++ b/spec/javascripts/commits_spec.js.es6 @@ -1,10 +1,19 @@ /* global CommitsList */ -//= require jquery.endless-scroll -//= require pager -//= require commits +require('vendor/jquery.endless-scroll'); +require('~/pager'); +require('~/commits'); (() => { + // TODO: remove this hack! + // PhantomJS causes spyOn to panic because replaceState isn't "writable" + let phantomjs; + try { + phantomjs = !Object.getOwnPropertyDescriptor(window.history, 'replaceState').writable; + } catch (err) { + phantomjs = false; + } + describe('Commits List', () => { beforeEach(() => { setFixtures(` @@ -25,7 +34,10 @@ beforeEach(() => { CommitsList.init(25); CommitsList.searchField.val(''); - spyOn(history, 'replaceState').and.stub(); + + if (!phantomjs) { + spyOn(history, 'replaceState').and.stub(); + } ajaxSpy = spyOn(jQuery, 'ajax').and.callFake((req) => { req.success({ data: '<li>Result</li>', 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 c8b5c2b36ad..1a06b60b2c2 100644 --- a/spec/javascripts/filtered_search/filtered_search_manager_spec.js.es6 +++ b/spec/javascripts/filtered_search/filtered_search_manager_spec.js.es6 @@ -1,11 +1,10 @@ /* global Turbolinks */ -//= require turbolinks -//= require lib/utils/common_utils -//= require filtered_search/filtered_search_token_keys -//= require filtered_search/filtered_search_tokenizer -//= require filtered_search/filtered_search_dropdown_manager -//= require filtered_search/filtered_search_manager +require('~/lib/utils/common_utils'); +require('~/filtered_search/filtered_search_token_keys'); +require('~/filtered_search/filtered_search_tokenizer'); +require('~/filtered_search/filtered_search_dropdown_manager'); +require('~/filtered_search/filtered_search_manager'); (() => { describe('Filtered Search Manager', () => { |