Fix repeated login and forwarding alerts; add detached fullscreen controls
This commit is contained in:
1 parent
c98c67e18b
commit
0668a73d40
6 files changed
+37
-6
No files matched your search
@@ -0,0 +1,24 @@
|
||||
import test from 'node:test';
|
||||
import assert from 'node:assert/strict';
|
||||
import vm from 'node:vm';
|
||||
import {readFileSync} from 'node:fs';
|
||||
|
||||
const source=readFileSync(new URL('./public/app.js',import.meta.url),'utf8');
|
||||
const apply=source.slice(source.indexOf('function applyStation(user){'),source.indexOf("\ndocument.addEventListener('bpq-languagechange'"));
|
||||
|
||||
for(const populated of [false,true]){
|
||||
test(`station login succeeds with ${populated?'existing chat messages':'the initial chat placeholder'}`,()=>{
|
||||
const elements=new Map();
|
||||
const $=selector=>{
|
||||
if(populated&&selector.startsWith('.chat-empty'))return null;
|
||||
if(!elements.has(selector))elements.set(selector,{firstChild:{},closest(){return this;}});
|
||||
return elements.get(selector);
|
||||
};
|
||||
const station={nodeCall:'TEST-7',call:'TEST',alias:'NODE',apps:[],features:{bbs:true,chat:true,winlink:true,monitor:true,radio:true,vara:true}};
|
||||
const context=vm.createContext({$, $$:()=>[],station,document:{},BPQI18n:{t:s=>s},page:'home',navigate(){}});
|
||||
vm.runInContext(apply,context);
|
||||
assert.doesNotThrow(()=>context.applyStation({name:'Sysop',call:'TEST'}));
|
||||
assert.equal($('.wl-account').textContent,'[email protected]');
|
||||
if(!populated)assert.equal($('.chat-empty h2').textContent,'Chat BPQ');
|
||||
});
|
||||
}
|
||||
Reference in new issue
Block a user