Skip to content

[good first issue] Add "be.hidden" assertion #217

@kevinccbsg

Description

@kevinccbsg

Inverse of the existing be.visible. Reuses the isVisible helper already in src/asserts/index.ts.

Scope

  • New case in src/asserts/index.ts returning !isVisible(el).
  • Unit test in src/tests/asserts/.
  • Add a row in docs/api/assertions.md.
  • Add an element with display: none and data-testid="be-hidden" in examples/twd-test-app/src/pages/Assertions.tsx.
  • Example test uses screenDom.getByTestId("be-hidden") + twd.should(el, "be.hidden").

Reference

  • be.visible implementation in src/asserts/index.ts.

Acceptance criteria

  • npm run test:ci is green.
  • Example test runs green in the TWD sidebar of twd-test-app.
  • docs/api/assertions.md updated.
  • PR includes a sidebar screenshot.

How to contribute

Read CONTRIBUTING.md first. Quick steps for this issue:

  1. Fork, clone, create a feature branch: git checkout -b feat/be-hidden-assertion.
  2. From the repo root, build the library and sync it to the example apps:
    npm install
    npm run build
    npm run copy:mock-sw
  3. Install and run the test app:
    cd examples/twd-test-app
    npm install
    npm run dev
  4. Open the app in the browser — the TWD sidebar appears on the right. Run your new tests from the sidebar and confirm they pass.
  5. Run the library's unit tests from the repo root: npm run test:ci.
  6. Open the PR with screenshots of the sidebar showing green tests.

Always prefer screenDom (Testing Library) for element queries. Avoid twd.get() in new code.

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentationenhancementNew feature or requestgood first issueGood for newcomers

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions