Compare commits
1 Commits
fix/overla
...
fix/59
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
bbc513821f |
11
index.html
11
index.html
@@ -680,7 +680,7 @@ html, body {
|
||||
|
||||
<!-- Footer -->
|
||||
<footer id="footer">
|
||||
<a href="/about" aria-label="About The Door">about</a>
|
||||
<a href="/about.html" aria-label="About The Door">about</a>
|
||||
<button id="safety-plan-btn" aria-label="Open My Safety Plan">my safety plan</button>
|
||||
<button id="clear-chat-btn" aria-label="Clear chat history">clear chat</button>
|
||||
</footer>
|
||||
@@ -1056,15 +1056,6 @@ Sovereignty and service always.`;
|
||||
// Register focus trap on document (always listening, gated by class check)
|
||||
document.addEventListener('keydown', trapFocusInOverlay);
|
||||
|
||||
// Escape key closes crisis overlay (returns focus to chat input)
|
||||
document.addEventListener('keydown', function(e) {
|
||||
if (e.key === 'Escape' && crisisOverlay.classList.contains('active')) {
|
||||
if (!overlayDismissBtn.disabled) {
|
||||
overlayDismissBtn.click();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
overlayDismissBtn.addEventListener('click', function() {
|
||||
if (!overlayDismissBtn.disabled) {
|
||||
crisisOverlay.classList.remove('active');
|
||||
|
||||
24
tests/test_about_link.py
Normal file
24
tests/test_about_link.py
Normal file
@@ -0,0 +1,24 @@
|
||||
import pathlib
|
||||
import unittest
|
||||
|
||||
|
||||
ROOT = pathlib.Path(__file__).resolve().parents[1]
|
||||
INDEX_HTML = ROOT / 'index.html'
|
||||
ABOUT_HTML = ROOT / 'about.html'
|
||||
|
||||
|
||||
class TestAboutLink(unittest.TestCase):
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
cls.html = INDEX_HTML.read_text(encoding='utf-8')
|
||||
|
||||
def test_about_page_exists(self):
|
||||
self.assertTrue(ABOUT_HTML.exists(), 'about.html should exist for static serving')
|
||||
|
||||
def test_footer_about_link_targets_static_about_html(self):
|
||||
self.assertIn('href="/about.html"', self.html)
|
||||
self.assertNotIn('href="/about"', self.html)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
@@ -53,19 +53,5 @@ class TestCrisisOverlayFocusTrap(unittest.TestCase):
|
||||
)
|
||||
|
||||
|
||||
def test_overlay_escape_key_closes_overlay(self):
|
||||
"""Escape key closes crisis overlay and returns focus to chat input."""
|
||||
# Verify the Escape handler exists in the HTML
|
||||
self.assertRegex(
|
||||
self.html,
|
||||
r"e\.key\s*===\s*['"]Escape['"].*crisisOverlay\.classList\.contains\('active'\)",
|
||||
'Expected Escape key handler to check for active crisis overlay.',
|
||||
)
|
||||
self.assertRegex(
|
||||
self.html,
|
||||
r"overlayDismissBtn\.click\(\)",
|
||||
'Expected Escape key handler to trigger overlay dismiss button click.',
|
||||
)
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
|
||||
Reference in New Issue
Block a user