Skip to content
Myr

fix(jsx): changes behavior when `download` attribute is set to a boolean value (#3094)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by oon00b · committed by GitHub · parent 28de9b3 · Browse files · 3 files+25 added−2 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

3 files+25 added−2 removed

  • tests:+22 added−0 removed
  • other:+3 added−2 removed

3 files+25 added−2 removed

modified:src/jsx/base.ts+1 added
54 unmodified lines
55 'controls',56 'default',57 'defer',58 'disabled',59 'download',60 'formnovalidate',61 'hidden',62 'inert',63 'ismap',
298 unmodified lines
modified:src/jsx/index.test.tsx+22 added
295 unmodified lines
296 )297 })298 })299300 describe('download attribute', () => {301 it('<a download={true}></a> should be rendered as <a download=""></a>', () => {302 const template = <a download={true}></a>303 expect(template.toString()).toBe('<a download=""></a>')304 })305306 it('<a download={false}></a> should be rendered as <a></a>', () => {307 const template = <a download={false}></a>308 expect(template.toString()).toBe('<a></a>')309 })310311 it('<a download></a> should be rendered as <a download=""></a>', () => {312 const template = <a download></a>313 expect(template.toString()).toBe('<a download=""></a>')314 })315316 it('<a download="test"></a> should be rendered as <a download="test"></a>', () => {317 const template = <a download='test'></a>318 expect(template.toString()).toBe('<a download="test"></a>')319 })320 })321322 describe('Function', () => {323 it('should be ignored used in on* props', () => {324 const onClick = () => {}325 const template = <button onClick={onClick}>Click</button>
472 unmodified lines
modified:src/jsx/intrinsic-elements.ts+2 added-2 removed
177 unmodified lines
178179 type HTMLAttributeAnchorTarget = '_self' | '_blank' | '_parent' | '_top' | string180181 interface AnchorHTMLAttributes extends HTMLAttributes {182 download?: any182 download?: string | boolean | undefined183 href?: string | undefined184 hreflang?: string | undefined185 media?: string | undefined186 ping?: string | undefined
6 unmodified lines
193194 interface AreaHTMLAttributes extends HTMLAttributes {195 alt?: string | undefined196 coords?: string | undefined197 download?: any197 download?: string | boolean | undefined198 href?: string | undefined199 hreflang?: string | undefined200 media?: string | undefined201 referrerpolicy?: HTMLAttributeReferrerPolicy | undefined
528 unmodified lines