Skip to content

Commit 020c2bf

Browse files
authored
Apply suggestions from code review
1 parent e3b8a56 commit 020c2bf

7 files changed

Lines changed: 9 additions & 11 deletions

File tree

docs/site/docs/interaction/trigger-renders.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ Invoking methods on a component under test, which causes a render, e.g. by calli
4545
4646
If you receive this error, you need to invoke your method inside an `Action` delegate passed to the [`InvokeAsync(...)`](xref:Bunit.RenderedComponentInvokeAsyncExtensions.InvokeAsync``1(Bunit.IRenderedComponentBase{``0},System.Action)) method.
4747

48-
Let’s look at an example of this, using the `<Calc>` component listed below: [__AP: Should this be ImperativeCalc?__]
48+
Let’s look at an example of this, using the `<Calc>` component listed below:
4949

5050
[!code-cshtml[Calc.razor](../../../samples/components/Calc.razor)]
5151

docs/site/docs/providing-input/root-render-tree.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ Here is the test that adds the `CascadingValue<string>` component to the render
2626
2727
## Add Only if Not Already in Root Render Tree
2828

29-
Sometimes common test setup logic exists outside the test class, perhaps abstracted away in other libraries. In those cases, the [`TryAdd`](xref:Bunit.Rendering.RootRenderTree.TryAdd``1(System.Action{Bunit.ComponentParameterCollectionBuilder{``0}})) method [__AP: is 'method' correct?__] can be used to add the component to the render tree, _only if_ it has not already been added. [`TryAdd`](xref:Bunit.Rendering.RootRenderTree.TryAdd``1(System.Action{Bunit.ComponentParameterCollectionBuilder{``0}})) returns true if the component was added, false otherwise.
29+
Sometimes common test setup logic exists outside the test class, perhaps abstracted away in other libraries. In those cases, the [`TryAdd`](xref:Bunit.Rendering.RootRenderTree.TryAdd``1(System.Action{Bunit.ComponentParameterCollectionBuilder{``0}})) method can be used to a components to the render tree, _only if_ it has not already been added. [`TryAdd`](xref:Bunit.Rendering.RootRenderTree.TryAdd``1(System.Action{Bunit.ComponentParameterCollectionBuilder{``0}})) returns true if the component was added, false otherwise.
3030

