Skip to content

Commit d4315d8

Browse files
author
Evan You
committed
fix tests for vuejs#249
1 parent 3eca8aa commit d4315d8

File tree

2 files changed

+6
-25
lines changed

2 files changed

+6
-25
lines changed

src/transition.js

+5-3
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,6 @@ var transition = module.exports = function (el, stage, cb, compiler) {
6969

7070
}
7171

72-
transition.codes = codes
73-
7472
/**
7573
* Togggle a CSS class to trigger transition
7674
*/
@@ -223,4 +221,8 @@ function sniffEndEvents () {
223221
? 'animationend'
224222
: 'webkitAnimationEnd'
225223
return ret
226-
}
224+
}
225+
226+
// Expose some stuff for testing purposes
227+
transition.codes = codes
228+
transition.sniff = sniffEndEvents

test/unit/specs/transition.js

+1-22
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ describe('Transition', function () {
33
var transition = require('vue/src/transition'),
44
config = require('vue/src/config'),
55
codes = transition.codes,
6-
endEvents = sniffEndEvents(),
6+
endEvents = transition.sniff(),
77
enterClass = config.enterClass,
88
leaveClass = config.leaveClass,
99
nextTick = Vue.nextTick
@@ -356,25 +356,4 @@ describe('Transition', function () {
356356
}
357357
}
358358

359-
function sniffEndEvents () {
360-
var el = document.createElement('vue'),
361-
defaultEvent = 'transitionend',
362-
events = {
363-
'transition' : defaultEvent,
364-
'mozTransition' : defaultEvent,
365-
'webkitTransition' : 'webkitTransitionEnd'
366-
},
367-
ret = {}
368-
for (var name in events) {
369-
if (el.style[name] !== undefined) {
370-
ret.trans = events[name]
371-
break
372-
}
373-
}
374-
ret.anim = el.style.animation === ''
375-
? 'animationend'
376-
: 'webkitAnimationEnd'
377-
return ret
378-
}
379-
380359
})

0 commit comments

Comments
 (0)