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 Unit Tests. #1

Closed
80 tasks done
wesdevpro opened this issue Jul 12, 2023 · 13 comments
Closed
80 tasks done

Port Unit Tests. #1

wesdevpro opened this issue Jul 12, 2023 · 13 comments
Assignees

Comments

@wesdevpro
Copy link

wesdevpro commented Jul 12, 2023

Before starting actual porting, we have to tweak the webpack and Jest configurations.

List of spec files:

  • src/components/autocomplete/Autocomplete.spec.js
  • src/components/breadcrumb/Breadcrumb.spec.js
  • src/components/breadcrumb/BreadcrumbItem.spec.js
  • src/components/button/Button.spec.js
  • src/components/carousel/Carousel.spec.js
  • src/components/carousel/CarouselItem.spec.js
  • src/components/carousel/CarouselList.spec.js
  • src/components/checkbox/Checkbox.spec.js
  • src/components/checkbox/CheckboxButton.spec.js
  • src/components/clockpicker/Clockpicker.spec.js
  • src/components/clockpicker/ClockpickerFace.spec.js
  • src/components/collapse/Collapse.spec.js
  • src/components/colorpicker/Colorpicker.spec.js
  • src/components/colorpicker/ColorpickerAlphaSlider.spec.js
  • src/components/colorpicker/ColorpickerHSLRepresentationSquare.spec.js
  • src/components/colorpicker/ColorpickerHSLRepresentationTriangle.spec.js
  • src/components/datepicker/Datepicker.spec.js
  • src/components/datepicker/DatepickerMonth.spec.js
  • src/components/datepicker/DatepickerTable.spec.js
  • src/components/datepicker/DatepickerTableRow.spec.js
  • src/components/datetimepicker/Datetimepicker.spec.js
  • src/components/dialog/Dialog.spec.js
  • src/components/dropdown/Dropdown.spec.js
  • src/components/dropdown/DropdownItem.spec.js
  • src/components/field/Field.spec.js
  • src/components/field/FieldBody.spec.js
  • src/components/icon/Icon.spec.js
  • src/components/image/Image.spec.js
  • src/components/input/Input.spec.js
  • src/components/loading/Loading.spec.js
  • src/components/menu/Menu.spec.js
  • src/components/menu/MenuItem.spec.js
  • src/components/menu/MenuList.spec.js
  • src/components/message/Message.spec.js
  • src/components/modal/Modal.spec.js
  • src/components/navbar/NavBar.spec.js
  • src/components/navbar/NavBarBurger.spec.js
  • src/components/navbar/NavBarItem.spec.js
  • src/components/navbar/NavbarDropdown.spec.js
  • src/components/notification/Notification.spec.js
  • src/components/numberinput/Numberinput.spec.js
  • src/components/pagination/Pagination.spec.js
  • src/components/pagination/PaginationButton.spec.js
  • src/components/progress/Progress.spec.js
  • src/components/progress/ProgressBar.spec.js
  • src/components/radio/Radio.spec.js
  • src/components/radio/RadioButton.spec.js
  • src/components/rate/Rate.spec.js
  • src/components/select/Select.spec.js
  • src/components/sidebar/Sidebar.spec.js
  • src/components/skeleton/Skeleton.spec.js
  • src/components/slider/Slider.spec.js
  • src/components/slider/SliderThumb.spec.js
  • src/components/slider/SliderTick.spec.js
  • src/components/snackbar/Snackbar.spec.js
  • src/components/steps/StepItem.spec.js
  • src/components/steps/Steps.spec.js
  • src/components/switch/Switch.spec.js
  • src/components/table/Table.spec.js
  • src/components/table/TableColumn.spec.js
  • src/components/table/TableMobileSort.spec.js
  • src/components/tabs/TabItem.spec.js
  • src/components/tabs/Tabs.spec.js
  • src/components/tag/Tag.spec.js
  • src/components/tag/Taglist.spec.js
  • src/components/taginput/Taginput.spec.js
  • src/components/timepicker/Timepicker.spec.js
  • src/components/toast/Toast.spec.js
  • src/components/tooltip/Tooltip.spec.js
  • src/components/upload/Upload.spec.js
  • src/utils/CheckRadioMixin.spec.js
  • src/utils/FormElementMixin.spec.js
  • src/utils/MessageMixin.spec.js
  • src/utils/NoticeMixin.spec.js
  • src/utils/SlotComponent.spec.js
  • src/utils/TimepickerMixin.spec.js
  • src/utils/color.spec.js
  • src/utils/config.spec.js
  • src/utils/debounce.spec.js
  • src/utils/helpers.spec.js
@kikuomax
Copy link
Collaborator

Command to run unit tests:

npm run unit

kikuomax added a commit that referenced this issue Jul 18, 2023
- Updates the unit tests (spec) of `Button` so that they can work with
  `@vue/test-utils` V2.
    - Replaces `wrapper.name()` with `wrapper.vm.$options.name` because
      `wrapper.name` no longer exists in V2.
    - Replaces the test of `wrapper.isVueInstance()` with that of
      presence of `wrapper.vm` because `wrapper.isVueInstance` no longer
      exists in V2.
    - Replaces `listeners.click` in the options for `shallowMount` with
      `props.onClick` because the interface of the options has changed
      in V2.
    - Replaces `wrapper.contains` with a combination of `wrapper.find`
      and `exists` because `wrapper.contains` no longer exists in V2.
    - Awaits `wrapper.setProps` to make sure new properties are applied
      before testing subsequent assertions.
    - Updates the snapshot. I did not see any problem with the new
      snapshot.

issue #1
kikuomax added a commit that referenced this issue Jul 18, 2023
- Updates the unit tests (spec) of `Checkbox` so that they can work with
  Vue 3 and `@vue/test-utils` V2:
    - Replaces `wrapper.name()` with `wrapper.vm.$options.name` because
      `wrapper.name` no longer exists in V2.
    - Replaces the test on `wrapper.isVueInstance()` with presence of
      `wrapper.vm` because `wrapper.isVueInstance` no longer exists in
      V2.
    - Awaits `wrapper.setProps` to make sure subsequent tests verify new
      props.
    - Corrects v-model bindings:
        - property: `value` → `modelValue`
        - event: `input` → `update:modelValue`
    - Refreshes the snapshot. I did not see any problems in the new
      snapshot.

issue #1
kikuomax added a commit that referenced this issue Jul 18, 2023
- Updates the unit tests (spec) of `CheckRadioMixin` so that they can
  work with Vue 3 and `@vue/test-utils` V2:
    - Awaits `wrapper.setProps` to make sure that the subsequent tests
      verify new props.
    - Corrects v-model binding: `value` → `modelValue`
    - Replaces `attachToDocument: true` in the option for `shallowMount`
      with `attachTo: document.body`, because `attachToDocument` no
      longer exists in V2.

