Skip to content

Commit 174ceb2

Browse files
committed
v-transition: remove .v-leave if a transition is aborted (fixes vuejs#127)
1 parent 74c03f3 commit 174ceb2

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

src/transition.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ function applyTransitionClass (el, stage, changeState) {
7676
// cancel unfinished leave transition
7777
if (lastLeaveCallback) {
7878
el.removeEventListener(endEvent, lastLeaveCallback)
79+
classList.remove(config.leaveClass)
7980
el.vue_trans_cb = null
8081
}
8182

test/unit/specs/transition.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,16 @@ describe('UNIT: Transition', function () {
7474
el.dispatchEvent(e)
7575
assert.notOk(cbCalled)
7676
})
77-
77+
78+
it('should remove the v-leave class if the leave callback exists', function () {
79+
var el = mockEl('css')
80+
document.body.appendChild(el)
81+
el.style.width = '1px'
82+
code = transition(el, -1, function(){}, compiler)
83+
code = transition(el, 1, function(){}, compiler)
84+
assert.notOk(el.classList.contains(leaveClass))
85+
})
86+
7887
it('should remove the class afterwards', function () {
7988
assert.notOk(el.classList.contains(enterClass))
8089
})

0 commit comments

Comments
 (0)