Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: expose helper to perform action and wait for update #13

Merged
merged 1 commit into from
Jul 23, 2021

Conversation

DylanPiercey
Copy link
Collaborator

@DylanPiercey DylanPiercey commented Jul 23, 2021

Description

This PR exposes a helper called act which allows for an easy way to perform any mutation and wait for Marko components to update. It works similarly to await fireEvent helpers and the core implementation has been refactored for all of those helpers to use this underlying helper.

Motivation and Context

This makes it easy to do something like:

import { render, act } from "@marko/testing-library";

const { getByText } = await render(template);

await act(() => getByText("My Button").click());

or

import userEvent from "@testing-library/user-event";
import { render, act } from "@marko/testing-library";

const { getByDisplayValue } = await render(template);

await act(() => userEvent.type(getByDisplayValue("Hello"), " World"));

Checklist:

  • I have updated/added documentation affected by my changes.
  • I have added tests to cover my changes.

@codecov
Copy link

codecov bot commented Jul 23, 2021

Codecov Report

Merging #13 (4542a11) into main (e906526) will decrease coverage by 0.09%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main      #13      +/-   ##
==========================================
- Coverage   96.17%   96.07%   -0.10%     
==========================================
  Files           3        3              
  Lines         157      153       -4     
  Branches       39       37       -2     
==========================================
- Hits          151      147       -4     
  Misses          6        6              
Impacted Files Coverage Δ
src/index-browser.ts 95.94% <100.00%> (ø)
src/index.ts 97.77% <100.00%> (ø)
src/shared.ts 94.11% <100.00%> (-0.62%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e906526...4542a11. Read the comment docs.

@DylanPiercey DylanPiercey merged commit 7cd9d12 into main Jul 23, 2021
@DylanPiercey DylanPiercey deleted the expose-act-helper branch July 23, 2021 22:45
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.

1 participant