Skip to content

Commit 65c7d4a

Browse files
author
heyunfei.i
committed
test(runtime-dom): treat 'class' as non-attr vuejs#3173
1 parent 870f2a7 commit 65c7d4a

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

packages/runtime-dom/__tests__/patchAttrs.spec.ts

+9
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,13 @@ describe('runtime-dom: attrs patching', () => {
3434
patchProp(el, 'onwards', 'a', null)
3535
expect(el.getAttribute('onwards')).toBe(null)
3636
})
37+
38+
// #3173
39+
test('treat class as non-attr', () => {
40+
const el = document.createElement('div')
41+
patchProp(el, 'class', null, null)
42+
expect(el.getAttribute('class')).toBe('')
43+
patchProp(el, 'class', undefined, undefined)
44+
expect(el.getAttribute('class')).toBe('')
45+
})
3746
})

packages/runtime-dom/__tests__/patchClass.spec.ts

+2
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ describe('runtime-dom: class patching', () => {
99
expect(el.className).toBe('foo')
1010
patchProp(el, 'class', null, null)
1111
expect(el.className).toBe('')
12+
patchProp(el, 'class', undefined, undefined)
13+
expect(el.className).toBe('')
1214
})
1315

1416
test('transition class', () => {

0 commit comments

Comments
 (0)