Skip to content

Commit

Permalink
Merge branch 'stable'
Browse files Browse the repository at this point in the history
# Conflicts:
#	.github/workflows/release-preview.yml
#	.github/workflows/verification-dotnet-nightly.yml
#	.github/workflows/verification.yml
#	CHANGELOG.md
#	Directory.Build.props
#	src/Directory.Build.props
#	src/bunit.core/Extensions/WaitForHelpers/WaitForHelper.cs
#	src/bunit.core/Rendering/UnknownEventHandlerIdException.cs
#	tests/bunit.web.tests/EventDispatchExtensions/GeneralEventDispatchExtensionsTest.cs
#	version.json
  • Loading branch information
egil committed Sep 16, 2022
2 parents bf8fc00 + 9a81bc9 commit c25adbf
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions docs/site/docs/providing-input/substituting-components.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ ctx.ComponentFactories.AddStub<Bar>("<div>NOT FROM BAR</div>");

// Add the markup specified in the render fragment to the rendered
// output instead of that from <Bar>.
ctx.ComponentFactories.AddStub<Bar>(@div>NOT FROM BAR</div>);
ctx.ComponentFactories.AddStub<Bar>(@<div>NOT FROM BAR</div>);
```

It is also possible to access the parameter that is passed to the substituted component, both when specifying alternative render output or when verifying the correct parameters was passed to the substituted component. For example, suppose `<Foo>` has a parameter named `Baz`:
Expand All @@ -88,7 +88,7 @@ ctx.ComponentFactories.AddStub<Bar>(parameters => $"<div>{parameters.Get(x => Ba

// Add the markup produced by the render template to the rendered
// output instead of that from <Bar>.
ctx.ComponentFactories.AddStub<Bar>(parameters => @div>@(parameters.Get(x => Baz))</div>);
ctx.ComponentFactories.AddStub<Bar>(parameters => @<div>@(parameters.Get(x => Baz))</div>);
```

To verify that the expected value was passed to the `Baz` parameter of `<Foo>`, first find the substituted component in the render tree using the `FindComponent`/`FindComponents` methods, and then inspect the `Parameters` property. E.g.:
Expand Down Expand Up @@ -136,7 +136,7 @@ ctx.ComponentFactories.AddStub(type => type.Namespace == "Third.Party.Lib",
// Add the markup produced by the render fragment to the rendered
// output instead of the components that match the predicate.
ctx.ComponentFactories.AddStub(type => type.Namespace == "Third.Party.Lib",
@div>NOT FROM BAR</div>);
@<div>NOT FROM BAR</div>);
```

### Creating a mock component with mocking libraries
Expand Down

0 comments on commit c25adbf

Please sign in to comment.