-
Notifications
You must be signed in to change notification settings - Fork 10.7k
fix(landing): keep reveal content visible without JavaScript #7502
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
open-design-crew
wants to merge
5
commits into
main
Choose a base branch
from
fix/homepage-reveal-progressive-enhancement
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+224
−78
Open
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
2e6d0b7
fix(landing): keep reveal content visible without js
maisie-0 1c760ec
chore: retrigger homepage reveal checks
maisie-0 e0fc176
fix(landing): preserve reveal exceptions and template parity
maisie-0 4f527c5
fix(template): preserve reveal enhancement when composing
maisie-0 d468b0c
test(e2e): own landing reveal parity contract
maisie-0 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
51 changes: 51 additions & 0 deletions
51
apps/landing-page/tests/home-reveal-progressive-enhancement.test.ts
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,51 @@ | ||
| import assert from 'node:assert/strict'; | ||
| import { readFileSync } from 'node:fs'; | ||
| import { test } from 'node:test'; | ||
|
|
||
| const stylesSource = readFileSync(new URL('../app/globals.css', import.meta.url), 'utf8'); | ||
| const homepageSource = readFileSync(new URL('../app/pages/index.astro', import.meta.url), 'utf8'); | ||
| const sharedEnhancerSource = readFileSync( | ||
| new URL('../app/_components/home-enhancer.astro', import.meta.url), | ||
| 'utf8', | ||
| ); | ||
|
|
||
| test('keeps reveal content visible until the animation observer is ready', () => { | ||
| assert.match( | ||
| stylesSource, | ||
| /\[data-reveal\]\s*\{[\s\S]*?opacity:\s*1;[\s\S]*?translate:\s*0 0;[\s\S]*?\}/, | ||
| ); | ||
| assert.match( | ||
| stylesSource, | ||
| /\.reveal-ready \[data-reveal\]:not\(\[data-revealed='true'\]\)\s*\{[\s\S]*?opacity:\s*0;/, | ||
| ); | ||
| assert.match( | ||
| stylesSource, | ||
| /\.blur-word\s*\{[\s\S]*?opacity:\s*1;[\s\S]*?filter:\s*none;[\s\S]*?transform:\s*none;/, | ||
| ); | ||
| assert.match(stylesSource, /\.reveal-ready \.blur-word\s*\{[\s\S]*?opacity:\s*0;/); | ||
| }); | ||
|
|
||
| test('preserves the hero and mobile CTA reveal exceptions after readiness', () => { | ||
| assert.match( | ||
| stylesSource, | ||
| /\.reveal-ready \.hero h1\.hero-title\[data-reveal\]\s*\{[\s\S]*?opacity:\s*1;[\s\S]*?translate:\s*0 0;/, | ||
| ); | ||
| assert.match( | ||
| stylesSource, | ||
| /@media \(max-width:\s*720px\)[\s\S]*?\.reveal-ready \.cta-window\[data-reveal\]:not\(\[data-revealed='true'\]\)\s*\{\s*translate:\s*0 0;/, | ||
| ); | ||
| }); | ||
|
|
||
| for (const [name, source] of [ | ||
| ['canonical homepage', homepageSource], | ||
| ['shared homepage enhancer', sharedEnhancerSource], | ||
| ] as const) { | ||
| test(`${name} enables reveal styles only after observer binding succeeds`, () => { | ||
| const observeIndex = source.indexOf('observer.observe(el)'); | ||
| const readyIndex = source.indexOf("classList.add('reveal-ready')"); | ||
|
|
||
| assert.notEqual(observeIndex, -1, `${name} does not bind reveal elements`); | ||
| assert.ok(readyIndex > observeIndex, `${name} enables hidden states before observer binding`); | ||
| assert.match(source, /catch \(error\)[\s\S]*?classList\.remove\('reveal-ready'\)/); | ||
| }); | ||
| } |
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.