3131
[!code-csharp[](../../../samples/tests/xunit/RenderTreeTest.cs#L36-L38)]
3232

docs/site/docs/test-doubles/emulating-ijsruntime.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,9 @@ var plannedInvocation = ctx.JSInterop.SetupVoid("startAnimation");
5858
// only completes or throws, it doesn’t return a value.
5959
// Any calls to InvokeVoidAsync(...) up till this point will
6060
// have received an incomplete Task which the component
61-
// is likely waiting until the call to SetCompleted() below.
61+
// is awaiting until the call to SetCompleted() below.
6262
plannedInvocation.SetCompleted();
6363
```
64-
[__AP: In the above comment, last line, I feel there should be something after 'waiting', but not quite sure what.__]
6564

6665
## Verifying invocations
6766

docs/site/docs/test-doubles/faking-auth.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ The test implementation of Blazor's authentication and authorization can be put
1818
bUnit's authentication and authorization implementation is easily available by calling [`AddTestAuthorization()`](xref:Bunit.TestDoubles.FakeAuthorizationExtensions.AddTestAuthorization(Bunit.TestContextBase)) on a test context. This adds the necessary services to the `Services` collection and the `CascadingAuthenticationState` component to the [root render tree](xref:root-render-tree). The method returns an instance of the <xref:Bunit.TestDoubles.TestAuthorizationContext> type that allows you to control the authentication and authorization state for a test.
1919

2020
> [!NOTE]
21-
> If your [__AP: Is there a noun missing here?__] inherits directly from bUnit's <xref:Bunit.TestContext>, as described in <xref:writing-csharp-tests#remove-boilerplate-code-from-tests>, then you need to call the [`AddTestAuthorization()`](xref:Bunit.TestDoubles.FakeAuthorizationExtensions.AddTestAuthorization(Bunit.TestContextBase)) method like so: `this.AddTestAuthorization()`.
21+
> If your test class inherits directly from bUnit's <xref:Bunit.TestContext>, as described in <xref:writing-csharp-tests#remove-boilerplate-code-from-tests>, then you need to call the [`AddTestAuthorization()`](xref:Bunit.TestDoubles.FakeAuthorizationExtensions.AddTestAuthorization(Bunit.TestContextBase)) method like so: `this.AddTestAuthorization()`.
2222
2323
The following sections show how to set each of these states in a test.
2424

@@ -100,7 +100,7 @@ To specify one or more claims for the authenticated and authorized user, do the
100100

101101
[!code-csharp[UserRightsTest.cs](../../../samples/tests/xunit/UserRightsTest.cs?start=106&end=123&highlight=5-8)]
102102

103-
The highlighted line shows how the <xref:Bunit.TestDoubles.TestAuthorizationContext.SetClaims(System.Security.Claims.Claim[])> method is used to pass two instances of the `Claim` types.[__AP: type or types?__]
103+
The highlighted line shows how the <xref:Bunit.TestDoubles.TestAuthorizationContext.SetClaims(System.Security.Claims.Claim[])> method is used to pass two instances of the `Claim` type.
104104

105105
### Example of passing both roles, claims, and policies
106106

docs/site/docs/verification/verify-component-state.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ Alert alert = cut.Instance;
3434
## Finding Components in the Render Tree
3535

3636
To get the instances of components nested inside the component under test, use the
37-
[`FindComponent<TComponent>()`](xref:Bunit.RenderedFragmentExtensions.FindComponent``1(Bunit.IRenderedFragment)) and [`FindComponents<TComponent>()`](xref:Bunit.RenderedFragmentExtensions.FindComponents``1(Bunit.IRenderedFragment)) methods on the <xref:Bunit.IRenderedComponent`1> type. Suppose we have a `<TodoList>` component with `<Task>` components nested inside for each task in the todo list. [__AP: Could one say 'Suppose, for each task in the todo list, we have a `<TodoList>` component with `<Task>` components nested inside.'?__] In this case, the `<Task>` components can be found like this:
37+
[`FindComponent<TComponent>()`](xref:Bunit.RenderedFragmentExtensions.FindComponent``1(Bunit.IRenderedFragment)) and [`FindComponents<TComponent>()`](xref:Bunit.RenderedFragmentExtensions.FindComponents``1(Bunit.IRenderedFragment)) methods on the <xref:Bunit.IRenderedComponent`1> type. Suppose, for each task in the todo list, we have a `<TodoList>` component with `<Task>` components nested inside. In this case, the `<Task>` components can be found like this:
3838

3939
```csharp
4040
using var ctx = new TestContext();
@@ -48,4 +48,3 @@ Assert.Equal(2, tasks.Count);
4848
```
4949

5050
Both the [`FindComponent<TComponent>()`](xref:Bunit.RenderedFragmentExtensions.FindComponent``1(Bunit.IRenderedFragment)) and [`FindComponents<TComponent>()`](xref:Bunit.RenderedFragmentExtensions.FindComponents``1(Bunit.IRenderedFragment)) methods perform a **depth-first search** of the render tree, with the first method returning only the first matching component found, and the latter returning all matching components in the render tree.
51-

docs/site/docs/verification/verify-markup.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ This is what happens in the test:
158158

159159
Testing a more **complex life cycle of a component** can be done more easily using the <xref:Bunit.IRenderedFragment.GetChangesSinceSnapshot> and <xref:Bunit.IRenderedFragment.SaveSnapshot> methods along with a host of other assert helpers.
160160

161-
This example tests the `<CheckList>` component listed below. The component allows you to add new items to the checklist by typing into the input field and hitting the `enter` key. Items can be removed from the again list [__AP: Is 'again list' correct?__] by clicking on them.
161+
This example tests the `<CheckList>` component listed below. The component allows you to add new items to the checklist by typing into the input field and hitting the `enter` key. Items can be removed from the list again by clicking on them.
162162

163163
[!code-razor[CheckList.razor](../../../samples/components/CheckList.razor)]
164164

docs/site/index.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@ title: bUnit - a Testing Library for Blazor Components
1515
- Setup and define components under tests using C# or Razor syntax
1616
- Verify outcomes using semantic HTML comparer
1717
- Interact with and inspect components as well as trigger event handlers
18-
- Pass parameters, cascading values and inject services into components under test [__AP: Are 'cascading values' things that are passed, like parameters, or should one say 'Pass parameters, cascade values and inject services...?__]
18+
- Pass parameters, cascading values and inject services into components under test
1919
- Mock `IJSRuntime` and Blazor authentication and authorization
2020
- Perform snapshot testing
2121

22-
bUnit builds on top of existing unit testing frameworks such as xUnit, NUnit, and MSTest, which [__AP: What does this 'which' refer to -- bUnit or xUnit et al? If the former, then would be better to say 'and' rather than 'which'.__] runs [__AP: If the 'which' referred not to bUnit but to xUnit et al, then this 'runs' should be 'run'.__] the Blazor components tests in just the same way as any normal unit test. bUnit runs a test in milliseconds, compared to browser-based UI tests which usually take seconds to run.
22+
bUnit builds on top of existing unit testing frameworks such as xUnit, NUnit, and MSTest, which run the Blazor components tests in just the same way as any normal unit test. bUnit runs a test in milliseconds, compared to browser-based UI tests which usually take seconds to run.
2323

2424
**Go to the [Documentation](xref:getting-started) pages to learn more.**
2525

0 commit comments

Comments
 (0)