Skip to content

Commit ee42d44

Browse files
committed
mount-redraw: Remove the console parameter
The purpose of removing the parameters is to prepare for replacing console.error() with reportError(). The console is parameterized for testing purpose in mountRedraw, but tests in other code sections can be done without such console parameters.
1 parent efa4c88 commit ee42d44

File tree

5 files changed

+9
-7
lines changed

5 files changed

+9
-7
lines changed

api/mount-redraw.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
var Vnode = require("../render/vnode")
44

5-
module.exports = function(render, schedule, console) {
5+
module.exports = function(render, schedule) {
66
var subscriptions = []
77
var pending = false
88
var offset = -1

api/tests/test-mountRedraw.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,21 +11,23 @@ var h = require("../../render/hyperscript")
1111

1212
o.spec("mount/redraw", function() {
1313
var root, m, throttleMock, consoleMock, $document, errors
14+
var realError = console.error
1415
o.beforeEach(function() {
1516
var $window = domMock()
16-
consoleMock = {error: o.spy()}
17+
console.error = consoleMock = o.spy()
1718
throttleMock = throttleMocker()
1819
root = $window.document.body
19-
m = mountRedraw(coreRenderer($window), throttleMock.schedule, consoleMock)
20+
m = mountRedraw(coreRenderer($window), throttleMock.schedule)
2021
$document = $window.document
2122
errors = []
2223
})
2324

2425
o.afterEach(function() {
25-
o(consoleMock.error.calls.map(function(c) {
26+
o(consoleMock.calls.map(function(c) {
2627
return c.args[0]
2728
})).deepEquals(errors)
2829
o(throttleMock.queueLength()).equals(0)
30+
console.error = realError
2931
})
3032

3133
o("shouldn't error if there are no renderers", function() {

api/tests/test-router.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ o.spec("route", function() {
7979

8080
root = $window.document.body
8181

82-
mountRedraw = apiMountRedraw(coreRenderer($window), throttleMock.schedule, console)
82+
mountRedraw = apiMountRedraw(coreRenderer($window), throttleMock.schedule)
8383
route = apiRouter($window, mountRedraw)
8484
route.prefix = prefix
8585
console.error = function() {

api/tests/test-routerGetSet.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ o.spec("route.get/route.set", function() {
2222

2323
root = $window.document.body
2424

25-
mountRedraw = apiMountRedraw(coreRenderer($window), throttleMock.schedule, console)
25+
mountRedraw = apiMountRedraw(coreRenderer($window), throttleMock.schedule)
2626
route = apiRouter($window, mountRedraw)
2727
route.prefix = prefix
2828
})

mount-redraw.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22

33
var render = require("./render")
44

5-
module.exports = require("./api/mount-redraw")(render, typeof requestAnimationFrame !== "undefined" ? requestAnimationFrame : null, typeof console !== "undefined" ? console : null)
5+
module.exports = require("./api/mount-redraw")(render, typeof requestAnimationFrame !== "undefined" ? requestAnimationFrame : null)

0 commit comments

Comments
 (0)