ComponentTestHostOptions Class
Configures the browser of a ComponentTestHost.
public sealed class ComponentTestHostOptionsConstructors
| Name | Description |
|---|---|
| ComponentTestHostOptions() |
ComponentTestHostOptions()
ComponentTestHostOptions.cspublic ComponentTestHostOptions()No documentation is available.
Properties
| Name | Description |
|---|---|
| BaseUrl | Gets the URL of the page that hosts the components. It is the base URI of the NavigationManager. The default is https://localhost/. |
| ConfigureBrowsingContext | Gets a function that changes the options of the browsing context of the page, or null (see TestPageSettings.ConfigureBrowsingContext). |
| CustomEventArgs | Gets the factories of the EventArgs of the custom event types, by DOM event type. The built-in event types (MouseEventArgs, KeyboardEventArgs, ChangeEventArgs...) are created from the DOM events. |
| DefaultTimeout | Gets the maximum time to wait for the components and the page to be idle. The default is 10 seconds. |
| DocumentLoader | Gets the loader of the resources of the page. When it is null, the ComponentTestHostOptions.StaticFiles are served. |
| EnableJavaScript | Gets whether the page runs JavaScript (JavaScriptScriptEngine): the scripts of the host page run, and the JavaScript interop calls that are not set up in ComponentTestHost.JSInterop call the functions of the page. |
| HostPage | Gets the HTML of the page that hosts the components: add the style sheets of the application in its head (<link rel=stylesheet> elements are loaded by ComponentTestHostOptions.DocumentLoader). The components are rendered in its body by default. |
| StaticFiles | Gets the folders that serve the static files of the host page (style sheets, images, fonts, scripts), by URL path prefix: { "/" : "wwwroot" } serves https://localhost/css/app.css from wwwroot/css/app.css. Ignored when ComponentTestHostOptions.DocumentLoader is set. |
| StyleSheets | Gets the CSS style sheets added to the host page, as the content of <style> elements. |
| TestIdAttribute | Gets the name of the attribute that LocatorScope.GetByTestId matches. The default is data-testid. |
| TimeProvider | Gets the clock of the timers of the page (setTimeout(), the CSS animations...). The default is the system clock. |
| Viewport | Gets the size of the viewport, in CSS pixels. The default is 1280x720. |
BaseUrl
ComponentTestHostOptions.csConfigureBrowsingContext
ComponentTestHostOptions.csGets a function that changes the options of the browsing context of the page, or null (see TestPageSettings.ConfigureBrowsingContext).
public Func<BrowsingContextOptions, BrowsingContextOptions>? ConfigureBrowsingContext { get; init; }Property value
CustomEventArgs
ComponentTestHostOptions.csDefaultTimeout
ComponentTestHostOptions.csDocumentLoader
ComponentTestHostOptions.csGets the loader of the resources of the page. When it is null, the ComponentTestHostOptions.StaticFiles are served.
public DocumentLoader? DocumentLoader { get; init; }Property value
EnableJavaScript
ComponentTestHostOptions.csGets whether the page runs JavaScript (JavaScriptScriptEngine): the scripts of the host page run, and the JavaScript interop calls that are not set up in ComponentTestHost.JSInterop call the functions of the page.
public bool EnableJavaScript { get; init; }Property value
HostPage
ComponentTestHostOptions.csGets the HTML of the page that hosts the components: add the style sheets of the application in its head (<link rel=stylesheet> elements are loaded by ComponentTestHostOptions.DocumentLoader). The components are rendered in its body by default.
public string HostPage { get; init; }Property value
StaticFiles
ComponentTestHostOptions.csGets the folders that serve the static files of the host page (style sheets, images, fonts, scripts), by URL path prefix: { "/" : "wwwroot" } serves https://localhost/css/app.css from wwwroot/css/app.css. Ignored when ComponentTestHostOptions.DocumentLoader is set.
public IDictionary<string, string> StaticFiles { get; }Property value
StyleSheets
ComponentTestHostOptions.csGets the CSS style sheets added to the host page, as the content of <style> elements.
Property value
TestIdAttribute
ComponentTestHostOptions.csGets the name of the attribute that LocatorScope.GetByTestId matches. The default is data-testid.
public string TestIdAttribute { get; init; }Property value
TimeProvider
ComponentTestHostOptions.csGets the clock of the timers of the page (setTimeout(), the CSS animations...). The default is the system clock.
public TimeProvider? TimeProvider { get; init; }Property value
Viewport
ComponentTestHostOptions.csGets the size of the viewport, in CSS pixels. The default is 1280x720.
public ViewportOptions Viewport { get; init; }