diff --git a/test/index.html b/test/index.html
index e388ab9a61..9b5c812e16 100644
--- a/test/index.html
+++ b/test/index.html
@@ -1,59 +1,62 @@
-
-
-
- OL Spec Runner
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+ OL Spec Runner
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/test/jasmine-extensions.js b/test/jasmine-extensions.js
new file mode 100644
index 0000000000..137090273e
--- /dev/null
+++ b/test/jasmine-extensions.js
@@ -0,0 +1,8 @@
+beforeEach(function() {
+ var parent = this.getMatchersClass_();
+ this.addMatchers({
+ toBeA: function(type) {
+ return this.actual instanceof type;
+ }
+ });
+});
diff --git a/test/spec/ol/Bounds.test.js b/test/spec/ol/Bounds.test.js
index bb8bef0cda..44f9328815 100644
--- a/test/spec/ol/Bounds.test.js
+++ b/test/spec/ol/Bounds.test.js
@@ -22,7 +22,7 @@ describe("ol.Bounds", function() {
expect(bounds.minY()).toBe(11);
expect(bounds.maxY()).toBe(12);
proj = bounds.projection();
- expect(proj instanceof ol.Projection).toBe(true);
+ expect(proj).toBeA(ol.Projection);
expect(proj.code()).toBe("bar");
});
diff --git a/test/spec/ol/Loc.test.js b/test/spec/ol/Loc.test.js
index 69cb78fdfa..47bd9a5673 100644
--- a/test/spec/ol/Loc.test.js
+++ b/test/spec/ol/Loc.test.js
@@ -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");
diff --git a/test/spec/ol/Map.test.js b/test/spec/ol/Map.test.js
index 52599f4d13..5b0a1327a7 100644
--- a/test/spec/ol/Map.test.js
+++ b/test/spec/ol/Map.test.js
@@ -7,7 +7,7 @@ describe("ol.Map", function() {
var map = ol.map();
- expect(map instanceof ol.Map).toBe(true);
+ expect(map).toBeA(ol.Map);
});
@@ -21,7 +21,7 @@ describe("ol.Map", function() {
center = map.center();
expect(center.x().toFixed(3)).toBe("-110.000");
expect(center.y().toFixed(3)).toBe("45.000");
- expect(center instanceof ol.Loc).toBe(true);
+ expect(center).toBeA(ol.Loc);
// with object literal
map.center({x: -111, y: 46});
@@ -29,7 +29,7 @@ describe("ol.Map", function() {
center = map.center();
expect(center.x().toFixed(3)).toBe("-111.000");
expect(center.y().toFixed(3)).toBe("46.000");
- expect(center instanceof ol.Loc).toBe(true);
+ expect(center).toBeA(ol.Loc);
// more verbose
map = ol.map({
@@ -39,7 +39,7 @@ describe("ol.Map", function() {
center = map.center();
expect(center.x().toFixed(3)).toBe("-112.000");
expect(center.y().toFixed(3)).toBe("47.000");
- expect(center instanceof ol.Loc).toBe(true);
+ expect(center).toBeA(ol.Loc);
});
@@ -74,7 +74,7 @@ describe("ol.Map", function() {
var map = ol.map();
var proj = map.projection();
- expect(proj instanceof ol.Projection).toBe(true);
+ expect(proj).toBeA(ol.Projection);
expect(proj.code()).toBe("EPSG:3857");
});
@@ -88,14 +88,14 @@ describe("ol.Map", function() {
});
proj = map.projection();
- expect(proj instanceof ol.Projection).toBe(true);
+ expect(proj).toBeA(ol.Projection);
expect(proj.code()).toBe("EPSG:4326");
// after construction
map.projection("EPSG:3857");
proj = map.projection();
- expect(proj instanceof ol.Projection).toBe(true);
+ expect(proj).toBeA(ol.Projection);
expect(proj.code()).toBe("EPSG:3857");
});
@@ -105,7 +105,7 @@ describe("ol.Map", function() {
var map = ol.map();
var userproj = map.userProjection();
- expect(userproj instanceof ol.Projection).toBe(true);
+ expect(userproj).toBeA(ol.Projection);
expect(userproj.code()).toBe("EPSG:4326");
});
@@ -130,7 +130,7 @@ describe("ol.Map", function() {
var map = ol.map();
proj = map.userProjection();
- expect(proj instanceof ol.Projection).toBe(true);
+ expect(proj).toBeA(ol.Projection);
expect(proj.code()).toBe("EPSG:4326");
map.center([10, 20]);
@@ -202,7 +202,7 @@ describe("ol.Map", function() {
var map = ol.map();
var extent = map.maxExtent();
- expect(extent instanceof ol.Bounds).toBe(true);
+ expect(extent).toBeA(ol.Bounds);
expect(extent.minX()).toBe(-20037508.34);
expect(extent.maxX()).toBe(-20037508.34);
expect(extent.minY()).toBe(20037508.34);
@@ -215,7 +215,7 @@ describe("ol.Map", function() {
map.maxExtent([-5,-4,7,9]);
var extent = map.maxExtent();
- expect(extent instanceof ol.Bounds).toBe(true);
+ expect(extent).toBeA(ol.Bounds);
expect(extent.minX()).toBe(-5);
expect(extent.maxX()).toBe(-4);
expect(extent.minY()).toBe(7);
@@ -228,7 +228,7 @@ describe("ol.Map", function() {
map.projection("CRS:84");
var extent = map.maxExtent();
- expect(extent instanceof ol.Bounds).toBe(true);
+ expect(extent).toBeA(ol.Bounds);
expect(extent.minX()).toBe(-180);
expect(extent.maxX()).toBe(-90);
expect(extent.minY()).toBe(180);
diff --git a/test/spec/ol/Tile.test.js b/test/spec/ol/Tile.test.js
index a7a7c82878..563e712e0a 100644
--- a/test/spec/ol/Tile.test.js
+++ b/test/spec/ol/Tile.test.js
@@ -3,7 +3,7 @@ describe("ol.Tile", function() {
describe("creating a tile", function() {
it("creates a tile instance", function() {
var tile = new ol.Tile();
- expect(tile instanceof ol.Tile).toBe(true);
+ expect(tile).toBeA(ol.Tile);
});
it("sets an image node in the instance", function() {
var tile = new ol.Tile();
diff --git a/test/spec/ol/TileSet.test.js b/test/spec/ol/TileSet.test.js
index ae161561ba..b3d139046a 100644
--- a/test/spec/ol/TileSet.test.js
+++ b/test/spec/ol/TileSet.test.js
@@ -2,7 +2,7 @@ describe("ol.TileSet", function() {
describe("creating a tileset", function() {
it("creates a tileset instance", function() {
var tileset = new ol.TileSet();
- expect(tileset instanceof ol.TileSet).toBe(true);
+ expect(tileset).toBeA(ol.TileSet);
});
});
});