@shardworks/spider-apparatus 0.1.133 → 0.1.135
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +8 -8
- package/src/static/spider-ui.test.ts +70 -0
- package/src/static/spider.js +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shardworks/spider-apparatus",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.135",
|
|
4
4
|
"license": "ISC",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -19,13 +19,13 @@
|
|
|
19
19
|
"hono": "^4.7.11",
|
|
20
20
|
"yaml": "^2.0.0",
|
|
21
21
|
"zod": "4.3.6",
|
|
22
|
-
"@shardworks/
|
|
23
|
-
"@shardworks/
|
|
24
|
-
"@shardworks/
|
|
25
|
-
"@shardworks/
|
|
26
|
-
"@shardworks/animator-apparatus": "0.1.
|
|
27
|
-
"@shardworks/
|
|
28
|
-
"@shardworks/
|
|
22
|
+
"@shardworks/nexus-core": "0.1.135",
|
|
23
|
+
"@shardworks/stacks-apparatus": "0.1.135",
|
|
24
|
+
"@shardworks/clerk-apparatus": "0.1.135",
|
|
25
|
+
"@shardworks/tools-apparatus": "0.1.135",
|
|
26
|
+
"@shardworks/animator-apparatus": "0.1.135",
|
|
27
|
+
"@shardworks/codexes-apparatus": "0.1.135",
|
|
28
|
+
"@shardworks/fabricator-apparatus": "0.1.135"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
31
|
"@types/node": "25.5.0"
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Spider UI — static asset regression tests.
|
|
3
|
+
*
|
|
4
|
+
* These tests verify the HTML structure generated by spider.js for the rig
|
|
5
|
+
* list table. Because spider.js is a vanilla-JS IIFE (no modules), we
|
|
6
|
+
* validate the source text directly to ensure structural invariants hold.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import { describe, it } from 'node:test';
|
|
10
|
+
import assert from 'node:assert/strict';
|
|
11
|
+
import { readFileSync } from 'node:fs';
|
|
12
|
+
import { resolve, dirname } from 'node:path';
|
|
13
|
+
import { fileURLToPath } from 'node:url';
|
|
14
|
+
|
|
15
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
16
|
+
const spiderJs = readFileSync(resolve(__dirname, 'spider.js'), 'utf-8');
|
|
17
|
+
|
|
18
|
+
// ── Rig list row structure ──────────────────────────────────────────────
|
|
19
|
+
|
|
20
|
+
describe('spider.js rig list row HTML', () => {
|
|
21
|
+
it('renders the writ-title cell as a rig-link anchor', () => {
|
|
22
|
+
// The row template should contain a <td> with a rig-link anchor for the
|
|
23
|
+
// writ title (the second <td> in each row). We match the template
|
|
24
|
+
// fragment that builds the writ-title cell.
|
|
25
|
+
const writTitleCellPattern =
|
|
26
|
+
/<td><a class="rig-link" href="#" data-rig-id="[^"]*"\s*>\s*'\s*\+\s*esc\(writTitle\)/;
|
|
27
|
+
assert.match(
|
|
28
|
+
spiderJs,
|
|
29
|
+
writTitleCellPattern,
|
|
30
|
+
'writ-title cell should be a clickable rig-link anchor',
|
|
31
|
+
);
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
it('renders the rig-id cell as a rig-link anchor', () => {
|
|
35
|
+
const rigIdCellPattern =
|
|
36
|
+
/<td><a class="rig-link" href="#" data-rig-id="[^"]*"\s*>\s*'\s*\+\s*esc\(rig\.id\)/;
|
|
37
|
+
assert.match(
|
|
38
|
+
spiderJs,
|
|
39
|
+
rigIdCellPattern,
|
|
40
|
+
'rig-id cell should be a clickable rig-link anchor',
|
|
41
|
+
);
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
it('writ-title and rig-id cells share the same rig-link class', () => {
|
|
45
|
+
// Both cells must use the same class so the click handler wires them
|
|
46
|
+
// identically. Count rig-link anchors in the row template.
|
|
47
|
+
const rowTemplateMatch = spiderJs.match(
|
|
48
|
+
/var rows = filtered\.map\(function \(rig\) \{[\s\S]*?\.join\(''\)/,
|
|
49
|
+
);
|
|
50
|
+
assert.ok(rowTemplateMatch, 'should find the row template block');
|
|
51
|
+
const rowTemplate = rowTemplateMatch[0];
|
|
52
|
+
|
|
53
|
+
const rigLinkCount = (rowTemplate.match(/class="rig-link"/g) || []).length;
|
|
54
|
+
assert.ok(
|
|
55
|
+
rigLinkCount >= 2,
|
|
56
|
+
`expected at least 2 rig-link anchors in the row template, found ${rigLinkCount}`,
|
|
57
|
+
);
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
it('writ-title cell is NOT rendered as plain text', () => {
|
|
61
|
+
// Regression guard: the old pattern was just '<td>' + esc(writTitle) + '</td>'
|
|
62
|
+
// with no anchor. Ensure that pattern no longer exists.
|
|
63
|
+
const plainTitlePattern = /'<td>'\s*\+\s*esc\(writTitle\)\s*\+\s*'<\/td>'/;
|
|
64
|
+
assert.doesNotMatch(
|
|
65
|
+
spiderJs,
|
|
66
|
+
plainTitlePattern,
|
|
67
|
+
'writ-title cell must not be rendered as plain (non-linked) text',
|
|
68
|
+
);
|
|
69
|
+
});
|
|
70
|
+
});
|
package/src/static/spider.js
CHANGED
|
@@ -205,7 +205,7 @@
|
|
|
205
205
|
var writTitle = (writLookup[rig.writId] && writLookup[rig.writId].title) || '\u2014';
|
|
206
206
|
return '<tr>' +
|
|
207
207
|
'<td>' + badgeHtml(rig.status) + '</td>' +
|
|
208
|
-
'<td>' + esc(writTitle) + '</td>' +
|
|
208
|
+
'<td><a class="rig-link" href="#" data-rig-id="' + esc(rig.id) + '">' + esc(writTitle) + '</a></td>' +
|
|
209
209
|
'<td>' + esc(engineSummary(rig.engines)) + '</td>' +
|
|
210
210
|
'<td><a class="rig-link" href="#" data-rig-id="' + esc(rig.id) + '">' + esc(rig.id) + '</a></td>' +
|
|
211
211
|
'<td><a href="/pages/clerk/?writ=' + esc(rig.writId) + '">' + esc(rig.writId) + '</a></td>' +
|