8000 Stimulus controllers fail with happy-dom but work with jsdom · Issue #1813 · capricorn86/happy-dom · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Stimulus controllers fail with happy-dom but work with jsdom #1813
Open
@GibzClt

Description

@GibzClt

Describe the bug
I'm testing a UI component which has a stimulus controller attached to it. The same test works with jsdom but fails with happy-dom. The controller itself is connected but the targets are not connected.

To Reproduce
Steps to reproduce the behavior:
Try to render a component which uses Stimulus.js controllers

render(
   <div>
     <form data-controller="newtripsearchform">
       <div data-newtripsearchform-target="foo">Bar</div>
     </form>
   </div>,
);

Stimulus Controller

  class SomeClass extends Controller {
     static targets = ["foo"];

     connect(): void {
        // Working
        console.log("Connected !!");
     }

     fooTargetConnected() {
        // Not working with happy-dom, only works with jsdom
        console.log("Round trip radio input connected");
     }
  }

Since Stimulus is heavily dependent on MutationObserver API, is it because of the way happy-dom's MutationObserver API is implemented ?
https://stimulus.hotwired.dev/reference/lifecycle-callbacks#order-and-timing

Device:

  • OS: Ubuntu
  • Stack: Remix, Hotwire Stimulus, Hotwire Turbo, Vite

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0