Skip to content

Commit 156822b

Browse files
committed
Revert "docs: Added examples for query strings in net8"
This reverts commit f8d4a8c.
1 parent f8d4a8c commit 156822b

File tree

1 file changed

+0
-30
lines changed

1 file changed

+0
-30
lines changed

docs/site/docs/providing-input/passing-parameters-to-components.md

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -466,36 +466,6 @@ When rendering a `RenderFragment` using the <xref:Bunit.TestContext.Render(Micro
466466
}
467467
```
468468

469-
## Passing query parameters (`SupplyParameterFromQuery`) to a component
470-
Since .NET 6 components can receive parameters from the query string. From .NET 6 until .NET 8 `SupplyParameterFromQuery` also had to be a `Parameter`. The fact that they represent regular Blazor parameters means that <xref:Bunit.ComponentParameterCollectionBuilder`1>'s `Add` can be used. However, from .NET 8 onwards `SupplyParameterFromQuery` can be used without the need to be a `Parameter`. If it used without ther `Parameter` attribute, the <xref:Bunit.TestDoubles.FakeNavigationManager> can be used.
471-
472-
```razor
473-
@code {
474-
[SupplyParameterFromQuery]
475-
public string Name { get; set; }
476-
}
477-
```
478-
479-
A simple example of how to test a component that receives parameters from the query string:
480-
481-
```razor
482-
@inherits TestContext
483-
484-
@code {
485-
[Fact]
486-
public void Component_receives_parameters_from_query_string()
487-
{
488-
var navigationManager = Services.GetRequiredService<NavigationManager>();
489-
var uri = navigationManager.GetUriWithQueryParameter("Name", "bUnit");
490-
navigationManager.NavigateTo(uri);
491-
492-
var cut = RenderComponent<SupplyFromQueryParameterComponent>();
493-
494-
cut.Instance.Name.ShouldBe("bUnit");
495-
}
496-
}
497-
```
498-
499469
## Further Reading
500470

501471
- <xref:inject-services>

0 commit comments

Comments
 (0)