|
| 1 | +// Test for Issue #3427: Hide Pause Overlay option |
| 2 | + |
| 3 | +const fs = require('fs'); |
| 4 | +const path = require('path'); |
| 5 | + |
| 6 | +describe('Hide Pause Overlay Feature', () => { |
| 7 | + describe('Menu Configuration', () => { |
| 8 | + let appearanceContent; |
| 9 | + |
| 10 | + beforeAll(() => { |
| 11 | + const appearancePath = path.join(__dirname, '../../menu/skeleton-parts/appearance.js'); |
| 12 | + appearanceContent = fs.readFileSync(appearancePath, 'utf8'); |
| 13 | + }); |
| 14 | + |
| 15 | + test('player_hide_pause_overlay option should exist in appearance.js', () => { |
| 16 | + expect(appearanceContent).toContain('player_hide_pause_overlay'); |
| 17 | + }); |
| 18 | + |
| 19 | + test('player_hide_pause_overlay should use hidePauseOverlay text key', () => { |
| 20 | + expect(appearanceContent).toContain("text: \"hidePauseOverlay\""); |
| 21 | + }); |
| 22 | + |
| 23 | + test('player_hide_pause_overlay should be a switch component', () => { |
| 24 | + // Check that there's a switch component for player_hide_pause_overlay |
| 25 | + const pauseOverlayMatch = appearanceContent.match(/player_hide_pause_overlay:\s*{[^}]*component:\s*"switch"/); |
| 26 | + expect(pauseOverlayMatch).not.toBeNull(); |
| 27 | + }); |
| 28 | + }); |
| 29 | + |
| 30 | + describe('CSS Rules', () => { |
| 31 | + let playerCssContent; |
| 32 | + |
| 33 | + beforeAll(() => { |
| 34 | + const cssPath = path.join(__dirname, '../../js&css/extension/www.youtube.com/appearance/player/player.css'); |
| 35 | + playerCssContent = fs.readFileSync(cssPath, 'utf8'); |
| 36 | + }); |
| 37 | + |
| 38 | + test('CSS should target .ytp-bezel class', () => { |
| 39 | + expect(playerCssContent).toContain('.ytp-bezel'); |
| 40 | + }); |
| 41 | + |
| 42 | + test('CSS should target .ytp-bezel-text-wrapper class', () => { |
| 43 | + expect(playerCssContent).toContain('.ytp-bezel-text-wrapper'); |
| 44 | + }); |
| 45 | + |
| 46 | + test('CSS should use it-player-hide-pause-overlay attribute', () => { |
| 47 | + expect(playerCssContent).toContain("it-player-hide-pause-overlay='true'"); |
| 48 | + }); |
| 49 | + |
| 50 | + test('CSS should hide pause overlay with display:none', () => { |
| 51 | + expect(playerCssContent).toContain('display: none !important'); |
| 52 | + }); |
| 53 | + }); |
| 54 | + |
| 55 | + describe('Translations', () => { |
| 56 | + let messagesContent; |
| 57 | + |
| 58 | + beforeAll(() => { |
| 59 | + const messagesPath = path.join(__dirname, '../../_locales/en/messages.json'); |
| 60 | + messagesContent = fs.readFileSync(messagesPath, 'utf8'); |
| 61 | + }); |
| 62 | + |
| 63 | + test('hidePauseOverlay translation key should exist', () => { |
| 64 | + expect(messagesContent).toContain('"hidePauseOverlay"'); |
| 65 | + }); |
| 66 | + |
| 67 | + test('hidePauseOverlay should have a message', () => { |
| 68 | + const messages = JSON.parse(messagesContent); |
| 69 | + expect(messages.hidePauseOverlay).toBeDefined(); |
| 70 | + expect(messages.hidePauseOverlay.message).toBeDefined(); |
| 71 | + }); |
| 72 | + }); |
| 73 | +}); |
0 commit comments