Make geometries event targets
Previously, the tests were using eql to make assertions about matching geometries. This is inappropriate for structures with circular references (as with goog.events.EventTarget);
This commit is contained in:
37
test/spec/ol/geom/geometry.test.js
Normal file
37
test/spec/ol/geom/geometry.test.js
Normal file
@@ -0,0 +1,37 @@
|
||||
goog.provide('ol.test.geom.Geometry');
|
||||
|
||||
describe('ol.geom.Geometry', function() {
|
||||
|
||||
describe('constructor', function() {
|
||||
it('creates a new geometry', function() {
|
||||
var geom = new ol.geom.Geometry();
|
||||
expect(geom).to.be.a(ol.geom.Geometry);
|
||||
expect(geom).to.be.a(goog.events.EventTarget);
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
describe('ol.geom.GeometryEvent', function() {
|
||||
|
||||
describe('constructor', function() {
|
||||
|
||||
it('creates a new event', function() {
|
||||
var point = new ol.geom.Point([1, 2]);
|
||||
var bounds = point.getBounds();
|
||||
var evt = new ol.geom.GeometryEvent('change', point, bounds);
|
||||
expect(evt).to.be.a(ol.geom.GeometryEvent);
|
||||
expect(evt).to.be.a(goog.events.Event);
|
||||
expect(evt.target).to.be(point);
|
||||
expect(evt.oldExtent).to.be(bounds);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
goog.require('goog.events.Event');
|
||||
goog.require('goog.events.EventTarget');
|
||||
goog.require('ol.geom.Geometry');
|
||||
goog.require('ol.geom.GeometryEvent');
|
||||
goog.require('ol.geom.Point');
|
||||
Reference in New Issue
Block a user