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

Support global components in tests #661

Closed
farism opened this issue Sep 16, 2023 · 0 comments
Closed

Support global components in tests #661

farism opened this issue Sep 16, 2023 · 0 comments
Labels
bug Something isn't working
Milestone

Comments

@farism
Copy link
Contributor

farism commented Sep 16, 2023

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()
  }
}
@Sija Sija added the bug Something isn't working label Sep 16, 2023
@gdotdesign gdotdesign added this to the 0.21.0 milestone Nov 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Development

No branches or pull requests

3 participants