start on Savage object tests
parent
440f4cef94
commit
047e6b5a5f
Binary file not shown.
|
@ -0,0 +1 @@
|
|||
success
|
|
@ -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');
|
||||
});
|
||||
});
|
|
@ -33,6 +33,7 @@
|
|||
<script>mocha.setup("bdd");</script>
|
||||
<script src="system.js"></script>
|
||||
<script src="paper.js"></script>
|
||||
<script src="savage-tests.js"></script>
|
||||
<script src="primitives.js"></script>
|
||||
<script src="colors.js"></script>
|
||||
<script src="attrs.js"></script>
|
||||
|
|
Loading…
Reference in New Issue