Skip to content

Commit 17690bf

Browse files
posvayyx990803
authored andcommitted
Fix missing removal of v-transition class (#3033)
Fix #2972
1 parent e55606a commit 17690bf

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

src/directives/internal/transition.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ export default {
1111
// resolve on owner vm
1212
var hooks = resolveAsset(this.vm.$options, 'transitions', id)
1313
id = id || 'v'
14+
oldId = oldId || 'v'
1415
el.__v_trans = new Transition(el, id, hooks, this.vm)
1516
if (oldId) {
1617
removeClass(el, oldId + '-transition')

test/unit/specs/directives/internal/transition_spec.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,25 +14,30 @@ describe('transition', function () {
1414
})
1515
var dir = new Directive({
1616
name: 'transition',
17-
raw: 'test',
17+
raw: '',
1818
def: def,
1919
modifiers: {
2020
literal: true
2121
}
2222
}, vm, el)
2323
dir._bind()
2424
var transition = dir.el.__v_trans
25+
expect(transition.enterClass).toBe('v-enter')
26+
expect(transition.leaveClass).toBe('v-leave')
27+
expect(dir.el.className).toBe('v-transition')
28+
dir.update('test', '')
29+
transition = dir.el.__v_trans
2530
expect(transition.el).toBe(dir.el)
2631
expect(transition.hooks).toBe(fns)
2732
expect(transition.enterClass).toBe('test-enter')
2833
expect(transition.leaveClass).toBe('test-leave')
29-
expect(dir.el.className === 'test-transition')
34+
expect(dir.el.className).toBe('test-transition')
3035
dir.update('lol', 'test')
3136
transition = dir.el.__v_trans
3237
expect(transition.enterClass).toBe('lol-enter')
3338
expect(transition.leaveClass).toBe('lol-leave')
3439
expect(transition.fns).toBeUndefined()
35-
expect(dir.el.className === 'lol-transition')
40+
expect(dir.el.className).toBe('lol-transition')
3641
})
3742

3843
it('dynamic transitions', function (done) {

0 commit comments

Comments
 (0)