26 lines
1.4 KiB
JavaScript
26 lines
1.4 KiB
JavaScript
#!/usr/bin/env node
|
|
"use strict";
|
|
|
|
const assert = require("assert");
|
|
const fs = require("fs");
|
|
const path = require("path");
|
|
|
|
const html = fs.readFileSync(path.join(__dirname, "workbench", "index.html"), "utf8");
|
|
assert.match(html, /id="width" type="number" min="1" step="0\.01"/);
|
|
assert.match(html, /data-layer="sidewalks" type="checkbox" checked> 路缘与步行带/);
|
|
assert.match(html, /id="scene-preview" type="checkbox"/);
|
|
assert.match(html, /id="selected-junction" hidden/);
|
|
const app = fs.readFileSync(path.join(__dirname, "workbench", "app.js"), "utf8");
|
|
assert.match(app, /async function saveStagedChanges\(\)/);
|
|
assert.match(app, /if \(!await saveStagedChanges\(\)\) return;/);
|
|
assert.match(app, /function stageRoadOverride\(road, changes\)/);
|
|
assert.match(app, /road\.segmentId === selectedRoad\.segmentId/);
|
|
assert.match(app, /sidewalkLeft: rightInput\.checked, sidewalkRight: leftInput\.checked/);
|
|
assert.match(app, /function nativeSurfaceStyle\(feature\)/);
|
|
assert.match(app, /reference: new VectorLayer\(\{ source: source\(\), visible: false/);
|
|
assert.match(app, /scene mode must render fills only/);
|
|
assert.match(app, /scenePreviewToggle\.onchange/);
|
|
assert.match(app, /layers\.sidewalks\.setVisible\(document\.querySelector\('\[data-layer="sidewalks"\]'\)\.checked\)/);
|
|
assert.match(app, /function selectJunction\(feature\)/);
|
|
console.log("road workbench tests passed");
|