From 683174f58b6fb3f396f24bca8c8ab5343a4ee40a Mon Sep 17 00:00:00 2001 From: Volodymyr Rudyi Date: Tue, 5 Jan 2016 21:11:25 +0100 Subject: [PATCH 1/2] Forward events when creating a new poly. Add unit tests --- google-map-poly.html | 3 ++ test/poly-custom-properties.html | 81 ++++++++++++++++++++++++++++++++ 2 files changed, 84 insertions(+) create mode 100644 test/poly-custom-properties.html diff --git a/google-map-poly.html b/google-map-poly.html index 66c8d28..9f9e76c 100644 --- a/google-map-poly.html +++ b/google-map-poly.html @@ -517,6 +517,9 @@ } this._listeners = {}; + this._clickEventsChanged(); + this._mouseEventsChanged(); + this._dragEventsChanged(); }, _forwardEvent: function(name) { diff --git a/test/poly-custom-properties.html b/test/poly-custom-properties.html new file mode 100644 index 0000000..089a609 --- /dev/null +++ b/test/poly-custom-properties.html @@ -0,0 +1,81 @@ + + + + + + + + + + + + + + + + + + + + + + + + + From ea07d6b13bd82cb1e0c8f2cbe4867434e46fd76c Mon Sep 17 00:00:00 2001 From: Volodymyr Rudyi Date: Wed, 6 Jan 2016 08:54:23 +0100 Subject: [PATCH 2/2] Improve the unit test, fix a typo in the unit test --- test/poly-custom-properties.html | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/test/poly-custom-properties.html b/test/poly-custom-properties.html index 089a609..6d98437 100644 --- a/test/poly-custom-properties.html +++ b/test/poly-custom-properties.html @@ -55,19 +55,19 @@ assert.isTrue(poly.poly.getVisible()); assert.equal(poly.poly.get('zIndex'), 5); - assert.isNotNull(poly._listeners['mousedown']); - assert.isNotNull(poly._listeners['mousemove']); - assert.isNotNull(poly._listeners['mouseout']); - assert.isNotNull(poly._listeners['mouseover']); - assert.isNotNull(poly._listeners['mouseup']); + assert.ok(poly._listeners['mousedown']); + assert.ok(poly._listeners['mousemove']); + assert.ok(poly._listeners['mouseout']); + assert.ok(poly._listeners['mouseover']); + assert.ok(poly._listeners['mouseup']); - assert.isNotNull(poly._listeners['drag']); - assert.isNotNull(poly._listeners['dragend']); - assert.isNotNull(poly._listeners['dragstart']); + assert.ok(poly._listeners['drag']); + assert.ok(poly._listeners['dragend']); + assert.ok(poly._listeners['dragstart']); - assert.isNotNull(poly._listeners['click']); - assert.isNotNull(poly._listeners['dbclick']); - assert.isNotNull(poly._listeners['rightclick']); + assert.ok(poly._listeners['click']); + assert.ok(poly._listeners['dblclick']); + assert.ok(poly._listeners['rightclick']); done();