refactor(item): remove build conditional for test environment (#29007)

- Fix Internal issue (FW-5205) - Removed the build conditional in the
`item` component since the previous issue is already fixed in Stencil.

---------

<!-- 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. -->

- No changes were made in terms of behavior.

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

- No changes were made in terms of behavior so it will work as before.

## Does this introduce a breaking change?

- [ ] Yes
- [x] No

<!--
  If this introduces a breaking change:
1. Describe the impact and migration path for existing applications
below.
  2. Update the BREAKING.md file with the breaking change.
3. Add "BREAKING CHANGE: [...]" to the commit description when merging.
See
https://github.com/ionic-team/ionic-framework/blob/main/.github/CONTRIBUTING.md#footer
for more information.
-->


## Other information

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

- Spec tests still pass even after this change (we can see below the
results before and after the change)
- Ran the command `npm run test.spec
src/components/item/test/item.spec.ts
src/components/item/test/item.spec.tsx`
    

![image](https://github.com/ionic-team/ionic-framework/assets/29493222/54a5f41c-d2c1-46e5-a220-2b881d5bd318)
This commit is contained in:
Gonçalo M
2024-02-14 01:46:16 +00:00
committed by GitHub
parent f5d6275e07
commit d47be8165a

View File

@ -1,5 +1,5 @@
import type { ComponentInterface } from '@stencil/core';
import { Build, Component, Element, Host, Listen, Prop, State, Watch, forceUpdate, h } from '@stencil/core';
import { Component, Element, Host, Listen, Prop, State, Watch, forceUpdate, h } from '@stencil/core';
import type { AnchorInterface, ButtonInterface } from '@utils/element-interface';
import type { Attributes } from '@utils/helpers';
import { inheritAttributes, raf } from '@utils/helpers';
@ -358,15 +358,6 @@ export class Item implements ComponentInterface, AnchorInterface, ButtonInterfac
}
private getFirstInteractive() {
if (Build.isTesting) {
/**
* Pseudo selectors can't be tested in unit tests.
* It will cause an error when running the tests.
*
* TODO: FW-5205 - Remove the build conditional when this is fixed in Stencil
*/
return undefined;
}
const controls = this.el.querySelectorAll<HTMLElement>(
'ion-toggle:not([disabled]), ion-checkbox:not([disabled]), ion-radio:not([disabled]), ion-select:not([disabled])'
);