Guard and name Raw manual entry and browsing workflows
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using System.Reflection;
|
||||
using Microsoft.JSInterop;
|
||||
using System.Runtime.ExceptionServices;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Microsoft.AspNetCore.Components.RenderTree;
|
||||
@@ -366,8 +367,20 @@ public sealed class RawBrowseModalStaleOpenTests : IDisposable
|
||||
/// throws without one, and this modal calls it on the open path. Renders are built and then
|
||||
/// discarded — the tests read the modal's state, not its markup.
|
||||
/// </summary>
|
||||
// The migrated ModalFrame requires JS even in this existing inert renderer.
|
||||
// This double only supplies its focus adapter; actual keyboard behavior is browser-tested.
|
||||
private sealed class DialogOnlyRuntime:IJSRuntime
|
||||
{
|
||||
public ValueTask<T> InvokeAsync<T>(string name,object?[]? args)=>InvokeAsync<T>(name,CancellationToken.None,args);
|
||||
public ValueTask<T> InvokeAsync<T>(string name,CancellationToken ct,object?[]? args)
|
||||
{
|
||||
if (!name.StartsWith("otDialog.",StringComparison.Ordinal)) throw new NotSupportedException(name);
|
||||
return ValueTask.FromResult(name=="otDialog.activate"?(T)(object)true:default!);
|
||||
}
|
||||
}
|
||||
|
||||
private sealed class InertRenderer()
|
||||
: Renderer(new ServiceCollection().BuildServiceProvider(), NullLoggerFactory.Instance)
|
||||
: Renderer(new ServiceCollection().AddSingleton<IJSRuntime, DialogOnlyRuntime>().BuildServiceProvider(), NullLoggerFactory.Instance)
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
public override Dispatcher Dispatcher { get; } = new InlineDispatcher();
|
||||
|
||||
Reference in New Issue
Block a user