From c0de33a952a92e03e02162fa1962274b3738593c Mon Sep 17 00:00:00 2001 From: openclaw-bot Date: Mon, 25 May 2026 19:12:17 +0000 Subject: [PATCH] =?UTF-8?q?test(#1360):=20RED=20=E2=80=94=20assert=20pill?= =?UTF-8?q?=20body=20emits=20letter=20+=20count?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Pure-string assertions over public/map.js mirroring #1356 pattern. Fails on current master where pill body is just `letter`. Wires test-issue-1360-pill-letter-count.js into deploy.yml right after test-issue-1356-map-a11y.js. --- .github/workflows/deploy.yml | 1 + test-issue-1360-pill-letter-count.js | 70 ++++++++++++++++++++++++++++ 2 files changed, 71 insertions(+) create mode 100644 test-issue-1360-pill-letter-count.js diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 580e8381..841f8d2d 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -107,6 +107,7 @@ jobs: node test-area-filter.js node test-issue-1293-marker-shapes.js node test-issue-1356-map-a11y.js + node test-issue-1360-pill-letter-count.js - name: Verify proto syntax run: | diff --git a/test-issue-1360-pill-letter-count.js b/test-issue-1360-pill-letter-count.js new file mode 100644 index 00000000..fe0f9efe --- /dev/null +++ b/test-issue-1360-pill-letter-count.js @@ -0,0 +1,70 @@ +/** + * #1360 — regression(map): #1357 cluster role pills lost the count number. + * + * Pill body must contain BOTH the role letter (WCAG carrier from #1356) + * AND the per-role count (the data sighted operators need at a glance). + * + * Pure-string assertions over public/map.js (mirrors #1356 test pattern). + */ +'use strict'; + +const fs = require('fs'); +const path = require('path'); + +let passed = 0, failed = 0; +function assert(cond, msg) { + if (cond) { passed++; console.log(' ✓ ' + msg); } + else { failed++; console.error(' ✗ ' + msg); } +} + +const mapSrc = fs.readFileSync(path.join(__dirname, 'public', 'map.js'), 'utf8'); + +console.log('\n=== #1360: pill body emits letter + count (not letter alone) ==='); + +// A. Source must concatenate letter and n (the count) into the pill body. +// Acceptable shapes: `letter + n`, `letter + String(n)`, `(letter + n)`. +const concatRe = /letter\s*\+\s*(?:String\()?\s*n\b/; +assert(concatRe.test(mapSrc), + 'map.js concatenates letter + n (or letter + String(n)) for pill body'); + +// B. The pill body must NOT be bare `letter` followed immediately by ''. +// i.e. reject `... + letter + ''` with nothing in between. +const bareLetterRe = /\+\s*letter\s*\+\s*['"]<\/span>/; +assert(!bareLetterRe.test(mapSrc), + 'pill body is no longer just letter (no `+ letter + ""` pattern)'); + +// C. Simulate makeClusterIcon by exercising __meshcoreMapInternals if loadable +// in Node — fallback: pattern-check the rendered HTML template. +// map.js is browser-oriented (Leaflet IIFE) so we string-test the template. +// Build a synthetic expected pill body: a letter from R/C/M/S/O + digits. +// The assertion below validates the rendered shape via regex over the +// template's emitted output pattern. +const pillTemplateRe = /