Skip to content

test(NTP): cover custom background near-black/white token compensation - #3038

Draft
cursor[bot] wants to merge 1 commit into
mainfrom
cursor/regression-test-coverage-automation-03fb
Draft

cursor[bot] wants to merge 1 commit into
mainfrom
cursor/regression-test-coverage-automation-03fb

Conversation

@cursor

@cursor cursor Bot commented Sep 14, 2026

Copy link
Copy Markdown
Contributor

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 the data-wallpaper-near-black-or-white body dataset. That logic had no direct test coverage.

This PR adds:

  • Unit tests for luminance/theme helpers in customizer/utils.js
  • Unit tests for inferSchemeFrom() / themeFromBrowser() (extracted to backgroundScheme.js for Node testability)
  • Integration tests asserting the body dataset for near-black, near-white, mid-range, default, and gradient fallback backgrounds

Testing Steps

  • cd special-pages && npm run test-unit
  • cd special-pages && npm run test-int -- pages/new-tab/app/customizer/integration-tests/customizer.spec.js --grep "wallpaperNearBlackOrWhite" --reporter list

Risky behavior now covered

  • Near-black/near-white wallpaper detection thresholds (40/215 luminance) that gate input-control token compensation
  • inferSchemeFrom() mapping for all background kinds (default, color, gradient, userImage, hex)
  • Runtime wiring of data-wallpaper-near-black-or-white on <body> for custom hex and gradient fallback colors

Test 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

  • I have tested this change locally
  • I have tested this change locally in all supported browsers
  • This change will be visible to users
  • I have added automated tests that cover this change
  • I have ensured the change is gated by config
  • This change was covered by a ship review
  • This change was covered by a tech design
  • Any dependent config has been merged
Open in Web View Automation 

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.
@github-actions github-actions Bot added the semver-patch Bug fix / internal — no release needed label Sep 14, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Build Branch

Branch pr-releases/cursor/regression-test-coverage-automation-03fb
Commit 689f6e2348
Updated September 14, 2026 at 8:07:16 AM UTC

Static preview entry points

QR codes (mobile preview)
Entry point QR code
Docs QR for docs preview
Static pages QR for static pages preview
Integration pages QR for integration pages preview

Integration commands

npm (Android / Extension):

npm i github:duckduckgo/content-scope-scripts#pr-releases/cursor/regression-test-coverage-automation-03fb

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-03fb
Pin to exact commit

npm (Android / Extension):

npm i github:duckduckgo/content-scope-scripts#689f6e23485a4efc18270db7a393075b31212e5d

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

@github-actions

Copy link
Copy Markdown
Contributor

[Beta] Generated file diff

Time updated: Mon, 14 Sep 2026 08:07:27 GMT

Apple
    - apple/pages/new-tab/dist/index.js

File has changed

Integration
    - integration/pages/new-tab/dist/index.js

File has changed

Windows
    - windows/pages/new-tab/dist/index.js

File has changed

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

semver-patch Bug fix / internal — no release needed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant