-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest-dialog.js
More file actions
74 lines (60 loc) · 2.23 KB
/
Copy pathtest-dialog.js
File metadata and controls
74 lines (60 loc) · 2.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
/**
* Simple test script for the ConfirmationDialog
* Run this in browser console when module is loaded
*
* Usage:
* 1. Open FoundryVTT with the module loaded
* 2. Open browser console
* 3. Run: testConfirmationDialog()
*/
async function testConfirmationDialog() {
console.log('Testing ConfirmationDialog...');
try {
// Test using the UIHelper method (which should use the new dialog)
console.log('Testing via UIHelper.confirmDialog...');
const result = await game.modules.get('bardic-inspiration').api.UIHelper.confirmDialog(
'Browser Test Dialog',
'This is a test message to verify the dialog works correctly in the browser.',
{
yesLabel: 'Works!',
noLabel: 'Broken',
type: 'warning',
icon: 'fas fa-vial'
}
);
console.log('Dialog result:', result);
} catch (error) {
console.error('Dialog test failed:', error);
console.error('Error stack:', error.stack);
}
}
async function testDirectDialogCreation() {
console.log('Testing direct ConfirmationDialog creation...');
try {
// Import the dialog directly
const module = game.modules.get('bardic-inspiration');
console.log('Module API:', module?.api);
// Try to access the ConfirmationDialog class
const { ConfirmationDialog } = await import('./dist/ConfirmationDialog-sD3IeDIQ.js');
console.log('ConfirmationDialog class:', ConfirmationDialog);
// Create instance manually
const dialog = new ConfirmationDialog(
'Direct Test',
'Testing direct dialog creation',
{ type: 'info' }
);
console.log('Dialog instance created:', dialog);
console.log('Dialog template:', dialog.template);
console.log('Dialog options:', dialog.options);
// Try to render
await dialog.render(true);
console.log('Dialog rendered successfully');
} catch (error) {
console.error('Direct test failed:', error);
console.error('Error stack:', error.stack);
}
}
// Export for use in console
window.testConfirmationDialog = testConfirmationDialog;
window.testDirectDialogCreation = testDirectDialogCreation;
console.log('Dialog test functions loaded. Run testConfirmationDialog() or testDirectDialogCreation() in console.');