-
Notifications
You must be signed in to change notification settings - Fork 393
fix(theme): light-content / dark-content SCSS rules not included in Reveal.js format
#13771
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
Merged
+125
−20
Merged
Changes from 5 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
f876ba4
fix: `light-content` / `dark-content` SCSS rules not included in Reve…
mcanouil c105a0e
chore: add changelog entry
mcanouil 66a66d6
refactor: consolidate light/dark content css rules
mcanouil 1eefba9
test: add playwright tests for light/dark-content CSS rules
mcanouil 55ac2cf
refactor: simplify light content visibility checks and remove dark mo…
mcanouil 9c69068
refactor: use helper functions from playwright
mcanouil 044b3ed
Merge branch 'main' into fix/issue13722
mcanouil 42219d0
Merge branch 'main' into fix/issue13722
mcanouil 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
7 changes: 0 additions & 7 deletions
7
src/resources/formats/html/bootstrap/dist/scss/_light-dark.scss
This file was deleted.
Oops, something went wrong.
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
29 changes: 29 additions & 0 deletions
29
tests/docs/playwright/html/unified-brand/light-dark-content.qmd
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,29 @@ | ||
| --- | ||
| format: html | ||
| title: Light and dark content | ||
| --- | ||
|
|
||
| ## Inline content | ||
|
|
||
| This is normal content. | ||
|
|
||
| [This text is visible only in light mode]{.light-content} | ||
|
|
||
| [This text is visible only in dark mode]{.dark-content} | ||
|
|
||
| ## Block content | ||
|
|
||
| :::: {.light-content} | ||
| This is a block that is visible only in light mode. | ||
| ::: | ||
|
|
||
| :::: {.dark-content} | ||
| This is a block that is visible only in dark mode. | ||
| ::: | ||
|
|
||
| ## Mixed content | ||
|
|
||
| - Normal list item. | ||
| - [Light mode list item]{.light-content} | ||
| - [Dark mode list item]{.dark-content} | ||
|
|
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,23 @@ | ||
| --- | ||
| format: revealjs | ||
| title: Light and dark content | ||
| --- | ||
|
|
||
| ## Slide with light and dark content | ||
|
|
||
| [This is light content]{.light-content} | ||
|
|
||
| :::: {.light-content} | ||
| This block is visible only in light mode. | ||
| ::: | ||
|
|
||
| [This is dark content]{.dark-content} | ||
|
|
||
| :::: {.dark-content} | ||
| This block is visible only in dark mode. | ||
| ::: | ||
|
|
||
| ## Another slide | ||
|
|
||
| Both light and dark content should display correctly depending on the theme. | ||
|
|
73 changes: 73 additions & 0 deletions
73
tests/integration/playwright/tests/html-light-dark-content.spec.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,73 @@ | ||
| import { test, expect } from '@playwright/test'; | ||
|
|
||
| async function check_light_content_visibility(page) { | ||
| // In light mode, light-content should be visible, dark-content should be hidden | ||
| const light_spans = await page.locator('span.light-content'); | ||
| const dark_spans = await page.locator('span.dark-content'); | ||
|
|
||
| // Check that light content spans exist and are visible | ||
| await expect(light_spans.first()).toHaveCSS('display', /(block|inline)/); | ||
|
|
||
| // Check that dark content spans are hidden | ||
| await expect(dark_spans.first()).toHaveCSS('display', 'none'); | ||
|
|
||
| const light_blocks = await page.locator('div.light-content').filter({ has: page.locator('blockquote, p, :not(div)') }); | ||
| const dark_blocks = await page.locator('div.dark-content').filter({ has: page.locator('blockquote, p, :not(div)') }); | ||
mcanouil marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| const light_divs = await page.locator('div.light-content'); | ||
| const dark_divs = await page.locator('div.dark-content'); | ||
|
|
||
| if (await light_divs.count() > 0) { | ||
| await expect(light_divs.first()).toHaveCSS('display', /(block|inline)/); | ||
| } | ||
|
|
||
| if (await dark_divs.count() > 0) { | ||
| await expect(dark_divs.first()).toHaveCSS('display', 'none'); | ||
| } | ||
| } | ||
|
|
||
| test.describe('Light and dark content in light mode', () => { | ||
| test.use({ | ||
| colorScheme: 'light' | ||
| }); | ||
|
|
||
| test('HTML: light and dark content visibility in light mode', async ({ page }) => { | ||
| await page.goto('./html/unified-brand/light-dark-content.html'); | ||
| await check_light_content_visibility(page); | ||
| }); | ||
| }); | ||
|
|
||
|
|
||
| test.describe('Light and dark content in RevealJS', () => { | ||
| test('RevealJS: light and dark content visibility', async ({ page }) => { | ||
| await page.goto('./revealjs/light-dark-content.html'); | ||
|
|
||
| // Check that light-content and dark-content elements exist | ||
| const light_spans = await page.locator('span.light-content'); | ||
| const dark_spans = await page.locator('span.dark-content'); | ||
| const light_divs = await page.locator('div.light-content'); | ||
| const dark_divs = await page.locator('div.dark-content'); | ||
|
|
||
| await expect(light_spans).not.toHaveCount(0); | ||
| await expect(dark_spans).not.toHaveCount(0); | ||
| await expect(light_divs).not.toHaveCount(0); | ||
| await expect(dark_divs).not.toHaveCount(0); | ||
mcanouil marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| // Check that body has the correct theme class | ||
| const body = await page.locator('body').first(); | ||
| const bodyClasses = await body.getAttribute('class'); | ||
| expect(bodyClasses).toContain('quarto-light'); | ||
|
|
||
| // Verify visibility based on theme | ||
| await expect(light_spans.first()).toHaveCSS('display', /(block|inline)/); | ||
| await expect(dark_spans.first()).toHaveCSS('display', 'none'); | ||
mcanouil marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| if (await light_divs.count() > 0) { | ||
| await expect(light_divs.first()).toHaveCSS('display', /(block|inline)/); | ||
| } | ||
|
|
||
| if (await dark_divs.count() > 0) { | ||
| await expect(dark_divs.first()).toHaveCSS('display', 'none'); | ||
| } | ||
| }); | ||
| }); | ||
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.