From d92a5f53e52354d831c34b776b9c618d68cdba35 Mon Sep 17 00:00:00 2001 From: Guy Cook Date: Sun, 26 Jan 2014 17:17:14 +1300 Subject: [PATCH] Shape.hasShadow cache fix Typo was causing hasShadow cache not to be invalidated after using setShadowEnabled. Fixes issue #693 --- src/Shape.js | 2 +- test/unit/Shape-test.js | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Shape.js b/src/Shape.js index dee75db4..c09eec87 100644 --- a/src/Shape.js +++ b/src/Shape.js @@ -43,7 +43,7 @@ // call super constructor Kinetic.Node.call(this, config); - this.on('shadowColorChange.kinetic shadowBlurChange.kinetic shadowOffsetChange.kinetic shadowOpacityChange.kinetic shadowEnabledChanged.kinetic', _clearHasShadowCache); + this.on('shadowColorChange.kinetic shadowBlurChange.kinetic shadowOffsetChange.kinetic shadowOpacityChange.kinetic shadowEnabledChange.kinetic', _clearHasShadowCache); }, hasChildren: function() { return false; diff --git a/test/unit/Shape-test.js b/test/unit/Shape-test.js index d39503eb..f30dfaac 100644 --- a/test/unit/Shape-test.js +++ b/test/unit/Shape-test.js @@ -131,6 +131,10 @@ suite('Shape', function() { shape.setShadowOpacity(0.5); assert.equal(shape.hasShadow(), true, 'shape should have a shadow because opacity is nonzero'); + + shape.setShadowEnabled(false); + + assert.equal(shape.hasShadow(), false, 'shape should not have a shadow because it is not enabled'); }); // ======================================================