issue #1
kikuomax added a commit that referenced this issue Jul 19, 2023
- Updates the unit tests (spec) of `CheckboxButton` so that they can
  work with Vue 3 and `@vue/test-utils` V2:
    - Replaces `wrapper.name()` with `wrapper.vm.$options.name` because
      `wrapper.name` no longer exists.
    - Replaces the test on `wrapper.isVueInstance()` with presence of
      `wrapper.vm` because `wrapper.isVueInstance` no longer exists.
    - Replaces `wrapper.contains` with a combination of `wrapper.find`
      and `exists` because `wrapper.contains` no longer exists.
    - Corrects the v-model binding:
        - property: `value` → `modelValue`
        - event: `input` → `update:modelValue`
    - Awaits `wrapper.setProps` so that the subsequent tests verify new
      props.
    - Refreshes the snapshot. I did not see any problems in the new
      snapshot.

issue #1
kikuomax added a commit that referenced this issue Jul 19, 2023
- Updates the unit tests (spec) of `Input` so that they can work with
  Vue 3 and `@vue/test-utils` V2:
    - 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.
    - Awaits `wrapper.setProps` and `wrapper.setData` to make sure the
      subsequent tests verify the updated state.
    - Corrects the v-model binding: `value` → `modelValue`
    - Removes the `methods` option for `mount` because `@vue/test-utils`
      V2 no longer deals with it. Replaces the code intended to override
      `checkHtml5Validity` method `useHtml5Validation: false`.
    - Replaces the expected value for `readonly` attribute: "readonly" →
      "" (an empty string). Vue 3 no longer assigns a value to a
      boolean attribute.
    - Replaces `wrapper.find` intended to locate a Vue component with
      `wrapper.findComponent` because `wrapper.find` is dedicated to DOM
      elements in `@vue/test-utils` V2.
    - Renames `propsData` → `props` because `propsData` was deprecated.
    - Refreshes the snapshot. I did not see any problems in the new
      snapshot.

issue #1
kikuomax added a commit that referenced this issue Jul 19, 2023
- Moves `mixins` option from `shallowMount` to the definition of the
  component to be tested because the behavior is equivalent and less
  obscure.

issue #1
kikuomax added a commit that referenced this issue Jul 19, 2023
- Updates the unit tests (spec) of `FormElementMixin` so that they can
  work with `@vue/test-utils` V2.
    - Replaces `attachToDocument: true` → `attachTo: document.body`
      because `@vue/test-utils` V2 no longer deals with
      `attachToDocument`.
    - Moves `mixins` option from `shallowMount` to the definition of the
      component to be tested, because the behavior is equivalent and
      less obscure.

issue #1
@kikuomax
Copy link
Collaborator

I found a non-critical issue in FieldBody. It treated children of a div element as a slot when it created the div element. Children should have been specified as an array of elements.
https://github.com/ntohq/buefy/blob/67ecf3a8b9e1365cc51f37f20b64f85403b0ad8b/src/components/field/FieldBody.vue#L25-L47

@kikuomax
Copy link
Collaborator

I found another non-critical issue in FieldBody. I should have used a slot (() => element instead of [element]) to specify a child of b-field. The Vue runtime warned it as a potential performance issue.
https://github.com/ntohq/buefy/blob/67ecf3a8b9e1365cc51f37f20b64f85403b0ad8b/src/components/field/FieldBody.vue#L37-L44

kikuomax added a commit to kikuomax/buefy that referenced this issue Jul 20, 2023
- Removes a Vue runtime warning that indicated a potential performance
  issue related to how `FieldBody` gave the default slot to `Field`.
  Changes the third parameter of `h` function call to create a `Field`
  from a direct child `[element]` to a function slot `() => element`.

  This will address the issue pointed at in the comment:
  ntohq#1 (comment)
kikuomax added a commit that referenced this issue Jul 20, 2023
- Updates the unit tests (spec) of `FieldBody` so that it can work with
  `@vue/test-utils` V2.
    - Replaces `createLocalVue` and `localVue.component` with
      `global.components` option for `mount`, because `@vue/test-utils`
      V2 no longer provides `createLocalVue`.
    - 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.
    - Renames `propsData` to `props`, because `propsData` works but was
      removed from the API doc on `@vue/test-utils` V2.

- NOTE: the tests won't pass unless we fix the issue #5.

