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

disabled attribute rendered with 'false' instead of '' #578

Closed
Ken-vdE opened this issue Sep 6, 2022 · 4 comments
Closed

disabled attribute rendered with 'false' instead of '' #578

Ken-vdE opened this issue Sep 6, 2022 · 4 comments
Assignees
Labels
bug Something isn't working high priority

Comments

@Ken-vdE
Copy link

Ken-vdE commented Sep 6, 2022

The original issue can be found here: vuejs/test-utils#1759

The disabled attribute gets set to 'false', which is incorrect.
The spec does not allow for false values, as per https://html.spec.whatwg.org/multipage/common-microsyntaxes.html#boolean-attributes.

The issue arises here (using Vue Test Utils):

<template>
   <component :is="type" :disabled="index > 1" @click="$emit('something')" data-testid="button"/>
</template>

And running a test like this:

const wrapper = mount(Component, { props: { type: 'button' } })
const button = wrapper.find('[data-testid="button"]')
await button.trigger('click');
expect(wrapper.emitted()).toHaveProperty('something')

Does not work because the this.attributes().disabled (in Test Utils baseWrapper) returns 'false' instead of undefined...

That means the dom was rendered incorrectly (... disabled="false" instead of not having disabled attribute).

@pkgray
Copy link

pkgray commented Oct 4, 2022

@Ken-vdE Curious why this was closed and re-opened as a vuejs/test-utils issue - I only experience this when using happy-dom and not jsdom

@Ken-vdE
Copy link
Author

Ken-vdE commented Oct 4, 2022

@pkgray you can view the mentioned issue above. More information is given there.

@pkgray
Copy link

pkgray commented Oct 13, 2022

@pkgray you can view the mentioned issue above. There, more information is given.

When I switch back to jsdom, this issue is no longer a problem, so I think it is caused by happy-dom

@capricorn86 capricorn86 added bug Something isn't working high priority labels Oct 13, 2022
@capricorn86 capricorn86 self-assigned this May 2, 2023
capricorn86 added a commit that referenced this issue May 9, 2023
…ted to parsing complex HTML. This will improve performance significantly.
capricorn86 added a commit that referenced this issue May 11, 2023
…ted to parsing complex HTML. This will improve performance significantly.
capricorn86 added a commit that referenced this issue May 11, 2023
…rendered-with-false-instead-of2

#578@minor: Refactors the XML parser, which fixes several issues rela…
@capricorn86
Copy link
Owner

Thank you for reporting @Ken-vdE and @pkgray! 🙂

The issue has been fixed now.

You can read more about the release here:
https://github.com/capricorn86/happy-dom/releases/tag/v9.11.0

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

Successfully merging a pull request may close this issue.

3 participants