Skip to content

Commit e551676

Browse files
committed
Stabilize release browser checks
1 parent 64a01b5 commit e551676

2 files changed

Lines changed: 24 additions & 6 deletions

File tree

src/PrompterOne.Shared/wwwroot/editor/editor-monaco.js

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { ensureTpsLanguage, getTpsLanguageSupport } from "./editor-monaco-tps-language.js";
22

33
const cssClassPrefix = "po";
4-
const largeDraftDecorationViewportLinePadding = 24;
4+
const largeDraftDecorationViewportLinePadding = 12;
55
const visibleRangeDecorationCharacterThreshold = 0;
66
const largeDraftTextNotificationCharacterThreshold = 16000;
77
const largeDraftTextNotificationDelayMs = 750;
@@ -13,6 +13,7 @@ const findMatchClassName = `${cssClassPrefix}-find-match`;
1313
const floatingToolbarMinimumTop = 44;
1414
const floatingToolbarSelectionOffset = 5;
1515
const hostStates = new WeakMap();
16+
const frontMatterEndLineCache = new WeakMap();
1617
const gutterSelector = ".margin-view-overlays";
1718
const minimapSelector = ".minimap";
1819
const numericWpmRegex = /^(?<wpm>\d+)\s*WPM$/i;
@@ -1234,17 +1235,30 @@ function getDecorationLineRanges(state, model) {
12341235
}
12351236

12361237
function resolveFrontMatterEndLine(model) {
1238+
const versionId = typeof model.getVersionId === "function"
1239+
? model.getVersionId()
1240+
: -1;
1241+
const cached = frontMatterEndLineCache.get(model);
1242+
if (cached?.versionId === versionId) {
1243+
return cached.endLineNumber;
1244+
}
1245+
1246+
let endLineNumber = 0;
12371247
if (model.getLineCount() < 2 || model.getLineContent(1) !== frontMatterDelimiter) {
1238-
return 0;
1248+
frontMatterEndLineCache.set(model, { endLineNumber, versionId });
1249+
return endLineNumber;
12391250
}
12401251

1252+
endLineNumber = 1;
12411253
for (let lineNumber = 2; lineNumber <= model.getLineCount(); lineNumber++) {
12421254
if (model.getLineContent(lineNumber) === frontMatterDelimiter) {
1243-
return lineNumber;
1255+
endLineNumber = lineNumber;
1256+
break;
12441257
}
12451258
}
12461259

1247-
return 1;
1260+
frontMatterEndLineCache.set(model, { endLineNumber, versionId });
1261+
return endLineNumber;
12481262
}
12491263

12501264
function shouldUseVisibleRangeDecorations(state) {

tests/PrompterOne.Web.UITests.Reader/Teleprompter/TeleprompterCueRenderingFlowTests.cs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,9 @@ private static async Task<ILocator> AdvanceUntilActiveWordContainsAsync(
285285
return activeWord;
286286
}
287287

288-
await page.GetByTestId(UiTestIds.Teleprompter.NextWord).ClickAsync();
288+
await UiInteractionDriver.ClickAndContinueAsync(
289+
page.GetByTestId(UiTestIds.Teleprompter.NextWord),
290+
noWaitAfter: true);
289291
await Expect(activeWord).Not.ToHaveTextAsync(currentText, new()
290292
{
291293
Timeout = BrowserTestConstants.Timing.DefaultVisibleTimeoutMs
@@ -311,7 +313,9 @@ private static async Task ActivateCueMatrixTargetWordAsync(
311313
return;
312314
}
313315

314-
await page.GetByTestId(UiTestIds.Teleprompter.NextWord).ClickAsync();
316+
await UiInteractionDriver.ClickAndContinueAsync(
317+
page.GetByTestId(UiTestIds.Teleprompter.NextWord),
318+
noWaitAfter: true);
315319
}
316320

317321
throw new InvalidOperationException(

0 commit comments

Comments
 (0)