From 595f50d76ef9d8b2c9c479eaf005733a2d279ceb Mon Sep 17 00:00:00 2001 From: Grafikart Date: Thu, 11 Aug 2016 21:18:44 +0200 Subject: [PATCH 1/2] break the tests --- test/dynamics.coffee | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/test/dynamics.coffee b/test/dynamics.coffee index b147647..d31c17b 100644 --- a/test/dynamics.coffee +++ b/test/dynamics.coffee @@ -253,6 +253,30 @@ describe 'dynamics.animate', -> done() , 150 + + it 'animates the points of a svg path correctly', (done) -> + el = document.createElement('path') + + # On chrome 52 getComputedStyle give a "d" property for path + # Mock window.getComputedStyle + style = window.getComputedStyle(el, null) + style.setProperty('d', 'path(10 20 30)') + oldComputed = window.getComputedStyle + window.getComputedStyle = (el, pseudoElt) -> style + + dynamics.tests.isSVG = (el) -> true + el.setAttribute("d", "M101.88,22 C101.88,18.25") + dynamics.animate(el, { + d: "M50,10 C88.11,20.45" + }, { + duration: 100 + }) + setTimeout -> + expect(el.getAttribute("d")[0]).to.be.equal('M') + window.getComputedStyle = oldComputed # remove mock to avoid conflict for the next test + done() + , 50 + it 'animates properties of an object correctly', (done) -> assertTypes = (object) -> expect(typeof(object.number)).to.be.equal('number', 'object.number has the wrong type') From 061f1717270491e1bfe2eb3ed4c9e3df802d6e7a Mon Sep 17 00:00:00 2001 From: Grafikart Date: Thu, 11 Aug 2016 21:20:21 +0200 Subject: [PATCH 2/2] Fix for chrome 52 on paths --- src/dynamics.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/dynamics.coffee b/src/dynamics.coffee index 81e952e..3c3ba03 100644 --- a/src/dynamics.coffee +++ b/src/dynamics.coffee @@ -173,7 +173,7 @@ getCurrentProperties = (el, keys) -> properties['transform'] = matrix.decompose() else v = style[key] - if !v? && svgProperties.contains(key) + if (!v? or key is 'd') && svgProperties.contains(key) v = el.getAttribute(key) if v == "" or !v? v = defaultValueForKey(key)