Skip to content

Support global components in tests #661

@farism

Description

@farism

It does not appear that global components are mounted during tests, this would be a great feature to have.

global component Modal {
  fun method {
    true
  }

  fun render {
    <Html.Portals.Body>
      <div class="modal">
        "modal"
      </div>
    </Html.Portals.Body>
  }
}

suite "Global Component" {
  test "is mounted during tests" {
    Test.Html.start(<span/>)
    |> Test.Html.findGlobally(".modal")
  }

  test "can call methods in tests" {
    // gives runtime error (TypeError: Cannot read properties of undefined (reading 'b'))
    Modal.method()
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions