diff --git a/src/ui/gm/GMPlayerPrivacySelector.js b/src/ui/gm/GMPlayerPrivacySelector.js index a3e9f51..7e7fde6 100644 --- a/src/ui/gm/GMPlayerPrivacySelector.js +++ b/src/ui/gm/GMPlayerPrivacySelector.js @@ -3,10 +3,30 @@ * * A settings menu entry that allows the GM to select a player and view their privacy settings. * This provides read-only access to all players' privacy panels. + * + * Extends ApplicationV2 to be compatible with FoundryVTT's registerMenu API. */ import { PlayerPrivacyPanel } from '../player/PlayerPrivacyPanel.js'; +// Conditional base class for test compatibility +// At module load time in tests, foundry is undefined → fallback class is used +const _AppBase = + typeof foundry !== 'undefined' && + foundry.applications?.api?.ApplicationV2 + ? foundry.applications.api.ApplicationV2 + : class _FallbackApp { + static DEFAULT_OPTIONS = {}; + get rendered() { return this._rendered ?? false; } + set rendered(v) { this._rendered = v; } + get element() { return this._element ?? null; } + set element(v) { this._element = v; } + async render() { this._rendered = true; } + async close() { this._rendered = false; } + _onRender() {} + _onClose() {} + }; + /** * Static references to DI dependencies (set during module initialization). */ @@ -68,12 +88,26 @@ function _registerSettingsMenu() { /** * GM Player Privacy Selector Menu class. * When instantiated by Foundry, it creates a user selector dialog. + * Extends ApplicationV2 (or fallback) for Foundry settings menu compatibility. */ -export class GMPlayerPrivacySelectorMenu { +export class GMPlayerPrivacySelectorMenu extends _AppBase { + static DEFAULT_OPTIONS = { + id: 'scrying-pool-gm-privacy-selector', + classes: ['scrying-pool', 'gm-privacy-selector'], + window: { + title: 'Player Privacy Selector', + resizable: false, + width: 400, + height: 'auto', + }, + position: {}, + }; + /** * @param {object} [options] - Foundry options (unused, but required by settings menu API) */ constructor(options = {}) { + super(options); this._adapter = _adapter; this._playerPrivacyManager = _playerPrivacyManager; this._options = options;