From 21f92a299d671dbeb76de4ad1b5755baf5cd9bd5 Mon Sep 17 00:00:00 2001 From: openclaw-bot Date: Thu, 28 May 2026 22:07:25 +0000 Subject: [PATCH] test(#1461/#1468/#1470): source-grep regression guards (covers shipped fixes) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Added AFTER #1471 fix commits — these are regression guards (not red-green TDD per se) that assert the shipped behavior stays applied. - test-mobile-page-actions-presence.js: index.html script tag + filter-toggle / pause mirror, score-toast popover, bottom-nav More sheet mirrors, bounded retry, route-change close - test-issue-1468-no-unknown-channel.js: assert offending `payload.channel || "unknown"` is gone + `if (!payload.channel) continue` is present in channels.js - test-issue-1470-node-tile-helper.js: assert _applyTilesToNodeMap helper exists, both inset-map call-sites use it (no remaining hardcoded OSM tileLayer in nodes.js), roles.js exports window.getActiveTileProvider Wired into test-all.sh. --- test-all.sh | 5 ++ test-issue-1468-no-unknown-channel.js | 39 ++++++++++++++++ test-issue-1470-node-tile-helper.js | 55 ++++++++++++++++++++++ test-mobile-page-actions-presence.js | 66 +++++++++++++++++++++++++++ 4 files changed, 165 insertions(+) create mode 100644 test-issue-1468-no-unknown-channel.js create mode 100644 test-issue-1470-node-tile-helper.js create mode 100644 test-mobile-page-actions-presence.js diff --git a/test-all.sh b/test-all.sh index 95e555ac..a1ad5ec4 100755 --- a/test-all.sh +++ b/test-all.sh @@ -45,6 +45,11 @@ node test-issue-1450-logo-aspect.js node test-issue-1454-channels-toggle.js node test-issue-1456-score-labels.js +# #1461 mobile UX overhaul + #1468 channel-synthesis + #1470 node-detail tile helper +node test-mobile-page-actions-presence.js +node test-issue-1468-no-unknown-channel.js +node test-issue-1470-node-tile-helper.js + echo "" echo "═══════════════════════════════════════" echo " All tests passed" diff --git a/test-issue-1468-no-unknown-channel.js b/test-issue-1468-no-unknown-channel.js new file mode 100644 index 00000000..f3480f29 --- /dev/null +++ b/test-issue-1468-no-unknown-channel.js @@ -0,0 +1,39 @@ +/** + * #1468 — drop client-side "unknown" channel synthesis. + * + * Added AFTER #1471's fix commit — these tests assert the fix stays applied + * (regression guards, not red-green TDD per se). + * + * The buggy code did: `var channelName = payload.channel || 'unknown';` + * which synthesized a literal "unknown" channel row in the sidebar when + * a CHAN message arrived without a decoded channel name. The fix drops + * those rows entirely with `if (!payload.channel) continue;`. + * + * Source-grep invariants — reverting the fix breaks these. + */ +'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 channelsSrc = fs.readFileSync( + path.join(__dirname, 'public', 'channels.js'), 'utf8'); + +console.log('\n=== #1468 A: offending fallback is gone ==='); +assert( + !/payload\.channel\s*\|\|\s*['"]unknown['"]/.test(channelsSrc), + 'channels.js no longer contains `payload.channel || "unknown"`'); + +console.log('\n=== #1468 B: new drop logic is present ==='); +assert( + /if\s*\(\s*!\s*payload\.channel\s*\)\s*continue\s*;/.test(channelsSrc), + 'channels.js drops CHAN payloads with no channel name (if (!payload.channel) continue)'); + +console.log(`\n#1468 results: ${passed} passed, ${failed} failed`); +process.exit(failed === 0 ? 0 : 1); diff --git a/test-issue-1470-node-tile-helper.js b/test-issue-1470-node-tile-helper.js new file mode 100644 index 00000000..3fc241bb --- /dev/null +++ b/test-issue-1470-node-tile-helper.js @@ -0,0 +1,55 @@ +/** + * #1470 — node-detail map inset honors customizer dark-tile provider. + * + * Added AFTER #1471's fix commit — these tests assert the fix stays applied + * (regression guards, not red-green TDD per se). + * + * The buggy code hardcoded `L.tileLayer('https://{s}.tile.openstreetmap.org/...')` + * at both inset-map call-sites in nodes.js, ignoring the customizer dark-tile + * pick. The fix routes both call-sites through a new _applyTilesToNodeMap + * helper that reads from MC_TILE_PROVIDERS via window.getActiveTileProvider(). + * + * Source-grep invariants — reverting the fix breaks these. + */ +'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 nodesSrc = fs.readFileSync( + path.join(__dirname, 'public', 'nodes.js'), 'utf8'); +const rolesSrc = fs.readFileSync( + path.join(__dirname, 'public', 'roles.js'), 'utf8'); + +console.log('\n=== #1470 A: _applyTilesToNodeMap helper exists in nodes.js ==='); +assert( + /function\s+_applyTilesToNodeMap\s*\(/.test(nodesSrc), + 'nodes.js defines function _applyTilesToNodeMap(map)'); +// At least 2 call-sites (the 2 inset-map render paths) +var callCount = (nodesSrc.match(/_applyTilesToNodeMap\s*\(/g) || []).length; +assert( + callCount >= 3, // 1 definition + ≥2 call-sites + 'nodes.js calls _applyTilesToNodeMap at >= 2 inset-map render sites (found ' + + (callCount - 1) + ' calls)'); + +console.log('\n=== #1470 B: no remaining hardcoded OSM tileLayer in nodes.js ==='); +assert( + !/L\.tileLayer\(\s*['"]https:\/\/\{s\}\.tile\.openstreetmap\.org\//.test(nodesSrc), + 'nodes.js no longer hardcodes OSM tileLayer for inset maps'); + +console.log('\n=== #1470 C: roles.js exports getActiveTileProvider ==='); +assert( + /window\.getActiveTileProvider\s*=\s*function/.test(rolesSrc), + 'roles.js defines window.getActiveTileProvider'); +assert( + /MC_TILE_PROVIDERS/.test(rolesSrc) && /MC_getDarkTileProvider/.test(rolesSrc), + 'roles.js consults MC_TILE_PROVIDERS + MC_getDarkTileProvider registry'); + +console.log(`\n#1470 results: ${passed} passed, ${failed} failed`); +process.exit(failed === 0 ? 0 : 1); diff --git a/test-mobile-page-actions-presence.js b/test-mobile-page-actions-presence.js new file mode 100644 index 00000000..fa649de8 --- /dev/null +++ b/test-mobile-page-actions-presence.js @@ -0,0 +1,66 @@ +/** + * #1461/#1467 — mobile-page-actions.js presence + handler invariants. + * + * Added AFTER #1471's fix commit — these tests assert the fix stays applied + * (regression guards, not red-green TDD per se). + * + * Source-grep invariants (cheap, deterministic). Reverting the production + * code must break these. + */ +'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 indexHtml = fs.readFileSync( + path.join(__dirname, 'public', 'index.html'), 'utf8'); +const mpaSrc = fs.readFileSync( + path.join(__dirname, 'public', 'mobile-page-actions.js'), 'utf8'); + +console.log('\n=== #1461/#1467 A: index.html loads mobile-page-actions.js ==='); +assert( + /]*src=["']mobile-page-actions\.js\?v=__BUST__["']/.test(indexHtml), + 'index.html includes