Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/BootstrapBlazor/Extensions/JSModuleExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ public static async Task<JSModule> LoadModule(this IJSRuntime jsRuntime, string
throw;
#endif
}
catch (OperationCanceledException) { }
return new JSModule(jSObjectReference);
}

Expand Down
9 changes: 3 additions & 6 deletions test/UnitTest/Extensions/JSModuleExtensionsTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,10 @@ public async Task LoadModule_Ok()
{
var jsRuntime = Context.Services.GetRequiredService<IJSRuntime>();
await jsRuntime.LoadModule("./mock.js", "test");
}

[Fact]
public async Task LoadModule_Exception()
{
var jsRuntime = new MockJSRuntime();
await Assert.ThrowsAsync<TaskCanceledException>(() => jsRuntime.LoadModule("./mock.js", "test"));
var jsRuntime1 = new MockJSRuntime();
var module = await jsRuntime1.LoadModule("./mock.js", "test");
Assert.NotNull(module);

var jsRuntime2 = new JSExceptionJSRuntime();
await Assert.ThrowsAsync<JSException>(() => jsRuntime2.LoadModule("./mock.js", "test"));
Expand Down
Loading