From f022007120e09bd99af38150d51d28661c7d9519 Mon Sep 17 00:00:00 2001 From: bUnit Bot <83116870+bUnitBot@users.noreply.github.com> Date: Wed, 4 Sep 2024 08:01:30 +0000 Subject: [PATCH] Update main with documentation in stable (#1541) * docs: Fix heading (#1537) * Fix heading Fix heading not rendering correctly. * Fix heading Be gone, crazy space. * docs: Fix AddFakePersistentComponentState examples (Fixes #1539) (#1540) --------- Co-authored-by: Martin Costello Co-authored-by: Steven Giesel --- .../test-doubles/faking-persistentcomponentstate.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/docs/site/docs/test-doubles/faking-persistentcomponentstate.md b/docs/site/docs/test-doubles/faking-persistentcomponentstate.md index c03f78110..9e28aa42c 100644 --- a/docs/site/docs/test-doubles/faking-persistentcomponentstate.md +++ b/docs/site/docs/test-doubles/faking-persistentcomponentstate.md @@ -12,7 +12,7 @@ bUnit comes with fake version of the `PersistentComponentState` type in Blazor t To use the fake `PersistentComponentState` in bUnit, call the `AddFakePersistentComponentState` extension method on `TestContext`: ```csharp -var fakeState = AddFakePersistentComponentState(); +var fakeState = this.AddFakePersistentComponentState(); ``` Calling `AddFakePersistentComponentState` returns a `FakePersistentComponentState` type, which has three methods; one to persist data, one to get persisted data, and one that triggers any "OnPersisting" callbacks added to the `PersistentComponentState`. @@ -20,7 +20,7 @@ Calling `AddFakePersistentComponentState` returns a `FakePersistentComponentStat To add data to the `PersistentComponentState` before running a test, i.e. to verify that a component uses the persisted state, use the `Persist` method: ```csharp -var fakeState = AddFakePersistentComponentState(); +var fakeState = this.AddFakePersistentComponentState(); var key = "STATE KEY"; var data = ...; // data to persist @@ -31,7 +31,7 @@ fakeState.Persist(key, data); To trigger a callback registered with the `PersistentComponentState.RegisterOnPersisting` method, use the `TriggerOnPersisting` method on `FakePersistentComponentState`: ```csharp -var fakeState = AddFakePersistentComponentState(); +var fakeState = this.AddFakePersistentComponentState(); // render component @@ -41,7 +41,7 @@ fakeState.TriggerOnPersisting(); To check if data has been persisted, use the `TryTake` method: ```csharp -var fakeState = AddFakePersistentComponentState(); +var fakeState = this.AddFakePersistentComponentState(); var key = "STATE KEY"; // render component, call TriggerOnPersisting @@ -95,7 +95,7 @@ To test that the `` component uses persisted weather data instead of ```csharp // Arrange -var fakeState = AddFakePersistentComponentState(); +var fakeState = this.AddFakePersistentComponentState(); // Persist a single weather forecast with a temperature of 42 fakeState.Persist("weather-data", new [] { new WeatherForecast { Temperature = 42 } }); @@ -111,7 +111,7 @@ To test that the `` component correctly persists weather data when it ```csharp // Arrange -var fakeState = AddFakePersistentComponentState(); +var fakeState = this.AddFakePersistentComponentState(); var cut = RenderComponent(); // Act - trigger the FetchData components PersistForecasts method