Skip to content

Commit

Permalink
fix addClass utlil bug (#4863)
Browse files Browse the repository at this point in the history
* fix addClass util bug

`<transition-group move-class=“ value with leading or trailing whitespace ” />`

* fix addClass util bug

`<transition-group move-class=“ value with leading or trailing whitespace ” />`

* fix addClass util bug

`<transition-group move-class=“ value with leading or trailing whitespace ” />`

* update test case for `addClass / removeClass` util
  • Loading branch information
hashplus authored and yyx990803 committed Feb 6, 2017
1 parent e853d19 commit 8bf5af8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/platforms/web/runtime/class-util.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/
export function addClass (el: Element, cls: ?string) {
/* istanbul ignore if */
if (!cls || !cls.trim()) {
if (!cls || !(cls = cls.trim())) {
return
}

Expand All @@ -31,7 +31,7 @@ export function addClass (el: Element, cls: ?string) {
*/
export function removeClass (el: Element, cls: ?string) {
/* istanbul ignore if */
if (!cls || !cls.trim()) {
if (!cls || !(cls = cls.trim())) {
return
}

Expand Down
6 changes: 3 additions & 3 deletions test/unit/features/transition/transition.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ if (!isIE9) {
enter-to-class="hello-to"
leave-class="bye"
leave-to-class="bye-to"
leave-active-class="byebye active">
leave-active-class="byebye active more ">
<div v-if="ok" class="test">foo</div>
</transition>
</div>
Expand All @@ -85,9 +85,9 @@ if (!isIE9) {
expect(vm.$el.innerHTML).toBe('<div class="test">foo</div>')
vm.ok = false
waitForUpdate(() => {
expect(vm.$el.children[0].className).toBe('test bye byebye active')
expect(vm.$el.children[0].className).toBe('test bye byebye active more')
}).thenWaitFor(nextFrame).then(() => {
expect(vm.$el.children[0].className).toBe('test byebye active bye-to')
expect(vm.$el.children[0].className).toBe('test byebye active more bye-to')
}).thenWaitFor(duration + buffer).then(() => {
expect(vm.$el.children.length).toBe(0)
vm.ok = true
Expand Down

0 comments on commit 8bf5af8

Please sign in to comment.