From 047e6b5a5fba116372d9fceb78430c4a5417c131 Mon Sep 17 00:00:00 2001 From: adeveria Date: Wed, 11 Sep 2013 16:54:22 -0700 Subject: [PATCH] start on Savage object tests --- test/.DS_Store | Bin 6148 -> 6148 bytes test/res/file-for-ajax.txt | 1 + test/savage-tests.js | 52 +++++++++++++++++++++++++++++++++++++ test/test.html | 1 + 4 files changed, 54 insertions(+) create mode 100644 test/res/file-for-ajax.txt create mode 100644 test/savage-tests.js diff --git a/test/.DS_Store b/test/.DS_Store index ea2da096252315cdb0ce17b78b517f8f437b8c00..217a11e22c1f9185c1fe4eecdd160c3c337df98c 100644 GIT binary patch delta 301 zcmZoMXfc=|#>B)qu~2NHo+2ar#DLw4A22d9vQOq=oLaFEV~-p3E;|$pJJNZ1&~=kuA&s<4R5> delta 67 zcmZoMXfc=|#>B`mu~2NHo+2a5#DLw5ER%Vdrf=?Nu3*`Gf%y&NW_AvK4xp0F2bsS! VPv#e~g1?m;rp^5kUX| diff --git a/test/res/file-for-ajax.txt b/test/res/file-for-ajax.txt new file mode 100644 index 0000000..0f0c913 --- /dev/null +++ b/test/res/file-for-ajax.txt @@ -0,0 +1 @@ +success \ No newline at end of file diff --git a/test/savage-tests.js b/test/savage-tests.js new file mode 100644 index 0000000..071d4d7 --- /dev/null +++ b/test/savage-tests.js @@ -0,0 +1,52 @@ +describe("Savage methods", function () { + it("Savage.Matrix - six params", function () { + var matrix = new Savage.Matrix(1, 2, 3, 4, 5, 6); + expect(matrix).to.eql({ + a: 1, + b: 2, + c: 3, + d: 4, + e: 5, + f: 6 + }); + }); + it("Savage.Matrix - SVGMatrix param", function () { + var svgMatrix = new Savage(10, 10).node.createSVGMatrix(); + var matrix = new Savage.Matrix(svgMatrix); + expect(matrix).to.eql({ + a: 1, + b: 0, + c: 0, + d: 1, + e: 0, + f: 0 + }); + }); + it("Savage.ajax - no postData", function(done) { + var xhr = Savage.ajax('./res/file-for-ajax.txt', function(xhr) { + var responseText = xhr.responseText; + expect(responseText).to.be('success'); + expect(this.isContext).to.be(true); + done(); + }, {'isContext': true}); + expect(xhr).to.be.an('object'); + }); + it("Savage.ajax - with object postData", function(done) { + var xhr = Savage.ajax('./res/file-for-ajax.txt', {foo: 'bar'}, function(xhr) { + var responseText = xhr.responseText; + expect(responseText).to.be('success'); + expect(this.isContext).to.be(true); + done(); + }, {'isContext': true}); + expect(xhr).to.be.an('object'); + }); + it("Savage.ajax - with string postData", function(done) { + var xhr = Savage.ajax('./res/file-for-ajax.txt', 'foo=bar', function(xhr) { + var responseText = xhr.responseText; + expect(responseText).to.be('success'); + expect(this.isContext).to.be(true); + done(); + }, {'isContext': true}); + expect(xhr).to.be.an('object'); + }); +}); \ No newline at end of file diff --git a/test/test.html b/test/test.html index 304a848..322e982 100644 --- a/test/test.html +++ b/test/test.html @@ -33,6 +33,7 @@ +