issue #1
kikuomax added a commit that referenced this issue Jul 21, 2023
- Updates the unit tests (spec) of `Table` so that they work with Vue 3
  and `@vue/test-utils` V2:
    - Removes `setVueInstance` because it does nothing on `buefy-next`.
    - Replaces `sinon`'s `useFakeTimers` with a combination of
      `jest.useFakeTimers` and `jest.advanceTimersByTime` so that we
      will be able to remove `sinon` from dependencies in the future.
      Awaits `$nextTick` after `jest.advanceTimersByTime` to make sure
      DOM is updated, otherwise the test fails.
    - Replaces `wrapper.find` with `wrapper.findComponent` to locate a
      component, because `wrapper.find` is dedicated to finding a DOM
      element on `@vue/test-utils` V2.
    - Replaces `isEmpty` of `Wrapper` with a combination of `element`
      and `toBeEmptyDOMElement`, because `Wrapper` no longer provides
      `isEmpty` on `@vue/test-utils` V2.
    - Replaces `contains` of `Wrapper` with a combination of `find` and
      `exists`, because `Wrapper` no longer provides `contains` on
      `@vue/test-utils` V2.
    - 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.
    - Awaits `wrapper.setProps` to make sure the subsequent tests verify
      the updated state.
    - Replaces `propsData` with `props`, because `propsData` might be
      deprecated in the future.
    - Refreshes the snapshot. I temporarily fixed the bug I found while
      updating the spec (#8) to make the snapshot.
    - NOTE: the tests won't pass until the bug is fixed:
        - #8

issue #1
kikuomax added a commit that referenced this issue Jul 25, 2023
- Updates the unit tests (spec) for `NoticeMixin` so that they can work
  with `@vue/test-utils` V2:
    - Awaits `wrapper.setProps` to make sure the subsequent tests verify
      the updated state.
    - Moves `mixins` from `shallowMount` options to the parameter of the
      component, because it is equivalent and less obscure.
    - Replaces `attachToDocument` with `attachTo`, because
      `attachToDocument` was deprecated in `@vue/test-utils` V1.

issue #1
kikuomax added a commit that referenced this issue Jul 25, 2023
- Adds two test cases to the spec for `Toast`:
    1. to verify if a programmatically opened `Toast` closes after the
       duration
    2. to verify if a indefinitely opened `Toast` can be manually closed
- Updates the spec for `Toast` so that it can work with Vue 3 and
  `@vue/test-utils` V2:
    - 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.
    - Explicitly replaces the transition built-in component with a stub
      to avoid flaky snapshots.
    - Refreshes the snapshot. I did not see any problems in the updated
      snapshot.

issue #1
@kikuomax
Copy link
Collaborator

TableMobileSort cannot be instantiated if columns prop is null or undefined. The unit tests for TableMobileSort crashed due to this bug. I do not think users face this bug because TableMobileSort is internally used by Table where columns should not be null or undefined. So I won't create a separate issue but will patch it in this issue.

@kikuomax
Copy link
Collaborator

TableMobileSort cannot be instantiated if columns prop is null or undefined. The unit tests for TableMobileSort crashed due to this bug. I do not think users face this bug because TableMobileSort is internally used by Table where columns should not be null or undefined. So I won't create a separate issue but will patch it in this issue.

There are more bugs related to this in TableMobileSort. But again, users should not face the bug.

@kikuomax
Copy link
Collaborator

kikuomax commented Jul 27, 2023

I found the following code crashed if trigger did not exist; i.e., inline prop was true:

if (this.$refs.trigger !== undefined) {
const children = this.$refs.trigger.querySelectorAll('*')
for (const child of children) {
if (el === child) {
return true
}
}
}

The cause was that this.$refs.trigger became null instead of undefined (maybe changed behavior from Vue 2 → Vue 3), and null passed the test this.$refs.trigger !== undefined. Then this.$refs.trigger.querySelectorAll('*') ended up with a crash.

However, this only happens in unit tests because the above code in the isInWhiteList method is run when inline is false; i.e., trigger is never null. So users won't face the error.

I will correct the code in this issue anyway.

kikuomax added a commit that referenced this issue Jul 27, 2023
- Introduces a new test case that tests a programmatically opened
  `Modal`. It tests if a DOM element with `modal` class is created after
  `open` and removed after `close`.
- Splits the test case "emit events on close" so that each separated
  test case makes more sense:
    1. "emit events on close but stay active": tests if "close" event is
       emitted when `close` is called.
    2. "should be deactivated on close if programmatic": tests if
       `programmatic` `Modal` turns off `isActive` when `close` is
       called. No longer tests destruction of the component because
       `$destroy` is no longer available on Vue 3. A related test is
       moved to the new test case "should be able to be manually
       closed".
- Updates other test cases for `Modal` so that they can work with
  `@vue/test-utils` V2:
    - Awaits `setProps` to make sure the subsequent tests verify the
      updated state.
    - 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.
    - Renames `propsData` in the options for `shallowMount` to `props`
      because `propsData` might be deprecated in the future.
    - Refreshes the snapshot. The `transition` component becomes a stub
      to avoid potentially flaky snapshots. I did not see any problems
      in the updated snapshot.

issue #1
kikuomax added a commit that referenced this issue Jul 27, 2023
- Updates the unit tests (spec) of `TableColumn` so that they can work
  with `@vue/test-utils` V2:
    - Replaces `find` with `findComponent` because `find` is dedicated
      to DOM elements on `@vue/test-utils` V2.
    - 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 `sync` option for `mount` because it no longer exists
      in `@vue/test-utils`. It neither has any effect.

issue #1
kikuomax added a commit that referenced this issue Jul 27, 2023
- Updates the unit tests (spec) of `TableMobileSort` so that they can
  work with `@vue/test-utils` V2:
    - Awaits `wrapper.setProps` to make sure the subsequent tests verify
      the updated state. Also replaces an old style async test case with
      async/await syntax.
    - 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 `sync` option for `shallowMount` because it no longer
      exists in `@vue/test-utils` V2 and has no effect.

  The tests won't pass until the issue mentioned in the following
  comment is fixed:
    - #1 (comment)

issue #1
kikuomax added a commit that referenced this issue Jul 27, 2023
- Fixes the issue where `TableMobileSort` crashed at initialization if
  `columns` was `null` or `undefined`. This happened in unit tests. I do
  not think users of Buefy face this issue.

issue #1 (comment)
kikuomax added a commit that referenced this issue Jul 27, 2023
- Updates the unit tests (spec) of `Icon` so that they can work with
  `@vue/test-utils` V2:
    - Awaits `wrapper.setProps` to make sure the subsequent tests verify
      the updated state.
    - 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.
    - Replaces `propsData` option for `shallowMount` with `props`
      because `propsData` might be deprecated in the future.

issue #1
kikuomax added a commit that referenced this issue Jul 27, 2023
- Updates the unit tests (spec) of `Dropdown` so that they can work with
  Vue 3 and `@vue/test-utils` V2:
    - Corrects v-model binding:
        - property: `value` → `modelValue`
        - event: `input` → `update:modelValue`
    - Replaces direct modification of data with `wrapper.setData` and
      awaits it to make sure the subsequent tests verify the updated
      state.
    - Awaits `wrapper.setProps` to make sure the subsequent tests verify
      the updated state.
    - Replaces `wrapper.destroy` with `wrapper.unmount` because it was
      renamed in `@vue/test-utils` V2.
    - 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 code that tries to unset `$refs.dropdownMenu` and
      `$refs.trigger` because they do not work (I got warnings).
      Instead, adds a new test case that removes `$refs.trigger` by
      turning on `inline` prop. No test case to remove
      `$refs.dropdownMenu` because it won't be removed.
    - Removes `jest.useFakeTimers` calls that should not have any
      effects.
    - Refreshes the snapshot. I did not see any problems in the updated
      snapshot.

- The tests won't pass until the issue mentioned in the following
  comment is addressed:
    - #1 (comment)

issue ntohq/buefy-test#1
wesdevpro pushed a commit that referenced this issue Sep 15, 2023
* test(lib): update Timepicker spec

- Updates the unit tests (spec) of `Timepicker` so that they can work
  with Vue 3 and `@vue/test-utils` V2:
    - Prevents the following components from becoming stubs because
      default slots in a stub are no longer rendered on
      `@vue/test-utils` V2:
        - `Dropdown`
        - `DropdownItem`
        - `Field`
        - `Select`

      The snapshot and test case "disables hour if no selectable minutes
      available" depend on slots in `Select`.
    - Updates expected values of "disabled" attribute, because Vue 3
      changed treatment of boolean attributes:
        - disabled: "disabled" → ""
        - not disabled: non "disabled" → undefined
    - Awaits `wrapper.setProps` to make sure the subsequent tests verify
      the updated state.
    - 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.
    - Refreshes the snapshot. I did not find any problems in the updated
      snapshot.

issue #1

* test(lib): update TimepickerMixin spec

- Updates the unit tests (spec) of `TimepickerMixin` so that they can
  work with `@vue/test-utils` V2:
    - Corrects a v-model binding:
        - event: `input` → `update:modelValue`
    - Moves the `mixins` option for `shallowMount` to the component's
      definition. Because it is more straightforward.
    - Replaces `attachToDocument` with `attachTo: document.body`,
      because `attachToDocument` might be deprecated in the future.
    - Replaces legacy async test cases with async functions.

issue #1
wesdevpro pushed a commit that referenced this issue Sep 16, 2023
- Updates the unit tests (spec) of `Datetimepicker` so that they can
  work with Vue 3 and `@vue/test-utils` V2:
    - Corrects v-model bindings:
        - property: `value` → `modelValue`
        - event: `input` → `update:modelValue`
    - Sets the locale "en-US" to produce predictable outputs. Replaces
      the expected outputs because I was not able to reproduce the old
      values:
        - "2019-10-1 08:30" → "10/1/2019, 8:30 AM"
    - Replaces `wrapper.find` with `findComponent` because `find` is
      dedicated to DOM elements on `@vue/test-utils` V2.
    - Awaits `wrapper.setProps` to make sure the subsequent tests verify
      the updated state.
    - 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.
    - Replaces `propsData` option for `shallowMount` or `mount` with
      `props` because `propsData` might be deprecated in the future.
    - Makes `transition` a stub because whether `transition` is a stub
      or not does not matter to the test results.
    - Removes `sync` option for `mount`, because it has no effect and is
      unnecessary on `@vue/test-utils` V2.
    - We see warnings until we fix the issue #23

issue #1
wesdevpro pushed a commit that referenced this issue Sep 16, 2023
- Updates the unit tests (spec) of `Image` so that they work with
  `@vue/test-utils` V2:
    - Awaits `wrapper.setProps` to make sure the subsequent assertions
      verify the updated state.
    - 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 loger exists in
      `@vue/test-utils` V2.
    - Renames `propsData` for `shallowMount` to `props` because
      `propsData` might be deprecated in the future.
    - Refreshes the snapshots. To reproduce results closer to the legacy
      snapshots, prevents `Transition`s from becoming stubs; see
      `snapshotOptions`. This removes `name` attributes related to
      `Transition` from snapshots, though, I believe testing how `img`
      element is represented is more important.
      Awaits `$nextTick` before taking snapshot so that computed values
      are reflected to DOM.

issue #1
wesdevpro pushed a commit that referenced this issue Sep 16, 2023
* test(lib): update Tabs spec

- Updates the unit tests (spec) of `Tabs` so that they can work with
  `@vue/test-utils` V2:
    - Directly mounts `BTabs` instead of mounting `WrapperComp` that
      wraps `BTabs` inside. An equivalent setup is built with `slots`
      and `global.components`.
    - Replaces v-model bindings:
        - property: `value` → `modelValue`
        - event: `input` → `update:modelValue`
    - Replaces a direct data modification with `wrapper.setData` and
      awaits it to make sure the subsequent tests verify the updated
      state.
    - Awaits `wrapper.setProps` to make sure the subsequent tests
      verify the updated state.
    - Replaces `wrapper.find` with `findComponent` to locate a component
      because `find` is dedicated to DOM elements on `@vue/test-utils`
      V2.
    - 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.
    - Refreshes the snapshot. Owners of "role" attributes move because
      they have changed since the last snapshot update. So it is fine.

issue #1

* test(lib): update TabItem spec

- Updates the unit tests (spec) of `TabItem` so that they verify the new
  behavior:
    - "will recompute indexes when a sibling gets removed" →
      "will retain indexes when a sibling gets removed" because indexes
      are no longer updated
    - "should assign new index when tab is added after removal" tests if
      an incremental index is assigned every time a new item is mounted
- Updates the unit tests (spec) of `TabItem` so that they can work with
  Vue 3 and `@vue/test-utils` V2:
    - "doesn\'t render when parent has destroyOnHide" mounts `BTabItem`
      with a mocked parent instead of `BTabs` containing `BTabItem`,
      because we cannot modify props of a component that is not directly
      mounted. The expected HTML of an unmounted item becomes
      `undefined` → an empty string, because Vue 3 looks changed the
      behavior.
    - "unregisters when destroyed" introduces a new prop `value` to
      indirectly modify `BTabs`'s `modelValue` via `v-model`, because we
      can no longer set props of a component that is not directly
      mounted.
    - simplifies "doesn\'t mount when it has no parent" because:
        - simple `BTabItem` can be directly mounted
        - I do not think `console.error` needs to be suppressed
    - Replaces `find` to locate a component with `findComponent` because
      `find` is dedicated to DOM elements on `@vue/test-utils` V2.
    - Replaces direct modification of data with `wrapper.setData` and
      awaits it to make sure the subsequent tests verify the updated
      state.
    - 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 unnecessary `await wrapper.vm.$nextTick()` by awaiting
      `wrapper.setProps`.
    - Replaces the snapshot. I did not see any problems with the updated
      snapshot.

issue #1
wesdevpro pushed a commit that referenced this issue Sep 16, 2023
* test(lib): update Colorpicker spec

- Updates the unit test (spec) of `Colorpicker` so that they can work
  with `@vue/test-utils` V2:
    - Refreshes the snapshot. Prevents some components from becoming
      stubs to better reproduce the legacy snapshot. This is necessary
      because `@vue/test-utils` V2 no longer renders the default slot of
      stubs. The legacy and new snapshots still look different, though,
      I believe they are essentially the same. The snapshot won't match
      until we address the issue #36.

issue #1

* test(lib): update ColorpickerAlphaSlider spec

- Updates the unit test (spec) of `ColorpickerAlphaSlider`:
    - Replaces `propsData` for `shallowMount` with `props` because
      `propsData` might be deprecated in the future.
    - Refreshes the snapshot. I did not find any problems in the updated
      snapshot.

issue #1

* test(lib): update ColorpickerHSLRepresentationSquare spec

- Updates the unit test (spec) of `ColorpickerHSLRepresentationSquare`:
    - Replaces `propsData` option for `shallowMount` with `props`
      because `propsData` might be deprecated in the future.
    - Refreshes the snapshot. I did not find any problems in the updated
      snapshot.

issue #1

* test(lib): update ColorpickerHSLRepresentationTriangle spec

- Updates the unit test (spec) of `ColorpickerHSLRepresentationTriangl`:
    - Replaces `propsData` option for `shallowMount` with `props`
      because `propsData` might be deprecated in the future.
    - Refreshes the snapshot. I did not find any problems in the new
      snapshot.

issue #1
wesdevpro pushed a commit that referenced this issue Sep 16, 2023
* test(lib): update Radio spec

- Updates the unit tests (spec) of `Radio` so that they can work with
  `@vue/test-utils` V2:
    - Corrects the v-model bindings:
        - property: `value` → `modelValue`
        - event: `input` → `update:modelValue`
    - Replaces `wrapper.contains` with a combination of `find` and
      `exists` because `wrapper.contains` no longer exists in
      `@vue/test-utils` V2.
    - Awaits `wrapper.setProps` to make sure the subsequent tests verify
      the updated state.
    - Replaces the legacy async test case "method focus() gives focus to
      the input element" with an async function.
    - 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.
    - Refreshes the snapshot. I did not see any problems in the updated
      snapshot.

issue #1

* test(lib): update RadioButton spec

- Updates the unit tests (spec) of `RadioButton` so that they can work
  with `@vue/test-utils` V2:
    - Correct v-model bindings:
        - property: `value` → `modelValue`
        - event: `input` → `update:modelValue`
    - Replaces `wrapper.contains` with a combination of `find` and
      `exists` because `wrapper.contains` no longer exists in
      `@vue/test-utils` V2.
    - Awaits `wrapper.setProps` to make sure the subsequent tests verify
      the updated state.
    - 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.
    - Replaces a legacy async test case with an async function.
    - Refreshes the snapshot. I did not see any problems in the updated
      snapshot.

issue #1
wesdevpro pushed a commit that referenced this issue Sep 16, 2023
- Updates the unit tests (spec) of `Switch` so that they can work with
  `@vue/test-utils` V2:
    - Corrects v-model bindings:
        - property: `value` → `modelValue`
        - event: `input` → `update:modelValue`
    - Replaces `wrapper.contains` with a combination of `find` and
      `exists` because `wrapper.contains` no longer exists in
      `@vue/test-utils` V2.
    - Awaits `wrapper.setProps` to make sure the subsequent tests verify
      the updated state.
    - 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.
    - Replaces a legacy async test case with an async function.
    - Refreshes the snapshot. I did not see any problems in the updated
      snapshot.

issue #1
wesdevpro pushed a commit that referenced this issue Sep 16, 2023
* test(lib): update Clockpicker spec

- Updates the unit tests (spec) of `Clockpicker` so that they can work
  with `@vue/test-utils` V2:
    - Awaits `wrapper.setProps` to make sure the subsequent tests verify
      the updated state.
    - Replaces direct data modification with `wrapper.setData` and
      awaits it to make sure the subsequent tests verify the updated
      state.
    - 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.
    - Replaces `propsData` option for `shallowMount` with `props`
      because `propsData` might be deprecated in the future.
    - Refreshes the snapshot. Prevents `b-dropdown` from becoming a stub
      to reproduce a snapshot closer to the legacy one, because default
      slots in a stub are no longer rendered on `@vue/test-utils` V2. I
      did not find any problems in the updated snapshot.

issue #1

* test(lib): update ClockpickerFace spec

- Updates the unit tests of `ClockpickerFace` so that they can work with
  `@vue/test-utils` V2:
    - Awaits `wrapper.setProps` to make sure the subsequent tests verify
      the updated state.
    - Replaces direct data modification with `wrapper.setData` and
      awaits it to make sure the subsequent tests verify the updated
      state.
    - 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.
    - Replaces `propsData` option for `shallowMount` with `props`
      because `propsData` might be deprecated in the future.
    - Refreshes the snapshot. I did not find any problems in the updated
      snapshot.

issue #1
wesdevpro pushed a commit that referenced this issue Sep 16, 2023
- Updates the unit tests (spec) of `Dialog` so that they can work with
  `@vue/test-utils` V2 and the breaking change:
    - Renames `onConfirm` prop to `confirmCallback` because Buefy for
      Vue 3 replaced it to avoid conflict with event listeners.
    - The following test cases also verify if a "confirm" event is
      emitted:
        - "close on confirm"
        - "closeOnConfirm prop equals false"
    - Awaits `wrapper.setProps` to make sure the subsequent tests verify
      the updated state.
    - Replaces a legacy async test case with an async function.
    - 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.

issue #1
wesdevpro pushed a commit that referenced this issue Sep 16, 2023
* test(lib): update MessageMixin spec

- Updates the unit tests (spec) of `MessageMixin` so that they can work
  with `@vue/test-utils` V2 and the breaking change:
    - Corrects a v-model binding: `active` → `modelValue`
    - Awaits `wrapper.setProps` to make sure the subsequent tests verify
      the updated state.
    - Replaces legacy async test cases with async functions.
    - Moves `mixins` option for `shallowMount` to the template
      parameters, because it is a more straightforward way to do the
      same thing.

issue #1

* test(lib): update Message spec

- Updates the unit tests (spec) of `Message` so that they can work with
  `@vue/test-utils` V2:
    - 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.
    - Refreshes the snapshot. I did not find any problems in the updated
      snapshot.

issue #1
wesdevpro pushed a commit that referenced this issue Sep 16, 2023
* test(lib): update Navbar spec

- Updates the unit tests (spec) of `Navbar` so that they can work with
  `@vue/test-utils` V2 and breaking changes:
    - Corrects v-model bindings:
        - property: `active` → `modelValue`
        - event: `update:active` → `update:modelValue`
    - Replaces `wrapper.contains` with a combination of `find` and
      `exists` because `wrapper.contains` no longer exists in
      `@vue/test-utils` V2.
    - Awaits `wrapper.setProps` and `wrapper.trigger` to make sure the
      subsequent tests verify the updated state.
    - Replaces the test on `wrapper.isVueInstance()` with presence of
      `wrapper.vm` because `wrapper.isVueInstance` no longer exists in
      `@vue/test-utils` V2.
    - Replaces `propsData` for `mount` with `props` because `propsData`
      might be deprecated in the future.
    - Refreshes the snapshot. I did not find any problems in the updated
      snapshot. However, the snpshot won't match until we fix the issue
      #29.
    - The tests won't pass until we fix the issue #28.

issue #1

* test(lib): update NavbarBurger spec

- Updates the unit tests (spec) of `NavbarBurger` so that they can work
  with `@vue/test-utils` V2:
    - Specifies the element tag to the selector given to `wrapper.find`
      instead of testing the tag with `is`. Because `is` no longer
      exists in `@vue/test-utils` V2.
    - Awaits `wrapper.setProps` to make sure the subsequent assertions
      verify the updated state.
    - Replaces the test on `wrapper.isVueInstance()` with presence of
      `wrapper.vm` because `wrapper.isVueInstance` no longer exists in
      `@vue/test-utils` V2.
    - Refreshes the snapshot. I did not find any problems in the updated
      snapshot. However, the snapshot won't match until we fix the issue
      #29.

issue #1

* test(lib): update NavbarItem spec

- Updates the unit tests (spec) of `NavbarItem` so that they can work
  with `@vue/test-utils` V2 and Vue 3:
    - Replaces `listeners` option for `shallowMount` with `on{event}`
      props, because `listeners` no longer works on `@vue/test-utils` V2
      but `on{event}` prop does the equivalent job on Vue 3 instead.
    - Mounts `stubBNavBar` and inserts `BNavbarItem` into its default
      slot instead of specifying `stubBNavBar` as `parentComponents`,
      because `parentComponents` no longer works on `@vue/test-utils`
      V2.
    - Replaces `wrapper.contains` with a combination of `find` and
      `exists` because `wrapper.contains` no longer exists in
      `@vue/test-utils` V2.
    - A test on a tag name is merged with a selector given to `find`.
    - Awaits `wrapper.setProps` to make sure the subsequent assertions
      verify the updated state.
    - 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.
    - Fixes the event type for "click": `KeyboardEvent` → `MouseEvent`.
    - Replaces `sinon.stub` with `jest.fn`. No longer imports `sinon`.

issue #1

* test(lib): update NavbarDropdown spec

- Updates the unit tests (spec) of `NavbarDropdown` so that they can
  work with `@vue/test-utils` V2:
    - Awaits `wrapper.setProps` to make sure the subsequent assertions
      verify the updated state.
    - 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 loger exists in
      `@vue/test-utils` V2.
    - Refreshes the snapshot. I found the updated snapshot had two
      `div` elements with `navbar-dropdown` class, but this is fine
      because they were introduced after the old snapshot was recorded.

issue #1
wesdevpro pushed a commit that referenced this issue Sep 16, 2023
- Updates the unit tests (spec) of `Notification` so that they can work
  with `@vue/test-utils` V2:
    - 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.
    - Refreshes the snapshot. I did not find any problems in the updated
      snapshot.

issue #1
wesdevpro pushed a commit that referenced this issue Sep 16, 2023
- Updates the unit tests (spec) of `Snackbar` so that they can work with
  `@vue/test-utils` V2:
    - 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.
    - Replaces a legacy async test case with an async function.
    - Replaces `attachToDocument: true` option for `shallowMount` with
      `attachTo: document.body` because `attachToDocument` is no longer
      effective on `@vue/test-utils` V2.
    - Replaces `propsData` option for `shallowMount` with `props`
      because `propsData` might be deprecated in the future.
    - Refreshes the snapshot. I did not find any problems in the updated
      snapshot.

issue #1
wesdevpro pushed a commit that referenced this issue Sep 16, 2023
- Reimplements the unit tests for a programmatically opened `Loading` to
  address the breaking changes and do more realistic tests:
    - Uses the actual `open` method of `LoadingProgrammatic`.
    - Tests if `Loading` is opened or closed by querying an element with
      `loading-overlay` class.
    - Tests if `Loading` fills the full page by querying an element with
      `is-full-page` class.
    - Uses `transformVNodeArgs` to reset all the stubs introduced by
      `@vue/test-util`, otherwise every `BLoading` will become a stub,
      and tests will fail.
- Updates the unit tests (spec) of `Loading` so that they can work with
  `@vue/test-utils` V2:
    - Corrects v-model bindings:
        - property: `active` → `modelValue`
        - event: `update:active` → `update:modelValue`
    - Awaits `wrapper.setProps` to make sure the subsequent tests verify
      the updated state.
    - Replaces direct data modification with `wrapper.setData` and
      awaits it to make sure the subsequent tests verify the updated
      state.
    - 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.
    - Replaces a legacy async test case with an async function.
    - Leaves `transition` as a stub because it does not matter to the
      test results.
    - Refreshes the snapshot. I did not find any problems in the updated
      snapshot.

issue #1
wesdevpro pushed a commit that referenced this issue Sep 16, 2023
* test(lib): update Steps spec

- Updates the unit tests (spec) of `Steps` so that they can work with
  `@vue/test-utils` V2 and the breaking changes:
    - Directly mounts `BSteps` instead of wrapping it in a dummy
      component. Because `setProps` works only on the directly mounted
      wrapper component on `@vue/test-utils` V2. Explicitly specifies
      the values of `BStepItems` to make the snapshot reproducible. This
      is due to a breaking change of Buefy for Vue 3.
    - Removes the test case "throws an error when there is no item"
      because `Steps` won't throw even if there is no child. Please note
      that it stopped working at some point before the migration to Vue
      3. It also had a flaw to pass a wrong outcome.
    - Corrects v-model bindings:
        - property: `value` → `modelValue`
        - event: `input` → `update:modelValue`
    - Awaits `wrapper.setProps` to make sure the subsequent tests verify
      the updated state. Replaces some `wrapper.vm.$nextTick` calls.
    - Replaces direct data modification with `wrapper.setData` and
      awaits it. Replaces a `wrapper.vm.$nextTick` call.
    - 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.
    - Refreshes the snapshot. I did not find any problems in the updated
      snapshot.

issue #1

* test(lib): update StepItem spec

- Updates the unit tests (spec) of `StepItem` so that they can work with
  `@vue/test-utils` V2 and the breaking change:
    - Replaces `find` of `Wrapper` with `findComponent` because `find`
      is dedicated to a DOM element on `@vue/test-utils` V2.
    - Replaces the test case "doesn't mount when it has no parent" with
      a single `expect(...).toThrow` assertion. The old test also had a
      flaw to pass an unexpected outcome. Removes the spy on
      `global.console` because it does not matter to the test results.
    - 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 `sync` option for `mount` because it has no effect and
      unnecessary on `@vue/test-utils` V2.
    - Refreshes the snapshot. Specifies the values for `StepItem`s to
      make the snapshot reproducible. This is necessary due to the
      breaking change of Buefy for Vue 3. I did not find any problems in
      the updated snapshot.

issue #1
wesdevpro pushed a commit that referenced this issue Sep 16, 2023
- Reimplements the test case "increments/decrements on long pressing
  exponentially" due to its flaky results. It used to use the real timer
  to simulate a long press, however, this depended on the machine
  running the test. It now uses Jest's fake timer to make the test case
  deterministic. There were subtle details I had to take into account to
  confidently wrote a test:
    - Jest's fake `setTimeout` truncates a given `delay` to an extact ms
      when it schedules a callback.
    - `jest.advanceTimersByTime` also truncates a given `msToRun` but
      accumulates the remainders. It advances an extra millisecond when
      the accumulated remainders becomes large enough.
    - I decided to floor the input for `jest.advanceTimersByTime` to
      prevent the accumulated remainder from triggering an extra
      callback. This may look counter-intuitive if you look into the
      source code of `Numberinput`, because it does not floor the delay
      before passing it to `setTimeout`. Although, according to the
      above Jest's behavior, I am confident with my decision.
- Updates the unit tests (spec) of `Numberinput` so that they can work
  with `@vue/test-utils` V2:
    - Supplies a fake component that mocks `checkHtml5Validity` as a
      stub of `b-input` in the test group "Rendered (shallow)", because
      the entire tests aborted due to missing `checkHtml5Validity`.
      In `@vue/test-utils` V1, `shallowMount` catches an error thrown
      from mounted component, warns it, and continues, but in V2, it
      bubbles the error and ends up with a crash.
    - Corrects the v-model property: `value` → `modelValue`.
    - Replaces `wrapper.contains` with a combination of `find` and
      `exists` because `wrapper.contains` no longer exists in
      `@vue/test-utils` V2.
    - Awaits `wrapper.setProps` to make sure the subsequent tests verify
      the updated state.
    - Replaces direct data modification with `wrapper.setData` and
      awaits it to make sure the subsequent tests verify the updated
      state.
    - 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.

issue #1
wesdevpro pushed a commit that referenced this issue Sep 16, 2023
- 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 #1
@kikuomax
Copy link
Collaborator

It is finally done!

kikuomax added a commit to kikuomax/buefy that referenced this issue Oct 10, 2023
* fix(lib): b-field-body wrapped text in b-field

- Fixes the bug that a horizontal `b-field-body` wrapped a simple text
  element with an extra `b-field`. It now returns a text element as is.

issue ntohq#5

* fix(lib): performance warning on FieldBody

- Removes a Vue runtime warning that indicated a potential performance
  issue related to how `FieldBody` gave the default slot to `Field`.
  Changes the third parameter of `h` function call to create a `Field`
  from a direct child `[element]` to a function slot `() => element`.

  This will address the issue pointed at in the comment:
  ntohq#1 (comment)

* fix(lib): remove unexpected tabindex (#9)

- Fixes the bug that `Table` ended up with `<table>` with an unexpected
  "tabindex" attribute. This bug was caused because Vue 3 no longer
  removes a boolean attribute if its value is "false". `Table` binds
  `undefined` instead of `false` to "tabindex" if `focusable` is `false`
  or not specified.

issue ntohq#8

* Publish Package @ntohq/buefy-next (#10)

* Removed CircleCi

* Created GitHub Action Workflow Files

* Added Workflow and Updated Package.json

* Update package.json (buefy#11)

* Update Package Name to `@ntohq/buefy-next` For Publishing to NPM (buefy#13)

* Update package.json

* Rename Package For Publishing to NPM

* Rename Package For Publishing to NPM

* Cleaned Up Workflow and Package.json

* Update package.json

* Renamed Workflow Folder

* Update npm_deploy.yml

---------

Co-authored-by: Kikuo Emoto <kemoto@codemonger.io>
kikuomax added a commit to kikuomax/buefy that referenced this issue Oct 10, 2023
…fy#20) (buefy#25)

* fix(lib): b-field-body wrapped text in b-field

- Fixes the bug that a horizontal `b-field-body` wrapped a simple text
  element with an extra `b-field`. It now returns a text element as is.

issue ntohq#5

* fix(lib): performance warning on FieldBody

- Removes a Vue runtime warning that indicated a potential performance
  issue related to how `FieldBody` gave the default slot to `Field`.
  Changes the third parameter of `h` function call to create a `Field`
  from a direct child `[element]` to a function slot `() => element`.

  This will address the issue pointed at in the comment:
  ntohq#1 (comment)

* fix(lib): remove unexpected tabindex (#9)

- Fixes the bug that `Table` ended up with `<table>` with an unexpected
  "tabindex" attribute. This bug was caused because Vue 3 no longer
  removes a boolean attribute if its value is "false". `Table` binds
  `undefined` instead of `false` to "tabindex" if `focusable` is `false`
  or not specified.

issue ntohq#8

* Publish Package @ntohq/buefy-next (#10)

* Removed CircleCi

* Created GitHub Action Workflow Files

* Added Workflow and Updated Package.json

* Update package.json (buefy#11)

* Update Package Name to `@ntohq/buefy-next` For Publishing to NPM (buefy#13)

* Update package.json

* Rename Package For Publishing to NPM

* Rename Package For Publishing to NPM

* Cleaned Up Workflow and Package.json

* Update package.json

* Renamed Workflow Folder

* Update npm_deploy.yml

* fix(lib): empty BMenuList crash (buefy#21)

- Fixes the bug where an empty `BMenuList` crashed with "TypeError:
  slots.default is not a function". I found `slots.default` was
  `undefined` if `BMenuList` was empty. `BMenuList` makes sure
  `slots.default` is a function before calling it, otherwise returns
  `slots.default` as is.

issue ntohq#20

* fix(lib): empty FieldBody crash (buefy#22)

- Fixes the bug where `FieldBody` crashed if no default slot was given.
  `FieldBody` makes sure that `this.$slots.default` is a function before
  calling it and not null before accesssing its fields. This is a
  potential cause of ntohq#18, but there might be other
  reasons.

issue ntohq#18

* chore: bump version to 0.1.1

---------

Co-authored-by: Wesley Ford <wes@wesdev.pro>
hirokiky pushed a commit to hirokiky/buefy that referenced this issue Feb 22, 2024
* fix(lib): b-field-body wrapped text in b-field

- Fixes the bug that a horizontal `b-field-body` wrapped a simple text
  element with an extra `b-field`. It now returns a text element as is.

issue ntohq#5

* fix(lib): performance warning on FieldBody

- Removes a Vue runtime warning that indicated a potential performance
  issue related to how `FieldBody` gave the default slot to `Field`.
  Changes the third parameter of `h` function call to create a `Field`
  from a direct child `[element]` to a function slot `() => element`.

  This will address the issue pointed at in the comment:
  ntohq#1 (comment)

* fix(lib): remove unexpected tabindex (buefy#9)

- Fixes the bug that `Table` ended up with `<table>` with an unexpected
  "tabindex" attribute. This bug was caused because Vue 3 no longer
  removes a boolean attribute if its value is "false". `Table` binds
  `undefined` instead of `false` to "tabindex" if `focusable` is `false`
  or not specified.

issue ntohq#8

* Publish Package @ntohq/buefy-next (buefy#10)

* Removed CircleCi

* Created GitHub Action Workflow Files

* Added Workflow and Updated Package.json

* Update package.json (buefy#11)

* Update Package Name to `@ntohq/buefy-next` For Publishing to NPM (buefy#13)

* Update package.json

* Rename Package For Publishing to NPM

* Rename Package For Publishing to NPM

* Cleaned Up Workflow and Package.json

* Update package.json

---------

Co-authored-by: Kikuo Emoto <kemoto@codemonger.io>
hirokiky pushed a commit to hirokiky/buefy that referenced this issue Feb 22, 2024
* fix(lib): b-field-body wrapped text in b-field

- Fixes the bug that a horizontal `b-field-body` wrapped a simple text
  element with an extra `b-field`. It now returns a text element as is.

issue ntohq#5

* fix(lib): performance warning on FieldBody

- Removes a Vue runtime warning that indicated a potential performance
  issue related to how `FieldBody` gave the default slot to `Field`.
  Changes the third parameter of `h` function call to create a `Field`
  from a direct child `[element]` to a function slot `() => element`.

  This will address the issue pointed at in the comment:
  ntohq#1 (comment)

* fix(lib): remove unexpected tabindex (buefy#9)

- Fixes the bug that `Table` ended up with `<table>` with an unexpected
  "tabindex" attribute. This bug was caused because Vue 3 no longer
  removes a boolean attribute if its value is "false". `Table` binds
  `undefined` instead of `false` to "tabindex" if `focusable` is `false`
  or not specified.

issue ntohq#8

* Publish Package @ntohq/buefy-next (buefy#10)

* Removed CircleCi

* Created GitHub Action Workflow Files

* Added Workflow and Updated Package.json

* Update package.json (buefy#11)

* Update Package Name to `@ntohq/buefy-next` For Publishing to NPM (buefy#13)

* Update package.json

* Rename Package For Publishing to NPM

* Rename Package For Publishing to NPM

* Cleaned Up Workflow and Package.json

* Update package.json

* Renamed Workflow Folder

---------

Co-authored-by: Kikuo Emoto <kemoto@codemonger.io>
hirokiky pushed a commit to hirokiky/buefy that referenced this issue Feb 22, 2024
- Updates the unit tests (spec) of `FormElementMixin` so that they can
  work with `@vue/test-utils` V2.
    - Replaces `attachToDocument: true` → `attachTo: document.body`
      because `@vue/test-utils` V2 no longer deals with
      `attachToDocument`.
    - Moves `mixins` option from `shallowMount` to the definition of the
      component to be tested, because the behavior is equivalent and
      less obscure.

issue ntohq#1
hirokiky pushed a commit to hirokiky/buefy that referenced this issue Feb 22, 2024
* test(lib): update Button spec

- Updates the unit tests (spec) of `Button` so that they can work with
  `@vue/test-utils` V2.
    - Replaces `wrapper.name()` with `wrapper.vm.$options.name` because
      `wrapper.name` no longer exists in V2.
    - Replaces the test of `wrapper.isVueInstance()` with that of
      presence of `wrapper.vm` because `wrapper.isVueInstance` no longer
      exists in V2.
    - Replaces `listeners.click` in the options for `shallowMount` with
      `props.onClick` because the interface of the options has changed
      in V2.
    - Replaces `wrapper.contains` with a combination of `wrapper.find`
      and `exists` because `wrapper.contains` no longer exists in V2.
    - Awaits `wrapper.setProps` to make sure new properties are applied
      before testing subsequent assertions.
    - Updates the snapshot. I did not see any problem with the new
      snapshot.

issue ntohq#1

* chore(lib): remove comment on Button.spec
hirokiky pushed a commit to hirokiky/buefy that referenced this issue Feb 22, 2024
* test(lib): update Input spec

- Updates the unit tests (spec) of `Input` so that they can work with
  Vue 3 and `@vue/test-utils` V2:
    - 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.
    - Awaits `wrapper.setProps` and `wrapper.setData` to make sure the
      subsequent tests verify the updated state.
    - Corrects the v-model binding: `value` → `modelValue`
    - Removes the `methods` option for `mount` because `@vue/test-utils`
      V2 no longer deals with it. Replaces the code intended to override
      `checkHtml5Validity` method `useHtml5Validation: false`.
    - Replaces the expected value for `readonly` attribute: "readonly" →
      "" (an empty string). Vue 3 no longer assigns a value to a
      boolean attribute.
    - Replaces `wrapper.find` intended to locate a Vue component with
      `wrapper.findComponent` because `wrapper.find` is dedicated to DOM
      elements in `@vue/test-utils` V2.
    - Renames `propsData` → `props` because `propsData` was deprecated.
    - Refreshes the snapshot. I did not see any problems in the new
      snapshot.

issue ntohq#1

* feat(docs): add attr pass down example for Input

- Appends an example that passes attributes `placeholder` and `readonly`
  down to the underlying `<input>` element throught `Input` to
  `ExSimple`. I have introduced this example because I wanted to make
  sure the unit test "render the placeholder and readonly attribute when
  passed" was verifying the intended behavior.
hirokiky pushed a commit to hirokiky/buefy that referenced this issue Feb 22, 2024
* test(lib): update Checkbox spec

- Updates the unit tests (spec) of `Checkbox` so that they can work with
  Vue 3 and `@vue/test-utils` V2:
    - Replaces `wrapper.name()` with `wrapper.vm.$options.name` because
      `wrapper.name` no longer exists in V2.
    - Replaces the test on `wrapper.isVueInstance()` with presence of
      `wrapper.vm` because `wrapper.isVueInstance` no longer exists in
      V2.
    - Awaits `wrapper.setProps` to make sure subsequent tests verify new
      props.
    - Corrects v-model bindings:
        - property: `value` → `modelValue`
        - event: `input` → `update:modelValue`
    - Refreshes the snapshot. I did not see any problems in the new
      snapshot.

issue ntohq#1

* test(lib): update CheckboxButton spec

- Updates the unit tests (spec) of `CheckboxButton` so that they can
  work with Vue 3 and `@vue/test-utils` V2:
    - Replaces `wrapper.name()` with `wrapper.vm.$options.name` because
      `wrapper.name` no longer exists.
    - Replaces the test on `wrapper.isVueInstance()` with presence of
      `wrapper.vm` because `wrapper.isVueInstance` no longer exists.
    - Replaces `wrapper.contains` with a combination of `wrapper.find`
      and `exists` because `wrapper.contains` no longer exists.
    - Corrects the v-model binding:
        - property: `value` → `modelValue`
        - event: `input` → `update:modelValue`
    - Awaits `wrapper.setProps` so that the subsequent tests verify new
      props.
    - Refreshes the snapshot. I did not see any problems in the new
      snapshot.

issue ntohq#1
hirokiky pushed a commit to hirokiky/buefy that referenced this issue Feb 22, 2024
* test(lib): update CheckRadioMixin spec

- Updates the unit tests (spec) of `CheckRadioMixin` so that they can
  work with Vue 3 and `@vue/test-utils` V2:
    - Awaits `wrapper.setProps` to make sure that the subsequent tests
      verify new props.
    - Corrects v-model binding: `value` → `modelValue`
    - Replaces `attachToDocument: true` in the option for `shallowMount`
      with `attachTo: document.body`, because `attachToDocument` no
      longer exists in V2.

issue ntohq#1

* test(lib): move mixins option (CheckRadioMixin)

- Moves `mixins` option from `shallowMount` to the definition of the
  component to be tested because the behavior is equivalent and less
  obscure.

issue ntohq#1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: ✅ Done
Development

No branches or pull requests

2 participants