A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/vuejs/vue/commit/d8d4ca6 below:

transition group should work with dynamic name (#6006) (#6019) · vuejs/vue@d8d4ca6 · GitHub

File tree Expand file treeCollapse file tree 4 files changed

+58

-3

lines changed

Filter options

Expand file treeCollapse file tree 4 files changed

+58

-3

lines changed Original file line number Diff line number Diff line change

@@ -42,12 +42,20 @@ export function removeClass (el: HTMLElement, cls: ?string) {

42 42

} else {

43 43

el.classList.remove(cls)

44 44

}

45 +

if (!el.classList.length) {

46 +

el.removeAttribute('class')

47 +

}

45 48

} else {

46 49

let cur = ` ${el.getAttribute('class') || ''} `

47 50

const tar = ' ' + cls + ' '

48 51

while (cur.indexOf(tar) >= 0) {

49 52

cur = cur.replace(tar, ' ')

50 53

}

51 -

el.setAttribute('class', cur.trim())

54 +

cur = cur.trim()

55 +

if (cur) {

56 +

el.setAttribute('class', cur)

57 +

} else {

58 +

el.removeAttribute('class')

59 +

}

52 60

}

53 61

}

Original file line number Diff line number Diff line change

@@ -127,7 +127,7 @@ export default {

127 127

if (!hasTransition) {

128 128

return false

129 129

}

130 -

if (this._hasMove != null) {

130 +

if (this._hasMove) {

131 131

return this._hasMove

132 132

}

133 133

// Detect whether an element with the move class applied has

Original file line number Diff line number Diff line change

@@ -293,5 +293,52 @@ if (!isIE9) {

293 293

}).$mount()

294 294

expect('<transition-group> children must be keyed: <div>').toHaveBeenWarned()

295 295

})

296 + 297 +

// Github issue #6006

298 +

it('should work with dynamic name', done => {

299 +

const vm = new Vue({

300 +

template: `

301 +

<div>

302 +

<transition-group :name="name">

303 +

<div v-for="item in items" :key="item">{{ item }}</div>

304 +

</transition-group>

305 +

</div>

306 +

`,

307 +

data: {

308 +

items: ['a', 'b', 'c'],

309 +

name: 'group'

310 +

}

311 +

}).$mount(el)

312 + 313 +

vm.name = 'invalid-name'

314 +

vm.items = ['b', 'c', 'a']

315 +

waitForUpdate(() => {

316 +

expect(vm.$el.innerHTML.replace(/\s?style=""(\s?)/g, '$1')).toBe(

317 +

`<span>` +

318 +

`<div>b</div>` +

319 +

`<div>c</div>` +

320 +

`<div>a</div>` +

321 +

`</span>`

322 +

)

323 +

vm.name = 'group'

324 +

vm.items = ['a', 'b', 'c']

325 +

}).thenWaitFor(nextFrame).then(() => {

326 +

expect(vm.$el.innerHTML.replace(/\s?style=""(\s?)/g, '$1')).toBe(

327 +

`<span>` +

328 +

`<div class="group-move">a</div>` +

329 +

`<div class="group-move">b</div>` +

330 +

`<div class="group-move">c</div>` +

331 +

`</span>`

332 +

)

333 +

}).thenWaitFor(duration * 2 + buffer).then(() => {

334 +

expect(vm.$el.innerHTML.replace(/\s?style=""(\s?)/g, '$1')).toBe(

335 +

`<span>` +

336 +

`<div>a</div>` +

337 +

`<div>b</div>` +

338 +

`<div>c</div>` +

339 +

`</span>`

340 +

)

341 +

}).then(done)

342 +

})

296 343

})

297 344

}

Original file line number Diff line number Diff line change

@@ -437,7 +437,7 @@ if (!isIE9) {

437 437

expect(enterSpy).toHaveBeenCalled()

438 438

expect(vm.$el.innerHTML).toBe('<div class="nope-enter nope-enter-active">foo</div>')

439 439

}).thenWaitFor(nextFrame).then(() => {

440 -

expect(vm.$el.innerHTML).toMatch(/<div( class="")?>foo<\/div>/)

440 +

expect(vm.$el.innerHTML).toBe('<div>foo</div>')

441 441

}).then(done)

442 442

})

443 443

You can’t perform that action at this time.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4