diff options
author | Mike Greiling <mgreiling@gitlab.com> | 2017-06-13 18:20:26 +0300 |
---|---|---|
committer | Mike Greiling <mgreiling@gitlab.com> | 2017-06-13 18:20:26 +0300 |
commit | a526e619d96aa95a55110e540363c34ab782defc (patch) | |
tree | 09e41597fac96b94bcf2f7423811d34ca4997d92 /spec/javascripts/merge_request_tabs_spec.js | |
parent | f79caeaa454473802fe648f142bcf73684ffdbdc (diff) |
Revert "Merge branch 'karma-headless-chrome' into 'master'"
This reverts merge request !12036
Diffstat (limited to 'spec/javascripts/merge_request_tabs_spec.js')
-rw-r--r-- | spec/javascripts/merge_request_tabs_spec.js | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/spec/javascripts/merge_request_tabs_spec.js b/spec/javascripts/merge_request_tabs_spec.js index 9916d2c1e21..7b910282cc8 100644 --- a/spec/javascripts/merge_request_tabs_spec.js +++ b/spec/javascripts/merge_request_tabs_spec.js @@ -12,6 +12,15 @@ import '~/notes'; import 'vendor/jquery.scrollTo'; (function () { + // TODO: remove this hack! + // PhantomJS causes spyOn to panic because replaceState isn't "writable" + var phantomjs; + try { + phantomjs = !Object.getOwnPropertyDescriptor(window.history, 'replaceState').writable; + } catch (err) { + phantomjs = false; + } + describe('MergeRequestTabs', function () { var stubLocation = {}; var setLocation = function (stubs) { @@ -28,9 +37,11 @@ import 'vendor/jquery.scrollTo'; this.class = new gl.MergeRequestTabs({ stubLocation: stubLocation }); setLocation(); - this.spies = { - history: spyOn(window.history, 'replaceState').and.callFake(function () {}) - }; + if (!phantomjs) { + this.spies = { + history: spyOn(window.history, 'replaceState').and.callFake(function () {}) + }; + } }); afterEach(function () { @@ -197,9 +208,11 @@ import 'vendor/jquery.scrollTo'; pathname: '/foo/bar/merge_requests/1' }); newState = this.subject('commits'); - expect(this.spies.history).toHaveBeenCalledWith({ - url: newState - }, document.title, newState); + if (!phantomjs) { + expect(this.spies.history).toHaveBeenCalledWith({ + url: newState + }, document.title, newState); + } }); it('treats "show" like "notes"', function () { |