test(input): merge render spec files (#27449)

Issue number: N/A

---------

<!-- Please do not submit updates to dependencies unless it fixes an
issue. -->

<!-- Please try to limit your pull request to one type (bugfix, feature,
etc). Submit multiple pull requests if needed. -->

## What is the current behavior?
<!-- Please describe the current behavior that you are modifying. -->

Input had two spec files for the same behavior. The only difference was
the file type: `.ts` and `.tsx`

## What is the new behavior?
<!-- Please describe the behavior or changes that are being added by
this PR. -->

- Merged the spec test into one file

## Does this introduce a breaking change?

- [ ] Yes
- [x] No

<!-- If this introduces a breaking change, please describe the impact
and migration path for existing applications below. -->


## Other information

<!-- Any other information that is important to this PR such as
screenshots of how the component looks before and after the change. -->

N/A
This commit is contained in:
Maria Hutt
2023-05-11 10:27:36 -07:00
committed by GitHub
parent c985237048
commit b64a03ad48
2 changed files with 40 additions and 40 deletions

View File

@ -1,14 +1,46 @@
import { newSpecPage } from '@stencil/core/testing';
import { Input } from '../input';
it('should inherit attributes', async () => {
const page = await newSpecPage({
components: [Input],
html: '<ion-input title="my title" tabindex="-1" data-form-type="password"></ion-input>',
describe('input: rendering', () => {
it('should inherit attributes', async () => {
const page = await newSpecPage({
components: [Input],
html: '<ion-input title="my title" tabindex="-1" data-form-type="password"></ion-input>',
});
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');
});
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');
it('should render bottom content when helper text is defined', async () => {
const page = await newSpecPage({
components: [Input],
html: `<ion-input label="Input" helper-text="Helper Text"></ion-input>`,
});
const bottomContent = page.body.querySelector('ion-input .input-bottom');
expect(bottomContent).not.toBe(null);
});
it('should render bottom content when helper text is undefined', async () => {
const page = await newSpecPage({
components: [Input],
html: `<ion-input label="Input"></ion-input>`,
});
const bottomContent = page.body.querySelector('ion-input .input-bottom');
expect(bottomContent).toBe(null);
});
it('should render bottom content when helper text is empty string', async () => {
const page = await newSpecPage({
components: [Input],
html: `<ion-input label="Input" helper-text=""></ion-input>`,
});
const bottomContent = page.body.querySelector('ion-input .input-bottom');
expect(bottomContent).toBe(null);
});
});

View File

@ -1,32 +0,0 @@
import { newSpecPage } from '@stencil/core/testing';
import { Input } from '../input';
it('should render bottom content when helper text is defined', async () => {
const page = await newSpecPage({
components: [Input],
html: `<ion-input label="Input" helper-text="Helper Text"></ion-input>`,
});
const bottomContent = page.body.querySelector('ion-input .input-bottom');
expect(bottomContent).not.toBe(null);
});
it('should render bottom content when helper text is undefined', async () => {
const page = await newSpecPage({
components: [Input],
html: `<ion-input label="Input"></ion-input>`,
});
const bottomContent = page.body.querySelector('ion-input .input-bottom');
expect(bottomContent).toBe(null);
});
it('should render bottom content when helper text is empty string', async () => {
const page = await newSpecPage({
components: [Input],
html: `<ion-input label="Input" helper-text=""></ion-input>`,
});
const bottomContent = page.body.querySelector('ion-input .input-bottom');
expect(bottomContent).toBe(null);
});