youtube
youtube copied to clipboard
🐞`tests/unit/hdr-badge.test.js` fails
Summary
When running npm test, the unit test shows no badge when the setting is off, but clears stale badges in tests/unit/hdr-badge.test.js fails.
- Expected:
appended.lengthto be0whensetting: false. - Received:
appended.lengthto be1.
Background & Investigation
- In
repo/js&css/web-accessible/functions.js,ImprovedTube.hdrBadge()is guarded bythis.storage.hdr_badge === true:if (this.storage.hdr_badge === true && document.documentElement.dataset.pageType === 'video') { ImprovedTube.hdrBadge(); }; - However, the standalone function
ImprovedTube.hdrBadgeinrepo/js&css/web-accessible/www.youtube.com/appearance.jsdoes not checkthis.storage.hdr_badgeinternally. - When
hdrBadge()is invoked directly (as done in the unit test withcontext.ImprovedTube.hdrBadge()), it executes and appends the badge regardless of the storage setting value.
Notes
- Affected Version / Commit:
masterbranch (Commit:c560f05d74e64d208ac55c341278f0e55a84c0e0) - Note: Since this has not been released yet, the issue occurs on the current
mastercommit.