add a Jasmine toBeA matcher

This commit is contained in:
Éric Lemoine
2012-06-20 11:44:23 +02:00
parent 02840ad573
commit a7a86bb169
7 changed files with 89 additions and 78 deletions
+4 -4
View File
@@ -5,7 +5,7 @@ describe("ol.Loc", function() {
// nowhere
loc = ol.loc();
expect(loc instanceof ol.Loc).toBe(true);
expect(loc).toBeA(ol.Loc);
});
it("allows construction from an obj config", function() {
@@ -69,7 +69,7 @@ describe("ol.Loc", function() {
var loc = ol.loc({x: 1, y: 2, projection: "EPSG:4326"});
proj = loc.projection();
expect(proj instanceof ol.Projection).toBe(true);
expect(proj).toBe(ol.Projection);
expect(proj.code()).toBe("EPSG:4326");
// after construction
@@ -87,7 +87,7 @@ describe("ol.Loc", function() {
var loc = ol.loc({x: 10, y: 20, projection: "EPSG:4326"});
var trans = loc.transform("EPSG:3857");
expect(trans instanceof ol.Loc).toBe(true);
expect(trans).toBeA(ol.Loc);
expect(trans.projection().code()).toBe("EPSG:3857");
expect(trans.x().toFixed(3)).toBe("1113194.908");
expect(trans.y().toFixed(3)).toBe("2273030.927");
@@ -102,7 +102,7 @@ describe("ol.Loc", function() {
var loc = ol.loc({x: 1113195, y: 2273031, projection: "EPSG:3857"});
var trans = loc.transform("EPSG:4326");
expect(trans instanceof ol.Loc).toBe(true);
expect(trans).toBeA(ol.Loc);
expect(trans.projection().code()).toBe("EPSG:4326");
expect(trans.x().toFixed(3)).toBe("10.000");
expect(trans.y().toFixed(3)).toBe("20.000");