You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: MIGRATION.md
+23Lines changed: 23 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -82,3 +82,26 @@ The `TestServiceProvider` class has been renamed to `BunitTestServiceProvider`.
82
82
83
83
## `DisposeComponents` is now asynchronous and called `DisposeComponentsAsync`
84
84
`DisposeComponentsAsync` allows to await `DisposeAsync` of components under test. If you used `DisposeComponents`, you should replace it with `DisposeComponentsAsync`.
85
+
86
+
## `IRefreshableElementCollection` was removed
87
+
88
+
The `IRefreshableElementCollection` interface has been removed. With this the `FindAll` method does not accept a `bool enableRefresh` parameter anymore. Code like this:
89
+
90
+
```csharp
91
+
varitems=cut.FindAll("li", enableRefresh: true);
92
+
93
+
cut.Find("button").Click(); // Some action that causes items to change
94
+
95
+
Assert.Equal(3, items.Count);
96
+
```
97
+
98
+
Should be changed to this:
99
+
100
+
```csharp
101
+
varitems=cut.FindAll("li");
102
+
103
+
cut.Find("button").Click(); // Some action that causes items to change
Copy file name to clipboardExpand all lines: docs/site/docs/verification/verify-markup.md
+2-6Lines changed: 2 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -37,9 +37,9 @@ bUnit supports multiple different ways of searching and querying the rendered HT
37
37
38
38
-`FindByLabelText(string labelText)` that takes a text string used to label an input element and returns an `IElement` as output, or throws an exception if none are found (this is included in the experimental library [bunit.web.query](https://www.nuget.org/packages/bunit.web.query)). Use this method when possible compared to the generic `Find` and `FindAll` methods.
39
39
-[`Find(string cssSelector)`](xref:Bunit.RenderedComponentExtensions.Find``1(Bunit.IRenderedComponent{``0},System.String)) takes a "CSS selector" as input and returns an `IElement` as output, or throws an exception if none are found.
40
-
-[`FindAll(string cssSelector)`](xref:Bunit.RenderedComponentExtensions.FindAll``1(Bunit.IRenderedComponent{``0},System.String,System.Boolean)) takes a "CSS selector" as input and returns a list of `IElement` elements.
40
+
-[`FindAll(string cssSelector)`](xref:Bunit.RenderedComponentExtensions.FindAll``1(Bunit.IRenderedComponent{``0},System.String)) takes a "CSS selector" as input and returns a list of `IElement` elements.
41
41
42
-
Let's see some examples of using the [`Find(string cssSelector)`](xref:Bunit.RenderedComponentExtensions.Find``1(Bunit.IRenderedComponent{``0},System.String)) and [`FindAll(string cssSelector)`](xref:Bunit.RenderedComponentExtensions.FindAll``1(Bunit.IRenderedComponent{``0},System.String,System.Boolean)) methods to query the `<FancyTable>` component listed below.
42
+
Let's see some examples of using the [`Find(string cssSelector)`](xref:Bunit.RenderedComponentExtensions.Find``1(Bunit.IRenderedComponent{``0},System.String)) and [`FindAll(string cssSelector)`](xref:Bunit.RenderedComponentExtensions.FindAll``1(Bunit.IRenderedComponent{``0},System.String)) methods to query the `<FancyTable>` component listed below.
@@ -59,10 +59,6 @@ However, that does not apply to elements that are found by traversing the DOM tr
59
59
60
60
As a result of this, it is always recommended to use the [`Find(string cssSelector)`](xref:Bunit.RenderedComponentExtensions.Find``1(Bunit.IRenderedComponent{``0},System.String)) method when searching for a single element. Alternatively, always reissue the query whenever you need the element.
61
61
62
-
#### Auto-refreshable FindAll() queries
63
-
64
-
The [`FindAll(string cssSelector, bool enableAutoRefresh = false)`](xref:Bunit.RenderedComponentExtensions.FindAll``1(Bunit.IRenderedComponent{``0},System.String,System.Boolean)) method has an optional parameter, `enableAutoRefresh`, which when set to `true` will return a collection of `IElement`. This automatically refreshes itself when the component the elements came from is re-rendered.
65
-
66
62
## Semantic comparison of markup
67
63
68
64
Working with raw markup only works well with very simple output, but even then you have to sanitize it to get stable tests. A much better approach is to use the semantic HTML comparer that comes with bUnit.
Copy file name to clipboardExpand all lines: src/bunit/Extensions/RenderedComponentExtensions.cs
+4-4Lines changed: 4 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -36,13 +36,13 @@ public static IElement Find<TComponent>(this IRenderedComponent<TComponent> rend
36
36
/// </summary>
37
37
/// <param name="renderedComponent">The rendered fragment to search.</param>
38
38
/// <param name="cssSelector">The group of selectors to use.</param>
39
-
/// <param name="enableAutoRefresh">If true, the returned <see cref="IRefreshableElementCollection{IElement}"/> will automatically refresh its <see cref="IElement"/>s whenever the <paramref name="renderedComponent"/> changes.</param>
40
-
/// <returns>An <see cref="IRefreshableElementCollection{IElement}"/>, that can be refreshed to execute the search again.</returns>
Copy file name to clipboardExpand all lines: src/bunit/Extensions/WaitForHelpers/RenderedComponentWaitForHelperExtensions.WaitForElement.cs
+18-18Lines changed: 18 additions & 18 deletions
Original file line number
Diff line number
Diff line change
@@ -40,8 +40,8 @@ public static IElement WaitForElement<TComponent>(this IRenderedComponent<TCompo
40
40
/// <param name="renderedComponent">The render fragment or component find the matching element in.</param>
41
41
/// <param name="cssSelector">The CSS selector to use to search for elements.</param>
42
42
/// <exception cref="WaitForFailedException">Thrown if no elements is found matching the <paramref name="cssSelector"/> within the default timeout.</exception>
@@ -52,8 +52,8 @@ public static IRefreshableElementCollection<IElement> WaitForElements<TComponent
52
52
/// <param name="cssSelector">The CSS selector to use to search for elements.</param>
53
53
/// <param name="matchElementCount">The exact number of elements to that the <paramref name="cssSelector"/> should match.</param>
54
54
/// <exception cref="WaitForFailedException">Thrown if no elements is found matching the <paramref name="cssSelector"/> within the default timeout.</exception>
@@ -64,8 +64,8 @@ public static IRefreshableElementCollection<IElement> WaitForElements<TComponent
64
64
/// <param name="cssSelector">The CSS selector to use to search for elements.</param>
65
65
/// <param name="timeout">The maximum time to wait for elements to appear.</param>
66
66
/// <exception cref="WaitForFailedException">Thrown if no elements is found matching the <paramref name="cssSelector"/> within the default timeout.</exception>
@@ -78,8 +78,8 @@ public static IRefreshableElementCollection<IElement> WaitForElements<TComponent
78
78
/// <param name="matchElementCount">The exact number of elements to that the <paramref name="cssSelector"/> should match.</param>
79
79
/// <param name="timeout">The maximum time to wait for elements to appear.</param>
80
80
/// <exception cref="WaitForFailedException">Thrown if no elements is found matching the <paramref name="cssSelector"/> within the default timeout.</exception>
/// <param name="cssSelector">The CSS selector to use to search for elements.</param>
116
116
/// <param name="matchElementCount">The exact number of elements to that the <paramref name="cssSelector"/> should match.</param>
117
117
/// <exception cref="WaitForFailedException">Thrown if no elements is found matching the <paramref name="cssSelector"/> within the default timeout.</exception>
/// <param name="cssSelector">The CSS selector to use to search for elements.</param>
129
129
/// <param name="timeout">The maximum time to wait for elements to appear.</param>
130
130
/// <exception cref="WaitForFailedException">Thrown if no elements is found matching the <paramref name="cssSelector"/> within the default timeout.</exception>
/// <param name="matchElementCount">The exact number of elements to that the <paramref name="cssSelector"/> should match.</param>
143
143
/// <param name="timeout">The maximum time to wait for elements to appear.</param>
144
144
/// <exception cref="WaitForFailedException">Thrown if no elements is found matching the <paramref name="cssSelector"/> within the default timeout.</exception>
/// <param name="renderedComponent">The render fragment or component find the matching element in.</param>
155
155
/// <param name="cssSelector">The CSS selector to use to search for elements.</param>
156
156
/// <exception cref="WaitForFailedException">Thrown if no elements is found matching the <paramref name="cssSelector"/> within the default timeout.</exception>
0 commit comments