dxc-technology / halstack-react

Library of components for building SPAs with React and Halstack Design System
https://developer.dxc.com/halstack/
Apache License 2.0
15 stars 14 forks source link

New invalid selector issue with Jest and nwsapi library #1614

Closed GomezIvann closed 1 year ago

GomezIvann commented 1 year ago

Describe the bug The library nwsapi has been updated to version 2.2.5 and it's throwing a new error when testing the DxcDialog.

To Reproduce Include steps to reproduce the behaviour.

Example:

  1. Create a new React App using create-react-app.
  2. Install the @dxc-technology\halstack-react dependencies and run the app.
  3. Implement a quick App using the DxcDialog.

    () => {
    const [isDialogVisible, setDialogVisible] = useState(false);
    const handleClick = () => {
    setDialogVisible(!isDialogVisible);
    };
    
    return (
    <DxcInset space="2rem">
      <DxcButton label="Enter your data" onClick={handleClick}></DxcButton>
      {isDialogVisible && (
        <DxcDialog onCloseClick={handleClick}>
          Please enter your personal information.
        </DxcDialog>
      )}
    </DxcInset>
    );
    }
  4. Write a simple test to display the Dialog.
    test("renders learn react link", async () => {
    const { getByText } = render(<App />);
    fireEvent.click(getByText("Enter your data"));
    expect(getByText("Please enter your personal information.")).toBeTruthy();
    });
  5. Run npm test.
  6. See the error.

Screenshots image