codecombat/test/app/lib/path.spec.coffee
Michael Schmatz 718e7ebd22 Fixed failing createPath test
There was a misnamed variable, incorrect expect, and outdated calling
style
2014-01-12 12:44:22 -08:00

26 lines
863 B
CoffeeScript

describe('Path.createPath', ->
path = require 'lib/surface/path'
it('ignores the first point', ->
points = [[0,0], [1,1], [2,2]]
g = new createjs.Graphics()
g.lineTo = jasmine.createSpy('graphicz')
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
xit('dots correctly', ->
points = ([x,x] for x in [0..30])
g = new createjs.Graphics()
calls = []
funcs = ['lineTo', 'moveTo', 'beginStroke', 'endStroke', 'setStrokeStyle']
for funcName in funcs
f = (funcName) => (args...) =>
calls.push("#{funcName}(#{args})")
g[funcName] = jasmine.createSpy('graphics').andCallFake(f(funcName))
path.createPath(points, {dotted:true}, g)
expect(g.beginStroke.calls.length).toBe(4)
)
)