diff --git a/index.html b/index.html index dda1d88..ea181e4 100644 --- a/index.html +++ b/index.html @@ -92,7 +92,7 @@

Ruh Al Tarikh

0 - diff --git a/js/app.js b/js/app.js index 1e6898a..3852588 100644 --- a/js/app.js +++ b/js/app.js @@ -100,20 +100,6 @@ const DOM = { themeMenu: document.getElementById('themeMenu'), episodesNavBtn: document.querySelector('[data-action="scroll-to-episodes"]'), episodesSection: document.getElementById('episodesSection'), - episodesNavBtn: document.querySelector('[data-action="scroll-to-episodes"]'), - episodesSection: document.getElementById('episodesSection'), - episodesNavBtn: document.querySelector('[data-action="scroll-to-episodes"]'), - episodesSection: document.getElementById('episodesSection'), - episodesNavBtn: document.querySelector('[data-action="scroll-to-episodes"]'), - episodesSection: document.getElementById('episodesSection'), - episodesNavBtn: document.querySelector('[data-action="scroll-to-episodes"]'), - episodesSection: document.getElementById('episodesSection'), - episodesNavBtn: document.querySelector('[data-action="scroll-to-episodes"]'), - episodesSection: document.getElementById('episodesSection'), - episodesNavBtn: document.querySelector('[data-action="scroll-to-episodes"]'), - episodesSection: document.getElementById('episodesSection'), - episodesNavBtn: document.querySelector('[data-action="scroll-to-episodes"]'), - episodesSection: document.getElementById('episodesSection'), menuToggle: document.getElementById('menuToggleBtn'), scrollToTop: document.getElementById('scrollToTop'), @@ -1042,83 +1028,6 @@ function bindEvents() { }); } - // Navbar Episodes Scroll - if (DOM.episodesNavBtn && DOM.episodesSection) { - DOM.episodesNavBtn.addEventListener('click', () => { - DOM.episodesSection.scrollIntoView({ behavior: 'smooth' }); - if (document.body.classList.contains('mobile-nav-active')) { - document.body.classList.remove('mobile-nav-active'); - if (DOM.menuToggle) DOM.menuToggle.setAttribute('aria-expanded', 'false'); - } - }); - } - - // Navbar Episodes Scroll - if (DOM.episodesNavBtn && DOM.episodesSection) { - DOM.episodesNavBtn.addEventListener('click', () => { - DOM.episodesSection.scrollIntoView({ behavior: 'smooth' }); - if (document.body.classList.contains('mobile-nav-active')) { - document.body.classList.remove('mobile-nav-active'); - if (DOM.menuToggle) DOM.menuToggle.setAttribute('aria-expanded', 'false'); - } - }); - } - - // Navbar Episodes Scroll - if (DOM.episodesNavBtn && DOM.episodesSection) { - DOM.episodesNavBtn.addEventListener('click', () => { - DOM.episodesSection.scrollIntoView({ behavior: 'smooth' }); - if (document.body.classList.contains('mobile-nav-active')) { - document.body.classList.remove('mobile-nav-active'); - if (DOM.menuToggle) DOM.menuToggle.setAttribute('aria-expanded', 'false'); - } - }); - } - - // Navbar Episodes Scroll - if (DOM.episodesNavBtn && DOM.episodesSection) { - DOM.episodesNavBtn.addEventListener('click', () => { - DOM.episodesSection.scrollIntoView({ behavior: 'smooth' }); - if (document.body.classList.contains('mobile-nav-active')) { - document.body.classList.remove('mobile-nav-active'); - if (DOM.menuToggle) DOM.menuToggle.setAttribute('aria-expanded', 'false'); - } - }); - } - - // Navbar Episodes Scroll - if (DOM.episodesNavBtn && DOM.episodesSection) { - DOM.episodesNavBtn.addEventListener('click', () => { - DOM.episodesSection.scrollIntoView({ behavior: 'smooth' }); - if (document.body.classList.contains('mobile-nav-active')) { - document.body.classList.remove('mobile-nav-active'); - if (DOM.menuToggle) DOM.menuToggle.setAttribute('aria-expanded', 'false'); - } - }); - } - - // Navbar Episodes Scroll - if (DOM.episodesNavBtn && DOM.episodesSection) { - DOM.episodesNavBtn.addEventListener('click', () => { - DOM.episodesSection.scrollIntoView({ behavior: 'smooth' }); - if (document.body.classList.contains('mobile-nav-active')) { - document.body.classList.remove('mobile-nav-active'); - if (DOM.menuToggle) DOM.menuToggle.setAttribute('aria-expanded', 'false'); - } - }); - } - - // Navbar Episodes Scroll - if (DOM.episodesNavBtn && DOM.episodesSection) { - DOM.episodesNavBtn.addEventListener('click', () => { - DOM.episodesSection.scrollIntoView({ behavior: 'smooth' }); - if (document.body.classList.contains('mobile-nav-active')) { - document.body.classList.remove('mobile-nav-active'); - if (DOM.menuToggle) DOM.menuToggle.setAttribute('aria-expanded', 'false'); - } - }); - } - if (DOM.heroBtn) DOM.heroBtn.addEventListener('click', () => AppState.hero && openVideo(AppState.hero)); if (DOM.heroSave) DOM.heroSave.addEventListener('click', () => AppState.hero && toggleWatchLater(AppState.hero)); @@ -1344,6 +1253,15 @@ function bindEvents() { } } } + + // Dashboard toggle + if (key === 'd' && DOM.dashboardModal) { + if (DOM.dashboardModal.style.display === 'block') { + closeDashboard(); + } else { + openDashboard(); + } + } }); // Mouse move effect for cards diff --git a/tests/shortcut.spec.js b/tests/shortcut.spec.js index e8ccadf..9eeab36 100644 --- a/tests/shortcut.spec.js +++ b/tests/shortcut.spec.js @@ -1 +1,15 @@ -import{test,expect}from"@playwright/test";test("search shortcut / works",async({page:t})=>{await t.goto("http://localhost:5173"),await t.keyboard.press("/");t=await t.evaluate(()=>document.activeElement===document.getElementById("searchInput"));expect(t).toBe(!0)}); \ No newline at end of file +import { test, expect } from "@playwright/test"; + +test("search shortcut / works", async ({ page }) => { + await page.goto("http://localhost:5173"); + await page.keyboard.press("/"); + const isFocused = await page.evaluate(() => document.activeElement === document.getElementById("searchInput")); + expect(isFocused).toBe(true); +}); + +test("dashboard shortcut D works", async ({ page }) => { + await page.goto("http://localhost:5173"); + await page.keyboard.press("d"); + const isVisible = await page.evaluate(() => document.getElementById("dashboardModal").style.display === "block"); + expect(isVisible).toBe(true); +});