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

Port spec for Collapse #82

Merged
merged 1 commit into from
Sep 16, 2023
Merged

Port spec for Collapse #82

merged 1 commit into from
Sep 16, 2023

Conversation

kikuomax
Copy link
Collaborator

@kikuomax kikuomax commented Sep 4, 2023

Part of the series of PRs to port unit tests.

The following command should pass:

npx jest src/components/collapse

You will see the following warning while running the tests. This is due to the issue #26 but should not matter to the test results:

[Vue warn]: Non-function value encountered for default slot. Prefer function slots for better performance.

Related to:

Proposed Changes

  • Port spec for Collapse

- Updates the unit tests (spec) of `Collapse` so that they can work with
  `@vue/test-utils` V2 and breaking changes:
    - Replaces mock functions to test emitted events with tests on
      `wrapper.emitted`.
    - Corrects the v-model bindings:
        - property: `open` → `modelValue`
        - event: `update:open` → `update:modelValue`
    - Awaits `wrapper.setProps` to make sure the subsequent tests verify
      the updated state.
    - Waits after "click" events.
    - Replaces `wrapper.name()` with `wrapper.vm.$options.name` because
      `wrapper.name` no longer exists in `@vue/test-utils` V2.
    - Replaces the test on `wrapper.isVueInstance()` with presence of
      `wrapper.vm` because `wrapper.isVueInstance` no longer exists in
      `@vue/test-utils` V2.
    - Removes the test case "should have scoped trigger slot" because
      `scopedSlots` is integrated into `slots` on `@vue/test-utils` V2.
    - Replaces `propsData` option for `shallowMount` with `props`
      because `propsData` might be deprecated in the future.
    - Refreshes the snapshot. I found "aria-expanded" attribute has
      disappeared from the updated snapshot, though, I believe the
      updated snapshot is legitimate.

issue ntohq#1
@kikuomax kikuomax requested a review from wesdevpro September 4, 2023 03:59
@wesdevpro wesdevpro merged commit de9249b into ntohq:dev Sep 16, 2023
@kikuomax kikuomax deleted the test-collapse branch September 18, 2023 01:42
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.

2 participants