Skip to content

Wrapped the test suites in waitFor to remove react warning - #231

Open
11yashiagrawal wants to merge 2 commits into
Newton-School:masterfrom
11yashiagrawal:new-feature-branch
Open

Wrapped the test suites in waitFor to remove react warning#231
11yashiagrawal wants to merge 2 commits into
Newton-School:masterfrom
11yashiagrawal:new-feature-branch

Conversation

@11yashiagrawal

Copy link
Copy Markdown

Fixes #50
The AnimatePresence Elements were giving out warning on running tests, so the asynchronous test suites have been wrapped in waitFor() for a smooth run.

@MihirSachdeva
MihirSachdeva requested a review from Copilot May 22, 2025 22:52

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR wraps asynchronous test flows in waitFor() to resolve React warnings (particularly from AnimatePresence elements) and update several test suites and component files. Key changes include updating test imports to include waitFor, refactoring tests to asynchronous patterns, and cleaning up obsolete commented code in Carousel-related files.

Reviewed Changes

Copilot reviewed 12 out of 12 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
ui/elements/PopOver/PopOver.test.tsx Added waitFor wrappers for asynchronous assertions in PopOver tests
ui/elements/Modal/MultiStepModal/index.test.tsx Updated test callbacks to async waitFor assertions
ui/elements/Modal/Modal.test.tsx Refactored tests to use waitFor and updated assertions accordingly
ui/elements/Modal/ConfirmationDialog/index.test.tsx Wrapped confirmation dialog tests in waitFor for async evaluation
ui/elements/Form/Dropdown/Dropdown.test.tsx Refactored single and multi select mode tests to include waitFor calls
ui/elements/Carousel/types.ts Commented out $translateX property reflecting removal of unused state
ui/elements/Carousel/Carousel.tsx Updated scrolling behavior and removed unused translateX state
ui/elements/Carousel/Carousel.styles.ts Removed transform styles in favor of native scrolling styles
ui/elements/BottomSheet/BottomSheet.test.tsx Wrapped bottom sheet tests in waitFor for async rendering assertions
ui/elements/Accordion/Accordion.test.tsx Updated accordion tests to use waitFor for asynchronous expectations
ui/css/index.scss Commented out grauity-icons import
.gitmodules Updated submodule URL from SSH to HTTPS
Comments suppressed due to low confidence (2)

ui/elements/Form/Dropdown/Dropdown.test.tsx:177

  • An empty test block appears to have been left before the async test for multi select mode with action buttons. Please remove the redundant empty test block to avoid confusion.
    it('Should run entire flow correctly in multi select mode if action buttons are present', () => {

ui/elements/Carousel/Carousel.styles.ts:53

  • Since native scrolling is now used, remove the deprecated transform rule to keep the CSS clean and maintainable.
-    transform: translateX(${(props) => props.$translateX}px);

const containerRef = useRef<HTMLDivElement | null>(null);

const [translateX, setTranslateX] = useState(0);
// const [translateX, setTranslateX] = useState(0);

Copilot AI May 22, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] If the translateX state is no longer used, consider removing this commented-out code for clarity.

Suggested change
// const [translateX, setTranslateX] = useState(0);

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Running tests on components which use AnimatePresence gives an error (warning)

2 participants