-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbutton-test.js
More file actions
70 lines (60 loc) · 2.26 KB
/
button-test.js
File metadata and controls
70 lines (60 loc) · 2.26 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
// Button Test Script for Content Moderation Extension
console.log('=== BUTTON TEST SCRIPT ===');
// Wait for DOM to be ready
document.addEventListener('DOMContentLoaded', () => {
console.log('DOM ready, starting button tests...');
// List of all buttons to test
const buttonsToTest = [
'flagBtn',
'escalateBtn',
'blockBtn',
'startTimer',
'resetTimer',
'toggleImageFilter',
'openSettings',
'testButton',
'openDashboard',
'refreshMetrics',
'mindfulMoment',
'configureAI',
'reloadContentScript'
];
// Test each button
buttonsToTest.forEach(buttonId => {
const button = document.getElementById(buttonId);
if (button) {
console.log(`✅ Button found: ${buttonId}`);
// Check if button is visible and enabled
const style = window.getComputedStyle(button);
const isVisible = style.display !== 'none' && style.visibility !== 'hidden';
const isEnabled = !button.disabled;
console.log(` - Visible: ${isVisible}`);
console.log(` - Enabled: ${isEnabled}`);
console.log(` - Pointer events: ${style.pointerEvents}`);
// Test click event
button.addEventListener('click', (e) => {
console.log(`🎯 Button clicked: ${buttonId}`, e);
});
} else {
console.error(`❌ Button not found: ${buttonId}`);
}
});
// Test grayscale slider
const grayscaleSlider = document.getElementById('quickGrayscale');
if (grayscaleSlider) {
console.log('✅ Grayscale slider found');
grayscaleSlider.addEventListener('input', (e) => {
console.log('🎯 Grayscale slider changed:', e.target.value);
});
} else {
console.error('❌ Grayscale slider not found');
}
console.log('=== BUTTON TEST COMPLETED ===');
});
// Also run immediately if DOM is already ready
if (document.readyState !== 'loading') {
console.log('DOM already ready, running button tests immediately');
// Trigger the test
const event = new Event('DOMContentLoaded');
document.dispatchEvent(event);
}