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
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export async function highlight(id) {

if (el) {
const invoke = () => {
hljs.highlightElement(el.querySelector('code'))
hljs.highlightElement(el.querySelector('code'));
el.querySelector('.loading').classList.add('d-none')
el.classList.remove('loaded')
}
Expand All @@ -64,6 +64,9 @@ export async function highlight(id) {
const handler = setInterval(() => {
const done = window.hljs !== void 0;
if (done) {
hljs.configure({
ignoreUnescapedHTML: true
});
clearInterval(handler)
resolve()
}
Expand Down
3 changes: 1 addition & 2 deletions src/BootstrapBlazor/Services/Serial/DefaultSerialService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@ public DefaultSerialService(IJSRuntime jsRuntime)

private async Task<JSModule> LoadModule()
{
var module = await _runtime.LoadModule("./_content/BootstrapBlazor/modules/serial.js")
?? throw new InvalidOperationException("Load serial module failed");
var module = await _runtime.LoadModule("./_content/BootstrapBlazor/modules/serial.js");

IsSupport = await module.InvokeAsync<bool>("init", _serialPortId);
return module;
Expand Down
1 change: 1 addition & 0 deletions test/UnitTest/Services/SerialServiceTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ public class SerialServiceTest : BootstrapBlazorTestBase
[Fact]
public async Task GetPort_Ok()
{
// https://itldg.github.io/web-serial-debug/?wt.mc_id=DT-MVP-5004174 网页串口调试工具
Context.JSInterop.Setup<bool>("init", matcher => matcher.Arguments.Count == 1 && (matcher.Arguments[0]?.ToString()?.StartsWith("bb_serial_") ?? false)).SetResult(true);
Context.JSInterop.Setup<bool>("getPort", matcher => matcher.Arguments.Count == 1 && (matcher.Arguments[0]?.ToString()?.StartsWith("bb_serial_") ?? false)).SetResult(true);
Context.JSInterop.Setup<bool>("open", matcher => matcher.Arguments.Count == 4 && (matcher.Arguments[0]?.ToString()?.StartsWith("bb_serial_") ?? false)).SetResult(true);
Expand Down