From 3b782f6338a1704b8c2265f2c9314d9cf8679d53 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrg=20Lehni?= Date: Sun, 23 Jun 2013 17:52:31 -0700 Subject: [PATCH] Implement failing test for #243. --- test/tests/HitResult.js | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/test/tests/HitResult.js b/test/tests/HitResult.js index f62b13cb..360255a8 100644 --- a/test/tests/HitResult.js +++ b/test/tests/HitResult.js @@ -541,4 +541,28 @@ test('Hit testing the corner of a rectangle with miter stroke.', function() { }, true); }); +test('Hit testing invisible items', function() { + var point = new Point(0, 0); + var circle1 = new Path.Circle({ + center: point.subtract([25, 0]), + radius: 50, + fillColor: 'red' + }); + var circle2 = new Path.Circle({ + center: point.add([25, 0]), + radius: 50, + fillColor: 'blue' + }); + + equals(function() { + return paper.project.hitTest(point).item; + }, circle2, 'circle2 should be returned.'); + + circle2.visible = false; + + equals(function() { + return paper.project.hitTest(point).item; + }, circle1, 'circle1 should be returned.'); +}); + // TODO: project.hitTest(point, {type: AnItemType}); \ No newline at end of file