Build and revise procedural 3D assets with your coding agent. Local MCP server, CLI and TypeScript engine with rendered review, editable source and GLB export.
JavaScript 3d3d-assets3d-modelingagent-skillsagent-toolsai-agentsasset-pipelinecligame-assetsglbgltfmcpmcp-servermodel-context-protocolprocedural-generationprocedural-modelingtext-to-3dthreejstypescript
import test from 'node:test';import assert from 'node:assert/strict';import {createFullscreenControl} from '../src/game/fullscreen.mjs';
function fixture(){const listeners=new Set(),states=[],errors=[],document={fullscreenEnabled:true,fullscreenElement:null,addEventListener:(_,f)=>listeners.add(f),removeEventListener:(_,f)=>listeners.delete(f),async exitFullscreen(){this.fullscreenElement=null;for(const f of listeners)f();}},element={async requestFullscreen(){document.fullscreenElement=element;for(const f of listeners)f();}},control=createFullscreenControl({element,document,onChange:s=>states.push(s),onError:e=>errors.push(e)});return {document,element,control,states,errors,listeners};}
test('fullscreen uses the scene shell, exits, and follows browser Escape changes',async()=>{const f=fixture();assert.equal(f.states.at(-1),false);await f.control.toggle();assert.equal(f.document.fullscreenElement,f.element);assert.equal(f.states.at(-1),true);await f.control.toggle();assert.equal(f.states.at(-1),false);await f.control.toggle();await f.document.exitFullscreen();assert.equal(f.states.at(-1),false);f.control.dispose();assert.equal(f.listeners.size,0);});
test('browser denial is reported without claiming fullscreen or throwing',async()=>{const f=fixture();f.element.requestFullscreen=()=>Promise.reject(Error('Denied'));await f.control.toggle();assert.equal(f.states.at(-1),false);assert.equal(f.errors.length,1);f.control.dispose();});