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

Add a component parameter builder or make param helpers more easily accessible #36

Closed
egil opened this issue Jan 18, 2020 · 0 comments
Closed
Labels
enhancement New feature or request

Comments

@egil
Copy link
Member

egil commented Jan 18, 2020

Related to #5, where support for new test libs is planned, it will probably be a good idea to make it easier for users wanting to pass parameters to CUTs to do so without having to inherit from a base class in their tests, e.g. following the pattern of:

public void TestMethod()
{
    using var ctx = new TestContext();
    var params = new ComponentParameterBuilder(this) // 'this' might be needed to capture the execution context for callback parameters.
        .With("name", value)
        .WithCallback("name", () => {})
        .WithCascadingValue(obj)
        .WithChildContent("<p>hello world</p>")
        // ... etc
        .Build(); // Build could be done implicitly through a implicit conversion to ComponentParameter[]
    ctx.RenderComponent(params);
}
@egil egil added the enhancement New feature or request label Jan 18, 2020
@egil egil added this to the beta-7 milestone May 1, 2020
@egil egil closed this as completed May 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant