mirror of
https://github.com/atom/atom.git
synced 2026-04-28 03:01:47 -04:00
Try always mocking Date.now in our global spec helper
This commit is contained in:
@@ -1350,7 +1350,6 @@ describe('Pane', () => {
|
||||
let editor1, pane, eventCount
|
||||
|
||||
beforeEach(async () => {
|
||||
jasmine.useMockClock()
|
||||
editor1 = await atom.workspace.open('sample.txt', {pending: true})
|
||||
pane = atom.workspace.getActivePane()
|
||||
eventCount = 0
|
||||
|
||||
@@ -65,6 +65,7 @@ beforeEach ->
|
||||
|
||||
window.resetTimeouts()
|
||||
spyOn(_._, "now").andCallFake -> window.now
|
||||
spyOn(Date, 'now').andCallFake(-> window.now)
|
||||
spyOn(window, "setTimeout").andCallFake window.fakeSetTimeout
|
||||
spyOn(window, "clearTimeout").andCallFake window.fakeClearTimeout
|
||||
|
||||
@@ -179,6 +180,7 @@ jasmine.useRealClock = ->
|
||||
jasmine.unspy(window, 'setTimeout')
|
||||
jasmine.unspy(window, 'clearTimeout')
|
||||
jasmine.unspy(_._, 'now')
|
||||
jasmine.unspy(Date, 'now')
|
||||
|
||||
# The clock is halfway mocked now in a sad and terrible way... only setTimeout
|
||||
# and clearTimeout are included. This method will also include setInterval. We
|
||||
@@ -186,8 +188,6 @@ jasmine.useRealClock = ->
|
||||
jasmine.useMockClock = ->
|
||||
spyOn(window, 'setInterval').andCallFake(fakeSetInterval)
|
||||
spyOn(window, 'clearInterval').andCallFake(fakeClearInterval)
|
||||
spyOn(Date, 'now').andCallFake(-> window.now)
|
||||
|
||||
|
||||
addCustomMatchers = (spec) ->
|
||||
spec.addMatchers
|
||||
|
||||
Reference in New Issue
Block a user