Skip to content

Commit

Permalink
fix fx.js dasherize bug
Browse files Browse the repository at this point in the history
  • Loading branch information
huangxueliang02 committed Apr 26, 2016
1 parent 601372a commit 8596fe9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/fx.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
animationName, animationDuration, animationTiming, animationDelay,
cssReset = {}

function dasherize(str) { return str.replace(/([a-z])([A-Z])/, '$1-$2').toLowerCase() }
function dasherize(str) { return str.replace(/([A-Z])/g, '-$1').toLowerCase() }
function normalizeEvent(name) { return eventPrefix ? eventPrefix + name : name.toLowerCase() }

$.each(vendors, function(vendor, event){
Expand Down
5 changes: 4 additions & 1 deletion test/fx.html
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,8 @@ <h1>Zepto Fx unit tests</h1>
rotateZ: '90deg',
scale: '0.8',
opacity: 0.5,
backgroundColor: '#BADA55'
backgroundColor: '#BADA55',
backgroundPositionY: '50%'
}, 200, 'ease-out')

el2.animate({
Expand All @@ -153,6 +154,7 @@ <h1>Zepto Fx unit tests</h1>
t.assertStyle('ease-out', el, 'transition-timing-function')
t.assertStyle('0.2s', el, 'transition-duration')
t.assertStyle(/\bbackground-color\b/, el, 'transition-property')
t.assertStyle(/\bbackground-position-y\b/, el, 'transition-property')
t.assertStyle(/\btransform\b/, el, 'transition-property')
t.assertStyle('0.18s', el2, 'transition-duration')

Expand All @@ -161,6 +163,7 @@ <h1>Zepto Fx unit tests</h1>
t.resume(function(){
t.assertStyle('translate3d(80px, 20px, 100px) rotateZ(90deg) scale(0.8)', el, 'transform')
t.assertStyle('0.5', el, 'opacity')
t.assertStyle('50%', el, 'background-position-y')
t.assertEqual('#BADA55', colorToHex(el.get(0).style.backgroundColor).toUpperCase())
})
})
Expand Down

0 comments on commit 8596fe9

Please sign in to comment.