mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2025-03-14 07:00:01 -04:00
Fixed failing createPath test
There was a misnamed variable, incorrect expect, and outdated calling style
This commit is contained in:
parent
1f4bcd0073
commit
718e7ebd22
2 changed files with 8 additions and 4 deletions
|
@ -189,6 +189,7 @@ module.exports.Trailmaster = class Trailmaster
|
|||
|
||||
|
||||
|
||||
|
||||
createPath = (points, options={}, g=null) ->
|
||||
options = options or {}
|
||||
tailColor = options.tailColor ? options.headColor
|
||||
|
@ -205,7 +206,6 @@ createPath = (points, options={}, g=null) ->
|
|||
|
||||
points = points.slice(-maxLength * 2) if maxLength isnt 0
|
||||
points = points.slice(((points.length / 2 + dotOffset) % PATH_SEGMENT_LENGTH) * 2) if dotOffset
|
||||
|
||||
g = new createjs.Graphics() unless g
|
||||
return new createjs.Shape(g) if not points
|
||||
|
||||
|
@ -289,3 +289,7 @@ colorForThang = (team, brightness=100, alpha=1.0) =>
|
|||
color = _.map(multipliers, (m) -> return parseInt(m * brightness))
|
||||
color.push(alpha)
|
||||
return color
|
||||
|
||||
module.exports.createPath = createPath
|
||||
|
||||
|
||||
|
|
|
@ -4,9 +4,9 @@ describe('Path.createPath', ->
|
|||
points = [[0,0], [1,1], [2,2]]
|
||||
g = new createjs.Graphics()
|
||||
g.lineTo = jasmine.createSpy('graphicz')
|
||||
path.createPath(points, {tail_color:[100,100,100,0.0]}, g)
|
||||
expect(g.lineTo.calls.length).toBe(2)
|
||||
expect(g.lineTo.calls[0].args[0]).toBe(points[1][0])
|
||||
path.createPath(points, {tailColor:[100,100,100,0.0]}, g)
|
||||
expect(g.lineTo.calls.length).toBe(1)
|
||||
expect(g.lineTo.calls[0].args[0]).toBe(points[2])
|
||||
)
|
||||
|
||||
# # BROKEN
|
||||
|
|
Loading…
Reference in a new issue