Fix step definition popup for mobile and escaped quotes

- Replace hover-based Tooltip with click-based popover for mobile support
- Fix pattern extraction regex to handle escaped apostrophes (e.g., l'écran)
- Add dashed underline (1.3px) to indicate clickable steps with definitions
- Enable definitions mode by default
- Regenerate stepDefinitions.ts with correct patterns

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Sylvain Duchesne
2026-01-18 18:25:02 +01:00
parent 3ccfea3892
commit a19bda44e1
4 changed files with 428 additions and 321 deletions
+5 -3
View File
@@ -33,10 +33,12 @@ function extractStepDefinitions(): StepDefinition[] {
const line = lines[i];
// Match Given/When/Then at the start of a line
const match = line.match(/^(Given|When|Then)\s*\(\s*['"`]([^'"`]+)['"`]/);
if (match) {
// Handle escaped quotes in patterns (e.g., 'l\'écran contient')
const match = line?.match(/^(Given|When|Then)\s*\(\s*(['"`])((?:[^\\]|\\.)*?)\2/);
if (match && match[3]) {
const keyword = match[1] as 'Given' | 'When' | 'Then';
const pattern = match[2];
// Unescape the pattern (remove backslashes before quotes)
const pattern = match[3].replace(/\\(['"`])/g, '$1');
// Extract the full function body
const sourceCode = extractFunctionBody(lines, i);