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

v13.6.2->13.7.0 missing some of my events from vue app #1409

Open
VividLemon opened this issue Apr 14, 2024 · 1 comment
Open

v13.6.2->13.7.0 missing some of my events from vue app #1409

VividLemon opened this issue Apr 14, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@VividLemon
Copy link

Describe the bug
A clear and concise description of what the bug is.

During a change from v13 to v14, I noticed that my tests had randomly broke. I assumed it was something internally, but when regressing back my package.json, everything worked fine. I pushed each version one by one until I found it was v14 of happy dom.

To Reproduce

I have the two following components:

child:

<script setup lang="ts">
const localValue = defineModel<string>({default: ''})
</script>

<template>
  <input
      v-model="localValue"
      id="foo"
      type="checkbox"
    />
    <label>
      <slot />
    </label>
</template>

parent:

<script setup lang="ts">
import HelloWorld from './components/HelloWorld.vue'
</script>

<template>
  <HelloWorld @update:model-value="console.log('modelvalue change', $event)" />
</template>

When done rawly in the browser (firefox) document.getElementById('foo').click() I get modelvalue change false This is correct.

However, when I go to my test:

describe('HelloWorld', () => {
  it('renders properly', async () => {
    const wrapper = mount(HelloWorld, { props: { modelValue: '' } })
    await wrapper.get('input').trigger('click')
    expect(wrapper.emitted()).toHaveProperty('update:modelValue')
  })
})

This should not be failing.

What's perplexing is that in my example reproduction, I don't get anything in the test. All versions seem to fail... Unlike the main repository just failing between those two versions:
vue-project.zip

As said, in my real repository, I'm only seeing the issue when going between 13.6.2->13.7.0 at https://github.com/bootstrap-vue-next/bootstrap-vue-next/blob/6ea759874fd41d3da08ae3cafee052e19b3e51e1/packages/bootstrap-vue-next/src/components/BFormCheckbox/form-checkbox.spec.ts#L600

It may be more useful to pull that repository, and view the issue there. For now, I'm going to keep the happy-dom version on 13.6.2. The issue exists in v14 latest

Expected behavior
A clear and concise description of what you expected to happen.

The emitted() return should have update:modelValue as a key in the object -- it should not be undefined, and the test should pass.

Screenshots
If applicable, add screenshots to help explain your problem.

image
v13.6.2

image
v13.7.0

Device:

  • OS: [e.g. iOS]
  • Browser [e.g. chrome, safari]
  • Version [e.g. 22]

Additional context
Add any other context about the problem here.

@dbritto-dev
Copy link

dbritto-dev commented Apr 15, 2024

@capricorn86 I'm facing the same issue, some changes added in v13.7.0 broke a bunch of my tests

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

No branches or pull requests

2 participants