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

Horizontal <b-field> wrapped a simple text element with an extra <b-field> #5

Closed
kikuomax opened this issue Jul 20, 2023 · 1 comment · Fixed by #6
Closed

Horizontal <b-field> wrapped a simple text element with an extra <b-field> #5

kikuomax opened this issue Jul 20, 2023 · 1 comment · Fixed by #6
Labels
bug Something isn't working

Comments

@kikuomax
Copy link
Collaborator

Overview of the problem

Buefy version: buefy-next (67ecf3a)
Vuejs version: 3.3.4
OS/Browser: macOS/@vue/test-utils, Safari

Description

A horizontal <b-field> wrapped a simple text element with an extra <b-field> when the text element was specified to its default slot.

Steps to reproduce

<b-field :horizontal="true">content</b-field>

I encountered this while working on unit tests:

Expected behavior

<div class="field is-horizontal">
  <div class="field-label"></div>
  <div class="field-body">content</div>
</div>

Actual behavior

<div class="field is-horizontal">
  <div class="field-label"></div>
  <div class="field-body">
    <div class="field">content</div>
  </div>
</div>
@kikuomax kikuomax added the bug Something isn't working label Jul 20, 2023
kikuomax added a commit to kikuomax/buefy that referenced this issue Jul 20, 2023
- 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
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
Copy link
Collaborator Author

This was fixed in PR #12.

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
* test(lib): update FieldBody spec

- 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 ntohq#5.

issue ntohq#1

* test(lib): update Field spec

- Updates the unit tests (spec) of `Field` so that they can work with
  Vue 3 and `@vue/test-utils` V2:
    - Replaces `localVue` with `global.components` option for `mount`
      and `shallowMount` because `createLocalVue` no longer exists in
      `@vue/test-utils` V2.
    - Changes the definition of the test
      "messages are passed down to the message slot" due to the
      difference between Vue 2 and 3 in how it stringifies an array in a
      template expression.
    - Awaits `wrapper.setProps` to make sure the subsequent tests will
      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` and `mount` with
      `props` because `propsData` might be deprecated in the future.
    - Refreshes the snapshot. I did not see any problems in the new
      snapshot.

issue ntohq#1

* test(lib): add test case for FieldBody

- Adds a new test case for `FieldBody`, which instantiates a `FieldBody`
  without the default slot.

  This test won't pass until the issue mentioned in the following
  comment:
    - ntohq#18 (comment)

issue ntohq#1 (comment)

* test(lib): update FieldBody spec

- Fixes an assertion that tested nothing:
  `exists` → `findComponent` + `exists`

issue ntohq#1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant