mirror of
https://github.com/atom/atom.git
synced 2026-01-25 06:48:28 -05:00
Merge pull request #12409 from atom/ns-mock-animation-frames-in-editor-spec
Mock clock and animation frames in TextEditorComponent specs
This commit is contained in:
@@ -56,9 +56,7 @@ export function timeoutPromise (timeout) {
|
||||
|
||||
function waitsForPromise (fn) {
|
||||
const promise = fn()
|
||||
// This timeout is 3 minutes. We need to bump it back down once we fix
|
||||
// backgrounding of the renderer process on CI. See https://github.com/atom/electron/issues/4317
|
||||
global.waitsFor('spec promise to resolve', 3 * 60 * 1000, function (done) {
|
||||
global.waitsFor('spec promise to resolve', function (done) {
|
||||
promise.then(done, function (error) {
|
||||
jasmine.getEnv().currentSpec.fail(error)
|
||||
done()
|
||||
|
||||
@@ -169,6 +169,13 @@ jasmine.useRealClock = ->
|
||||
jasmine.unspy(window, 'clearTimeout')
|
||||
jasmine.unspy(_._, '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
|
||||
# would do this everywhere if didn't cause us to break a bunch of package tests.
|
||||
jasmine.useMockClock = ->
|
||||
spyOn(window, 'setInterval').andCallFake(fakeSetInterval)
|
||||
spyOn(window, 'clearInterval').andCallFake(fakeClearInterval)
|
||||
|
||||
addCustomMatchers = (spec) ->
|
||||
spec.addMatchers
|
||||
toBeInstanceOf: (expected) ->
|
||||
@@ -242,7 +249,7 @@ window.resetTimeouts = ->
|
||||
window.timeouts = []
|
||||
window.intervalTimeouts = {}
|
||||
|
||||
window.fakeSetTimeout = (callback, ms) ->
|
||||
window.fakeSetTimeout = (callback, ms=0) ->
|
||||
id = ++window.timeoutCount
|
||||
window.timeouts.push([id, window.now + ms, callback])
|
||||
id
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -822,7 +822,6 @@ class TextEditorComponent
|
||||
|
||||
sampleBackgroundColors: (suppressUpdate) ->
|
||||
{backgroundColor} = getComputedStyle(@hostElement)
|
||||
|
||||
@presenter.setBackgroundColor(backgroundColor)
|
||||
|
||||
lineNumberGutter = @gutterContainerComponent?.getLineNumberGutterComponent()
|
||||
|
||||
Reference in New Issue
Block a user