Skip to content

Commit

Permalink
test(runtime-vapor): special check for boolean prop
Browse files Browse the repository at this point in the history
  • Loading branch information
FireBushtree committed Feb 5, 2024
1 parent e9e7fe4 commit b7a856e
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions packages/runtime-vapor/__tests__/dom/patchProp.spec.ts
Expand Up @@ -137,6 +137,26 @@ describe('patchProp', () => {
setDOMProp(el, 'innerHTML', '<p>bar</p>')
expect(el.innerHTML).toBe('<p>bar</p>')
})

test('should be boolean prop', () => {
const el = document.createElement('select')
setDOMProp(el, 'multiple', '')
expect(el.multiple).toBe(true)
setDOMProp(el, 'multiple', null)
expect(el.multiple).toBe(false)
setDOMProp(el, 'multiple', true)
expect(el.multiple).toBe(true)
setDOMProp(el, 'multiple', 0)
expect(el.multiple).toBe(false)
setDOMProp(el, 'multiple', '0')
expect(el.multiple).toBe(true)
setDOMProp(el, 'multiple', false)
expect(el.multiple).toBe(false)
setDOMProp(el, 'multiple', 1)
expect(el.multiple).toBe(true)
setDOMProp(el, 'multiple', undefined)
expect(el.multiple).toBe(false)
})
})

describe('setDynamicProp', () => {
Expand Down

0 comments on commit b7a856e

Please sign in to comment.