Skip to content

Latest commit

 

History

History
89 lines (41 loc) · 2.29 KB

File metadata and controls

89 lines (41 loc) · 2.29 KB

Verify.Blazor

Discussions Build status NuGet Status

include: intro

Verify.Blazor uses the Blazor APIs to take a snapshot (metadata and html) of the current state of a Blazor component. It has fewer dependencies and is a simpler API than Verify.Bunit approach, however it does not provide many of the other features, for example trigger event handlers.

See Milestones for release notes.

Sponsors

include: sponsors

NuGet

Usage

Component

The below samples use the following Component:

snippet: BlazorApp/TestComponent.razor

Render using ParameterView

This test:

snippet: BlazorComponentTestWithParameters

Render using template instance

This test:

snippet: BlazorComponentTestWithTemplateInstance

Result

Both will produce:

The component rendered as html ...verified.html:

snippet: Tests/Samples.PassingParameters.verified.html

And the current model rendered as txt ...verified.txt:

snippet: Tests/Samples.PassingParameters.verified.txt

Scrubbing

Integrity check

In Blazor an integrity check is applied to the dotnet.*.js file.

<script src="_framework/dotnet.5.0.2.js" defer="" integrity="sha256-AQfZ6sKmq4EzOxN3pymKJ1nlGQaneN66/2mcbArnIJ8=" crossorigin="anonymous"></script>

This line will change when the dotnet SDK is updated.

Noise in rendered template

Blazor uses <!--!--> to delineate components in the resulting html. Some empty lines can be rendered when components are stitched together.

Resulting scrubbing

snippet: scrubbers

Icon

Helmet designed by Leonidas Ikonomou from The Noun Project.