WIP
This commit is contained in:
79
tests/test_security_button.html
Normal file
79
tests/test_security_button.html
Normal file
@ -0,0 +1,79 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Security Button Test</title>
|
||||
<style>
|
||||
body { font-family: Arial, sans-serif; padding: 20px; }
|
||||
.test-result { margin: 10px 0; padding: 10px; border-radius: 4px; }
|
||||
.pass { background: #d4edda; color: #155724; }
|
||||
.fail { background: #f8d7da; color: #721c24; }
|
||||
button { padding: 10px 20px; margin: 10px; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Security Button Test</h1>
|
||||
|
||||
<button id="testSecurityBtn">Test Security Button</button>
|
||||
<button id="testModalBtn">Test Modal Directly</button>
|
||||
|
||||
<div id="results"></div>
|
||||
|
||||
<!-- Mock security modal for testing -->
|
||||
<div id="securitySettingsModal" style="display: none; position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); background: white; border: 2px solid #ccc; padding: 20px; z-index: 1000;">
|
||||
<h2>Security Settings Modal</h2>
|
||||
<p>This is the security settings modal!</p>
|
||||
<button onclick="document.getElementById('securitySettingsModal').style.display='none'">Close</button>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
function addResult(message, isPass) {
|
||||
const div = document.createElement('div');
|
||||
div.className = `test-result ${isPass ? 'pass' : 'fail'}`;
|
||||
div.textContent = message;
|
||||
document.getElementById('results').appendChild(div);
|
||||
}
|
||||
|
||||
// Test if security button exists
|
||||
document.getElementById('testSecurityBtn').addEventListener('click', () => {
|
||||
const securityBtn = document.getElementById('securityBtn');
|
||||
if (securityBtn) {
|
||||
addResult('✅ Security button found in DOM', true);
|
||||
|
||||
// Try to trigger click
|
||||
try {
|
||||
securityBtn.click();
|
||||
addResult('✅ Security button click triggered', true);
|
||||
} catch (error) {
|
||||
addResult('❌ Error clicking security button: ' + error.message, false);
|
||||
}
|
||||
} else {
|
||||
addResult('❌ Security button not found in DOM', false);
|
||||
}
|
||||
});
|
||||
|
||||
// Test modal directly
|
||||
document.getElementById('testModalBtn').addEventListener('click', () => {
|
||||
const modal = document.getElementById('securitySettingsModal');
|
||||
if (modal) {
|
||||
modal.style.display = 'block';
|
||||
addResult('✅ Modal opened directly', true);
|
||||
} else {
|
||||
addResult('❌ Modal not found', false);
|
||||
}
|
||||
});
|
||||
|
||||
// Check if security button exists on page load
|
||||
window.addEventListener('load', () => {
|
||||
const securityBtn = document.getElementById('securityBtn');
|
||||
addResult('Security button exists on load: ' + (securityBtn ? 'YES' : 'NO'), !!securityBtn);
|
||||
|
||||
if (securityBtn) {
|
||||
addResult('Security button text: "' + securityBtn.textContent + '"', true);
|
||||
addResult('Security button has click handler: ' + (securityBtn.onclick ? 'YES' : 'NO'), !!securityBtn.onclick);
|
||||
}
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user