Fix camera onboarding and consolidate device management for v0.1.33

This commit is contained in:
Codex
2026-10-05 18:23:25 +08:00
parent eef46f6ec0
commit 675d31c01f
11 changed files with 136 additions and 14 deletions
+26
View File
@@ -49,3 +49,29 @@ test('culture and property entry requires its separate permission',()=>{
assert.match(output.innerHTML,/data-family-section/);assert.doesNotMatch(output.innerHTML,/data-heritage-kind/);
c.currentUser.heritageAccess='read';c.renderHeritageHome();assert.match(output.innerHTML,/data-heritage-kind/);
});
test('video device cards expose a single configuration entry with correct scope',()=>{
const devices=fs.readFileSync('web/devices.js','utf8');
const c=vm.createContext({state:{cameras:[]},isAdmin:()=>true,esc:s=>String(s)});
vm.runInContext(part(devices,'function videoDeviceActions(','function deviceCard('),c);
const camera={source:'camera',id:'a'};
assert.match(c.videoDeviceActions(camera),/data-view-device="a".*data-device-source="camera".*data-open-device-tab="cameras"/);
assert.doesNotMatch(c.videoDeviceActions(camera),/查看画面/);
c.state.cameras=[{assetId:'a'}];assert.match(c.videoDeviceActions(camera),/查看画面/);
c.isAdmin=()=>false;assert.doesNotMatch(c.videoDeviceActions(camera),/配置镜头/);
assert.equal(c.videoDeviceActions({source:'device',id:'lamp'}),'');
});
test('monitor wall offers viewing without duplicate device management',()=>{
const live=part(app,'function renderLive()','function updateLiveStatus(');
assert.doesNotMatch(live,/data-edit-camera|data-camera-settings|new-camera/);
assert.match(live,/data-view-device/);
const section=part(html,'<section id="page-live"','<section id="page-playback"');
assert.doesNotMatch(section,/data-action="new-camera"/);
});
test('camera form submits the configured ONVIF port',()=>{
assert.match(html,/name="onvifPort" type="number" value="80" min="1" max="65535"/);
assert.match(app,/onvifPort:Number\(d.onvifPort\)/);
assert.match(app,/port:Number\(f.elements.onvifPort.value\)/);
});