Created
August 2, 2011 00:12
-
-
Save austinbv/1119293 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
describe "Draw", -> | |
beforeEach -> | |
loadFixtures("canvas.html") | |
# Fails with error split_at_colon is not defined | |
describe "points processing", -> | |
it "should turn comma colon seperated string into a series of 2 element arrays ", -> | |
processed_points = $("#drawn").test_draw('process_points', "1,1:2,2:3,3:4,4:5,5") | |
expect(processed_points).toEqual [[1,1],[2,2],[3,3],[4,4],[5,5]] | |
# PASSES | |
describe "#split_at_colon", -> | |
it "should turn a CSV into an array", -> | |
processed_points = $("#drawn").test_draw("split_at_colon", "1:2:3:4") | |
expect(processed_points).toEqual ["1","2","3","4"] | |
it "should return an arraw with commas in it when it has commas passed", -> | |
processed_points = $("#drawn").test_draw("split_at_colon", "1,1:2,2:3,3:4,4") | |
expect(processed_points).toEqual ["1,1", "2,2", "3,3", "4,4"] | |
# PASSES | |
describe "#split_at_comma", -> | |
describe "when passed an array", -> | |
it "should itterate through and turn the comma seperated values into an array of INTS", -> | |
processed_points = $("#drawn").test_draw("split_at_comma", ["1,1", "2,2", "3,3", "4,4"]) | |
expect(processed_points).toEqual [[1,1], [2,2], [3,3], [4,4]] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment