Allow instanceof checks for geometries

This commit is contained in:
Tim Schaub
2013-02-19 23:21:05 -07:00
parent 083404bd58
commit 0015e466dc
11 changed files with 30 additions and 6 deletions

View File

@@ -7,6 +7,7 @@ describe('ol.geom.LineString', function() {
it('creates a linestring from an array', function() {
var line = new ol.geom.LineString([[10, 20], [30, 40]]);
expect(line).toBeA(ol.geom.LineString);
expect(line).toBeA(ol.geom.Geometry);
});
it('throws when given mismatched dimension', function() {
@@ -62,4 +63,5 @@ describe('ol.geom.LineString', function() {
});
goog.require('ol.geom.Geometry');
goog.require('ol.geom.LineString');

View File

@@ -9,6 +9,7 @@ describe('ol.geom.MultiLineString', function() {
[[10, 20], [30, 40]],
[[20, 30], [40, 50]]]);
expect(multi).toBeA(ol.geom.MultiLineString);
expect(multi).toBeA(ol.geom.Geometry);
});
it('throws when given with insufficient dimensions', function() {
@@ -69,4 +70,5 @@ describe('ol.geom.MultiLineString', function() {
});
goog.require('ol.geom.Geometry');
goog.require('ol.geom.MultiLineString');

View File

@@ -7,6 +7,7 @@ describe('ol.geom.MultiPoint', function() {
it('creates a multi-point from an array', function() {
var multi = new ol.geom.MultiPoint([[10, 20], [30, 40]]);
expect(multi).toBeA(ol.geom.MultiPoint);
expect(multi).toBeA(ol.geom.Geometry);
});
it('throws when given with insufficient dimensions', function() {
@@ -59,4 +60,5 @@ describe('ol.geom.MultiPoint', function() {
});
goog.require('ol.geom.Geometry');
goog.require('ol.geom.MultiPoint');

View File

@@ -14,6 +14,7 @@ describe('ol.geom.MultiPolygon', function() {
[outer1, inner1a, inner1b],
[outer2]]);
expect(multi).toBeA(ol.geom.MultiPolygon);
expect(multi).toBeA(ol.geom.Geometry);
});
it('throws when given with insufficient dimensions', function() {
@@ -72,4 +73,5 @@ describe('ol.geom.MultiPolygon', function() {
});
goog.require('ol.geom.Geometry');
goog.require('ol.geom.MultiPolygon');

View File

@@ -7,6 +7,7 @@ describe('ol.geom.Point', function() {
it('creates a point from an array', function() {
var point = new ol.geom.Point([10, 20]);
expect(point).toBeA(ol.geom.Point);
expect(point).toBeA(ol.geom.Geometry);
});
it('throws when given with insufficient dimensions', function() {
@@ -60,4 +61,5 @@ describe('ol.geom.Point', function() {
});
goog.require('ol.geom.Geometry');
goog.require('ol.geom.Point');

View File

@@ -11,6 +11,7 @@ describe('ol.geom.Polygon', function() {
it('creates a polygon from an array', function() {
var poly = new ol.geom.Polygon([outer, inner1, inner2]);
expect(poly).toBeA(ol.geom.Polygon);
expect(poly).toBeA(ol.geom.Geometry);
});
it('throws when given mismatched dimension', function() {
@@ -64,4 +65,5 @@ describe('ol.geom.Polygon', function() {
});
goog.require('ol.geom.Geometry');
goog.require('ol.geom.Polygon');