diff --git a/core/src/components/input/test/input.spec.ts b/core/src/components/input/test/input.spec.ts new file mode 100644 index 00000000000..f07d46c8f0e --- /dev/null +++ b/core/src/components/input/test/input.spec.ts @@ -0,0 +1,14 @@ +import { newSpecPage } from '@stencil/core/testing'; +import { Input } from '../input'; + +it('should inherit attributes', async () => { + const page = await newSpecPage({ + components: [Input], + html: '', + }); + + const nativeEl = page.body.querySelector('ion-input input'); + expect(nativeEl.getAttribute('title')).toBe('my title'); + expect(nativeEl.getAttribute('tabindex')).toBe('-1'); + expect(nativeEl.getAttribute('data-form-type')).toBe('password'); +}); diff --git a/core/src/components/textarea/test/textarea.spec.ts b/core/src/components/textarea/test/textarea.spec.ts new file mode 100644 index 00000000000..a3e8a7ec131 --- /dev/null +++ b/core/src/components/textarea/test/textarea.spec.ts @@ -0,0 +1,14 @@ +import { newSpecPage } from '@stencil/core/testing'; +import { Textarea } from '../textarea'; + +it('should inherit attributes', async () => { + const page = await newSpecPage({ + components: [Textarea], + html: '', + }); + + const nativeEl = page.body.querySelector('ion-textarea textarea'); + expect(nativeEl.getAttribute('title')).toBe('my title'); + expect(nativeEl.getAttribute('tabindex')).toBe('-1'); + expect(nativeEl.getAttribute('data-form-type')).toBe('password'); +}); diff --git a/core/src/components/textarea/textarea.tsx b/core/src/components/textarea/textarea.tsx index 1f4f2211413..56b50233bda 100644 --- a/core/src/components/textarea/textarea.tsx +++ b/core/src/components/textarea/textarea.tsx @@ -223,7 +223,7 @@ export class Textarea implements ComponentInterface { componentWillLoad() { this.inheritedAttributes = { ...inheritAriaAttributes(this.el), - ...inheritAttributes(this.el, ['data-form-type', 'title']), + ...inheritAttributes(this.el, ['data-form-type', 'title', 'tabindex']), }; }