diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 5a52b66ad..cd53d67a6 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -4,6 +4,7 @@ on:
push:
branches:
- main
+ - v3
paths:
- 'src/**'
- 'tests/**'
@@ -44,8 +45,6 @@ jobs:
uses: actions/setup-dotnet@v6
with:
dotnet-version: |
- 8.0.x
- 9.0.x
10.0.x
11.0.x
@@ -126,8 +125,6 @@ jobs:
uses: actions/setup-dotnet@v6
with:
dotnet-version: |
- 8.0.x
- 9.0.x
10.0.x
11.0.x
@@ -225,8 +222,6 @@ jobs:
uses: actions/setup-dotnet@v6
with:
dotnet-version: |
- 8.0.x
- 9.0.x
10.0.x
11.0.x
@@ -256,7 +251,7 @@ jobs:
- name: 🧪 Run sample unit tests
working-directory: docs/samples
- run: dotnet test samples.sln -p:VSTestUseMSBuildOutput=false -f net8.0
+ run: dotnet test samples.sln -p:VSTestUseMSBuildOutput=false -f net10.0
- name: 📄 Build docs
working-directory: ./docs/site
diff --git a/.github/workflows/docs-deploy.yml b/.github/workflows/docs-deploy.yml
index 35f3bbdfe..7b9be3aa8 100644
--- a/.github/workflows/docs-deploy.yml
+++ b/.github/workflows/docs-deploy.yml
@@ -73,8 +73,6 @@ jobs:
uses: actions/setup-dotnet@v6
with:
dotnet-version: |
- 8.0.x
- 9.0.x
10.0.x
11.0.x
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index c6284e036..72d934d0a 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -63,8 +63,6 @@ jobs:
uses: actions/setup-dotnet@v6
with:
dotnet-version: |
- 8.0.x
- 9.0.x
10.0.x
11.0.x
diff --git a/CHANGELOG.md b/CHANGELOG.md
index e5b9f7677..3a21227b8 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -6,6 +6,21 @@ All notable changes to **bUnit** will be documented in this file. The project ad
## [Unreleased]
+### Added
+
+- `INode.GetOwningComponent()` and its generic overload, which return the rendered component that rendered a DOM node. Reported by [@egil](https://github.com/egil) in #153.
+- `Parent()`, `Root()`, `GetAncestors()`, `GetChildren()` and its generic overload on `IRenderedComponent`, for navigating the component tree. Reported by [@egil](https://github.com/egil) in #1180.
+
+### Changed
+
+- **Breaking:** all rendered components in a render tree now share a single DOM. Previously each rendered component parsed its own markup into its own document, so an element found through a child component had no ancestors outside that child. Consequences:
+ - Events raised on an element found through a child component now bubble into the markup rendered by its ancestor components, as they do in a browser. Reported by [@JelleHissink](https://github.com/JelleHissink) in #983.
+ - `Find` and `FindAll` on a child component evaluate positional and combinator selectors (`:first-child`, `+`, `~`, ...) against the whole tree rather than the component's markup in isolation.
+ - An `option` element rendered by a child component, inside a `select` element rendered by an ancestor with a matching `value` attribute, now renders as `selected`, matching what the ancestor's markup shows.
+
+ A component whose markup starts or ends with text, or that the HTML parser relocates, still falls back to its own document, since its nodes cannot be identified in the shared one.
+- Events raised on an element obtained through `FindComponent` no longer stop at the child component's own markup, so a submit button in a child component triggers the `@onsubmit` handler on the `form` element rendered by its parent. Reported by [@JelleHissink](https://github.com/JelleHissink) in #983.
+
### Fixed
- `DisposeComponentsAsync()` could dispose nothing when the renderer's dispatcher was busy, e.g. with a timer calling `InvokeAsync`. Reported by [@xfunc-tim-schneider](https://github.com/xfunc-tim-schneider) in #1939. Fixed by [@linkdotnet](https://github.com/linkdotnet).
diff --git a/Directory.Packages.props b/Directory.Packages.props
index 8a23376ef..3d275125a 100644
--- a/Directory.Packages.props
+++ b/Directory.Packages.props
@@ -26,36 +26,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/README.md b/README.md
index 4208f1d12..fda024d9f 100644
--- a/README.md
+++ b/README.md
@@ -33,7 +33,8 @@ To get started, head to the [getting started documentation](https://bunit.dev/do
| bUnit version | .NET version |
| ------------- | ------------------------------- |
| 1.x | ≥ .netcore3.1 && ≤ .net 9 |
-| 2.x | ≥ .net8 |
+| 2.x | ≥ .net8 && ≤ .net 11 |
+| 3.x | ≥ .net10 |
For a migration guide, see [Upgrading bUnit](https://bunit.dev/docs/migrations/index.html).
diff --git a/docs/samples/components/bunit.docs.samples.csproj b/docs/samples/components/bunit.docs.samples.csproj
index 88949209f..9e1e852d7 100644
--- a/docs/samples/components/bunit.docs.samples.csproj
+++ b/docs/samples/components/bunit.docs.samples.csproj
@@ -1,7 +1,7 @@
- net8.0;net9.0;net10.0;net11.0
+ net10.0;net11.0Bunit.Docs.SamplesenableCA1014,NU5104
diff --git a/docs/samples/tests/Directory.Build.props b/docs/samples/tests/Directory.Build.props
index 8071ce9d1..9a5722898 100644
--- a/docs/samples/tests/Directory.Build.props
+++ b/docs/samples/tests/Directory.Build.props
@@ -1,6 +1,6 @@
- net8.0;net9.0;net10.0;net11.0
+ net10.0;net11.0falsetruefalse
diff --git a/docs/site/docs/extensions/bunit-generators.md b/docs/site/docs/extensions/bunit-generators.md
index c9c072908..74d9b3f97 100644
--- a/docs/site/docs/extensions/bunit-generators.md
+++ b/docs/site/docs/extensions/bunit-generators.md
@@ -53,12 +53,12 @@ To use the generator, the **Interceptor** feature has to be used inside the cspr
```xml
- net8.0
+ net10.0$(InterceptorsPreviewNamespaces);Bunit
```
-Due to the usage of **Interceptors** the generator is only available for .NET 8.0 and above. The generator does create a `partial` class, so it can be extended with custom logic if needed.
+Due to the usage of **Interceptors** the generator requires .NET 10.0 and above, matching bUnit's minimum supported target framework. The generator does create a `partial` class, so it can be extended with custom logic if needed.
## Component stub generator via `ComponentStubAttribute`
diff --git a/docs/site/docs/getting-started/create-test-project.md b/docs/site/docs/getting-started/create-test-project.md
index a3b526ada..f1b9c558a 100644
--- a/docs/site/docs/getting-started/create-test-project.md
+++ b/docs/site/docs/getting-started/create-test-project.md
@@ -148,10 +148,10 @@ dotnet add package bunit --version #{NBGV_NuGetPackageVersion}#
The test projects setting needs to be set to the following:
- the project's SDK needs to be set to `Microsoft.NET.Sdk.Razor` (this does not work with **TUnit** - a more detailed explanation can be found below)
-- set the `` to `net8.0`
+- set the `` to `net10.0`
> [!NOTE]
-> bUnit works with `net8.0` and above as well.
+> bUnit works with `net10.0` and above as well.
To do so, change the first part of the test projects `.csproj` file to look like this.:
@@ -159,7 +159,7 @@ To do so, change the first part of the test projects `.csproj` file to look like
- net8.0
+ net10.0 ...
@@ -182,7 +182,7 @@ The result should be a test project with a `.csproj` that looks like this (non b
- net8.0
+ net10.0enablefalse
@@ -211,7 +211,7 @@ The result should be a test project with a `.csproj` that looks like this (non b
- net8.0
+ net10.0enablefalseExe
@@ -241,7 +241,7 @@ The result should be a test project with a `.csproj` that looks like this (non b
- net8.0
+ net10.0enablefalse
@@ -267,7 +267,7 @@ The result should be a test project with a `.csproj` that looks like this (non b
- net8.0
+ net10.0enablefalse
@@ -293,7 +293,7 @@ The result should be a test project with a `.csproj` that looks like this (non b
- net8.0
+ net10.0enablefalsefalse
diff --git a/docs/site/docs/interaction/render-modes.md b/docs/site/docs/interaction/render-modes.md
index d019abba6..45ca1d70f 100644
--- a/docs/site/docs/interaction/render-modes.md
+++ b/docs/site/docs/interaction/render-modes.md
@@ -75,7 +75,7 @@ public void StaticRendering()
# [Razor test code](#tab/razor)
```razor
-@inherits TestContext
+@inherits BunitContext
@code {
[Fact]
public void InteractiveServer()
@@ -108,7 +108,7 @@ public void StaticRendering()
***
## Setting the `RendererInfo` during testing
-To control the `ComponentBase.RendererInfo` property during testing, use the method on the `TestContext` class. The `SetRendererInfo` method takes an nullable `RendererInfo` object as a parameter. Passing `null` will set the `ComponentBase.RendererInfo` to `null`.
+To control the `ComponentBase.RendererInfo` property during testing, use the method on the `BunitContext` class. The `SetRendererInfo` method takes an nullable `RendererInfo` object as a parameter. Passing `null` will set the `ComponentBase.RendererInfo` to `null`.
A component (`AssistentComponent.razor`) might check if interactivity is given to enable a button:
@@ -154,4 +154,4 @@ public void SimulatingInteractiveServerRendering()
```
> [!NOTE]
-> If a component under test uses the `ComponentBase.RendererInfo` property and the `SetRendererInfo` on `TestContext` hasn't been passed in a `RendererInfo` object, the renderer will throw an exception.
\ No newline at end of file
+> If a component under test uses the `ComponentBase.RendererInfo` property and the `SetRendererInfo` on `BunitContext` hasn't been passed in a `RendererInfo` object, the renderer will throw an exception.
\ No newline at end of file
diff --git a/docs/site/docs/interaction/trigger-event-handlers.md b/docs/site/docs/interaction/trigger-event-handlers.md
index d8eb3ff8c..cd9497303 100644
--- a/docs/site/docs/interaction/trigger-event-handlers.md
+++ b/docs/site/docs/interaction/trigger-event-handlers.md
@@ -105,4 +105,26 @@ Example:
```csharp
await cut.Find("button").ClickAsync();
-```
\ No newline at end of file
+```
+## Events bubble across component boundaries
+
+Every component in a render tree shares one DOM, so an element found through a child
+component still has its ancestors from the parent components around it. Events therefore
+bubble the same way whether the element was found from the component under test or from
+one of its children:
+
+```csharp
+var cut = Render();
+
+// Both of these trigger the @onsubmit handler on the