Skip to content

Commit

Permalink
Remove JS.ENV from setTimeout() calls.
Browse files Browse the repository at this point in the history
  • Loading branch information
jcoglan committed Nov 5, 2013
1 parent c8fa052 commit e2ddc42
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 16 deletions.
4 changes: 2 additions & 2 deletions test/specs/package_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ JS.ENV.PackageSpec = JS.Test.describe(JS.Package, function() { with(this) {

JS.packages(function() { with(this) {
var block = function(callback) {
JS.ENV.setTimeout(function() {
setTimeout(function() {
defineObject(name);
callback();
}, delay);
Expand Down Expand Up @@ -119,7 +119,7 @@ JS.ENV.PackageSpec = JS.Test.describe(JS.Package, function() { with(this) {
JS.require("Standalone", function() { done1 = true })
JS.require("Standalone", function() { done2 = true })

JS.ENV.setTimeout(function() {
setTimeout(function() {
JS.require("Standalone", function() { doneAsync = true })
}, 300)

Expand Down
10 changes: 5 additions & 5 deletions test/specs/test/async_steps_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,21 @@ Test.AsyncStepsSpec = JS.Test.describe(JS.Test.AsyncSteps, function() { with(thi
this.StepModule = JS.Test.asyncSteps({
multiply: function(x, y, callback) { with(this) {
var self = this
JS.ENV.setTimeout(function() {
setTimeout(function() {
self.result = x * y
callback()
}, 100)
}},
subtract: function(n, callback) { with(this) {
var self = this
JS.ENV.setTimeout(function() {
setTimeout(function() {
self.result -= n
callback()
}, 100)
}},
zero: function(callback) { with(this) {
var self = this
JS.ENV.setTimeout(function() {
setTimeout(function() {
self.result = FakeMath.zero()
callback()
}, 100)
Expand All @@ -35,13 +35,13 @@ Test.AsyncStepsSpec = JS.Test.describe(JS.Test.AsyncSteps, function() { with(thi
callback()
}},
throwError: function(callback) { with(this) {
JS.ENV.setTimeout(function() {
setTimeout(function() {
throw new Error("async error")
callback()
}, 10)
}},
callbackError: function(callback) { with(this) {
JS.ENV.setTimeout(function() {
setTimeout(function() {
callback(new Error("webscale error"))
}, 10)
}}
Expand Down
16 changes: 8 additions & 8 deletions test/specs/test/fake_clock_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Test.FakeClockSpec = JS.Test.describe(JS.Test.FakeClock, function() { with(this)
describe("setTimeout", function() { with(this) {
before(function() { with(this) {
this.calls = 0
this.timer = JS.ENV.setTimeout(function() { calls += 1 }, 1000)
this.timer = setTimeout(function() { calls += 1 }, 1000)
}})

it("runs the timeout after clock has ticked enough", function() { with(this) {
Expand Down Expand Up @@ -74,12 +74,12 @@ Test.FakeClockSpec = JS.Test.describe(JS.Test.FakeClock, function() { with(this)
before(function() { with(this) {
this.calls = []

JS.ENV.setTimeout(function() {
JS.ENV.setTimeout(function() { calls.push("third") }, 100)
setTimeout(function() {
setTimeout(function() { calls.push("third") }, 100)
calls.push("first")
}, 50)

JS.ENV.setTimeout(function() { calls.push("second") }, 50)
setTimeout(function() { calls.push("second") }, 50)

setInterval(function() { calls.push("ping") }, 40)
}})
Expand All @@ -93,13 +93,13 @@ Test.FakeClockSpec = JS.Test.describe(JS.Test.FakeClock, function() { with(this)
describe("cancelling and resetting a timeout", function() { with(this) {
before(function() { with(this) {
this.calls = []
this.timer = JS.ENV.setTimeout(function() { calls.push("done") }, 1000)
this.timer = setTimeout(function() { calls.push("done") }, 1000)
}})

it("prolongs the delay before the timeout", function() { with(this) {
clock.tick(500)
JS.ENV.clearTimeout(timer)
JS.ENV.setTimeout(function() { calls.push("done") }, 1000)
clearTimeout(timer)
setTimeout(function() { calls.push("done") }, 1000)
clock.tick(500)
assertEqual( [], calls )
clock.tick(500)
Expand All @@ -110,7 +110,7 @@ Test.FakeClockSpec = JS.Test.describe(JS.Test.FakeClock, function() { with(this)
describe(Date, function() { with(this) {
before(function() { with(this) {
this.a = this.b = null
JS.ENV.setTimeout(function() { b = new Date().getTime() }, 100)
setTimeout(function() { b = new Date().getTime() }, 100)
a = new Date().getTime()
}})

Expand Down
2 changes: 1 addition & 1 deletion test/specs/test/unit_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -1156,7 +1156,7 @@ Test.UnitSpec = JS.Test.describe(JS.Test.Unit, function() { with(this) {
describe("when resume() is used asynchronously", function() { with(this) {
before(function() { with(this) {
this.asyncTest = function(resume) { with(this) {
JS.ENV.setTimeout(function() {
setTimeout(function() {
resume(function() { assertEqual( 2, 3 ) })
}, 1000)

Expand Down

0 comments on commit e2ddc42

Please sign in to comment.