Skip to content

[USWDS] Modal | return early if no modal#4282

Merged
thisisdano merged 4 commits into
developfrom
gsq-nav-actions-test
Aug 17, 2021
Merged

[USWDS] Modal | return early if no modal#4282
thisisdano merged 4 commits into
developfrom
gsq-nav-actions-test

Conversation

@scottqueen-bixal

@scottqueen-bixal scottqueen-bixal commented Aug 2, 2021

Copy link
Copy Markdown
Contributor

Description

We seem to need a delay before handling the event, this gives us a bit of space and allows the test to successfully pass.

setting an early return so we don't query null items

Before you hit Submit, make sure you’ve done whichever of these applies to you:

  • Follow the 18F Front End Coding Style Guide and Accessibility Guide.
  • Run npm test and make sure the tests for the files you have changed have passed.
  • Run your code through HTML_CodeSniffer and make sure it’s error free.
  • Title your pull request using this format: [Website] - [UI component]: Brief statement describing what this pull request solves.

@scottqueen-bixal scottqueen-bixal requested a review from mejiaj August 2, 2021 17:30
mejiaj
mejiaj previously requested changes Aug 9, 2021

@mejiaj mejiaj left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM, can you please add a comment as to why we're adding this. In case Mocha adds a better way to prevent these types of conflicts in the future.

Comment thread spec/unit/navigation/navigation.spec.js Outdated
accordionButton.click();
EVENTS.escape(accordionButton);
assert.strictEqual(accordionButton.getAttribute("aria-expanded"), "false");
setTimeout(() => {

@aduth aduth Aug 10, 2021

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Mocha won't wait for this timeout unless you add done as an argument and call it in the callback. Otherwise you may observe some strange side effects in subsequent tests based on the code executed after the delay.

https://mochajs.org/#asynchronous-code

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

you're right @aduth, will take another look

Base automatically changed from jm-nav-actions to develop August 12, 2021 18:12
@scottqueen-bixal scottqueen-bixal changed the title Includes timeOut function around event listener to allow time for DOM… [USWDS] Modal | return early if no modal Aug 12, 2021
@scottqueen-bixal scottqueen-bixal dismissed mejiaj’s stale review August 12, 2021 18:48

updated on modal script

@thisisdano thisisdano merged commit 6cc7d7f into develop Aug 17, 2021
@thisisdano thisisdano deleted the gsq-nav-actions-test branch August 17, 2021 21:46
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.

4 participants