Skip to content

feat: set svelte context in render fn #151

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

Closed
wants to merge 1 commit into from
Closed

feat: set svelte context in render fn #151

wants to merge 1 commit into from

Conversation

apricote
Copy link

@apricote apricote commented Jun 11, 2021

Fixes #118
Fixes #136

Description

Support passing the svelte component context in componentOptions.

Previously one had to write a wrapper component that could set the context.

Usage

<!-- Test.svelte -->
<script lang="ts">
  import { getContext } from "svelte";

  const foo = getContext("foo");

  console.log({ foo });
</script>

{foo}
// Test.test.ts
import { render } from "@testing-library/svelte";
import Test from "./Test.svelte";

it("gets context", () => {
  render(Test, { context: new Map([["foo", "bar"]]) });
});

@hexagonrecursion
Copy link

Please merge this. I need this. What is the roadblock?

@hexagonrecursion
Copy link

@cbxp
Copy link

cbxp commented Sep 21, 2021

Please merge

@sebastianrothe
Copy link
Collaborator

What is the problem with this PR?

@apricote
Copy link
Author

As far as I know, there is no problem. This library just does not seem to be actively maintained. I previously asked for a review in the Discord channel, but got no answer there either.

@sebastianrothe
Copy link
Collaborator

Okay, can someone from the maintainers add (@apricote or @yanick), so we can proceed? @benmccann

Referencing #182 as well, because it has some tests in it.

@yanick
Copy link
Collaborator

yanick commented Feb 14, 2022

For what it's worth, if we want to go with this PR, I'm totally game to rebase my tests on it.

@sebastianrothe
Copy link
Collaborator

sebastianrothe commented Feb 14, 2022

For what it's worth, if we want to go with this PR, I'm totally game to rebase my tests on it.

Nah, your PR is the same, but with tests included. Your PR should be favored. This one should be closed. Also this one here is out of date.

@apricote
Copy link
Author

Closing in favor of #182 that also includes test for the functionality.

@apricote apricote closed this Feb 15, 2022
@sebastianrothe
Copy link
Collaborator

Thank you :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

support context options? Specify/mock context
5 participants