test(NTP): cover custom background near-black/white token compensation - #3038
Draft
cursor[bot] wants to merge 1 commit into
Draft
cursor[bot] wants to merge 1 commit into
cursor[bot] wants to merge 1 commit into
Conversation
Add unit tests for customizer luminance helpers and inferSchemeFrom, plus integration tests for the body dataset that drives omnibar input-control token compensation from PR #2974. Extract pure scheme helpers to backgroundScheme.js so Node unit tests avoid importing JSX.
Contributor
Build Branch
Static preview entry points
QR codes (mobile preview)
Integration commandsnpm (Android / Extension): Swift Package Manager (Apple): .package(url: "https://github.com/duckduckgo/content-scope-scripts.git", branch: "pr-releases/cursor/regression-test-coverage-automation-03fb")git submodule (Windows): git -C submodules/content-scope-scripts fetch origin pr-releases/cursor/regression-test-coverage-automation-03fb
git -C submodules/content-scope-scripts checkout origin/pr-releases/cursor/regression-test-coverage-automation-03fbPin to exact commitnpm (Android / Extension): Swift Package Manager (Apple): .package(url: "https://github.com/duckduckgo/content-scope-scripts.git", revision: "689f6e23485a4efc18270db7a393075b31212e5d")git submodule (Windows): git -C submodules/content-scope-scripts fetch origin pr-releases/cursor/regression-test-coverage-automation-03fb
git -C submodules/content-scope-scripts checkout 689f6e23485a4efc18270db7a393075b31212e5d |
Contributor
[Beta] Generated file diffTime updated: Mon, 14 Sep 2026 08:07:27 GMT AppleFile has changed IntegrationFile has changed WindowsFile has changed |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Asana Task/Github Issue: Regression test coverage automation
Description
PR #2974 wired custom NTP backgrounds into omnibar/tab-switcher input-control token compensation via
detectThemeNearBlackOrWhiteFromHex()and thedata-wallpaper-near-black-or-whitebody dataset. That logic had no direct test coverage.This PR adds:
customizer/utils.jsinferSchemeFrom()/themeFromBrowser()(extracted tobackgroundScheme.jsfor Node testability)Testing Steps
cd special-pages && npm run test-unitcd special-pages && npm run test-int -- pages/new-tab/app/customizer/integration-tests/customizer.spec.js --grep "wallpaperNearBlackOrWhite" --reporter listRisky behavior now covered
inferSchemeFrom()mapping for all background kinds (default, color, gradient, userImage, hex)data-wallpaper-near-black-or-whiteon<body>for custom hex and gradient fallback colorsTest files added/updated
special-pages/pages/new-tab/app/customizer/unit-tests/utils.spec.mjs(new)special-pages/pages/new-tab/app/components/unit-tests/backgroundProvider.spec.mjs(new)special-pages/pages/new-tab/app/customizer/integration-tests/customizer.spec.js(updated)special-pages/pages/new-tab/app/customizer/integration-tests/customizer.page.js(updated)special-pages/package.json(updated test-unit glob)Why these tests materially reduce regression risk
Incorrect luminance classification would silently break omnibar/protections contrast on extreme custom wallpapers — a visual regression that's hard to catch in screenshot diffs alone. These tests pin the threshold math and the DOM dataset contract that downstream CSS relies on.
Checklist