Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion news/changelog-1.8.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ All changes included in 1.8:
### `revealjs`

- ([#12598](https://github.com/quarto-dev/quarto-cli/pull/12598)): Ensure `.fragment` on an image with caption applies to whole figure.
- ([#12716](https://github.com/quarto-dev/quarto-cli/issues/12716)): Correctly resolve `"brand"` set in `theme` configuration for document in subdirectory from project root.

### `docx`

Expand Down Expand Up @@ -93,4 +94,4 @@ All changes included in 1.8:

- ([#11321](https://github.com/quarto-dev/quarto-cli/issues/11321)): Follow [recommendation from LaTeX project](https://latex-project.org/news/latex2e-news/ltnews40.pdf) and use `lualatex` instead of `xelatex` as the default PDF engine.
- ([#12782](https://github.com/quarto-dev/quarto-cli/pull/12782)): fix bug on `safeRemoveDirSync`'s detection of safe directory boundaries.
- ([#12853](https://github.com/quarto-dev/quarto-cli/issues/12853)): fix replaceAll() escaping issue with embedded notebooks containing `$` in their Markdown.
- ([#12853](https://github.com/quarto-dev/quarto-cli/issues/12853)): fix replaceAll() escaping issue with embedded notebooks containing `$` in their Markdown.
2 changes: 1 addition & 1 deletion src/format/reveal/format-reveal-theme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ export async function revealTheme(
.map(
(theme) => {
const themePath = join(relative(Deno.cwd(), dirname(input)), theme);
if (themePath === "brand") {
if (theme === "brand") {
usedBrandLayers = true;
return brandLayers;
} else if (existsSync(themePath)) {
Expand Down
2 changes: 2 additions & 0 deletions tests/docs/playwright/revealjs/brand/custom.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/*-- scss:defaults --*/
$body-bg: $brand-dark-teal;
1 change: 1 addition & 0 deletions tests/docs/playwright/revealjs/brand/project/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/.quarto/
3 changes: 3 additions & 0 deletions tests/docs/playwright/revealjs/brand/project/_brand.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
color:
palette:
dark-teal: "#005E5E"
2 changes: 2 additions & 0 deletions tests/docs/playwright/revealjs/brand/project/_quarto.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
project:
type: default
2 changes: 2 additions & 0 deletions tests/docs/playwright/revealjs/brand/project/custom.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/*-- scss:defaults --*/
$body-bg: $brand-dark-teal;
10 changes: 10 additions & 0 deletions tests/docs/playwright/revealjs/brand/project/index.qmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
title: test
format:
revealjs:
theme: [custom.scss, brand]
---

# content

content
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/*-- scss:defaults --*/
$body-bg: $brand-dark-teal;
10 changes: 10 additions & 0 deletions tests/docs/playwright/revealjs/brand/project/subdir/index.qmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
title: test
format:
revealjs:
theme: [custom.scss, brand]
---

# content

content
14 changes: 14 additions & 0 deletions tests/docs/playwright/revealjs/brand/single.qmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
title: test
format:
revealjs:
theme: [custom.scss, brand]
brand:
color:
palette:
dark-teal: "#005E5E"
---

# content

content
2 changes: 2 additions & 0 deletions tests/docs/playwright/revealjs/brand/subdir/custom.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/*-- scss:defaults --*/
$body-bg: $brand-dark-teal;
14 changes: 14 additions & 0 deletions tests/docs/playwright/revealjs/brand/subdir/index.qmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
title: test
format:
revealjs:
theme: [custom.scss, brand]
brand:
color:
palette:
dark-teal: "#005E5E"
---

# content

content
4 changes: 4 additions & 0 deletions tests/integration/playwright/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,10 @@ export async function checkBorderProperties(element: Locator, side: string, colo
await expect(element).toHaveCSS(`border-${side}-width`, width);
}

export async function checkBackgroundColorProperty(element: Locator, color: RGBColor) {
await checkColor(element, `background-color`, color);
}

export function useDarkLightMode(mode: 'dark' | 'light'): Partial<PlaywrightTestOptions> {
return {
colorScheme: mode
Expand Down
51 changes: 51 additions & 0 deletions tests/integration/playwright/tests/revealjs-brand.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
import { test, expect, Locator } from '@playwright/test';
import { asRGB, checkBackgroundColorProperty, checkColor, checkColorIdentical, checkFontSizeSimilar, getCSSProperty, hexToRgb, RGBColor } from '../src/utils';

async function getRevealBrandColorVar(page: any, suffix: string): Promise<string> {
return await getCSSProperty(page.locator('body'), `--quarto-scss-export-brand-${suffix}`, false) as string;
}

// specific function to check the branded background color for revealjs/brand/ tests
// They use `color.palette.dark-teal` as brand color
async function checkBrandedBackgroundColor(page: any) {
const brandColor = await getRevealBrandColorVar(page, 'dark-teal');
await checkBackgroundColorProperty(page.locator('body'), hexToRgb(brandColor));
}

// Define test cases with their URLs to reduce duplication
const brandTestCases = [
{
name: 'project file using _brand.yml configuration',
url: './revealjs/brand/project/index.html',
description: 'Tests a file within a project that uses _brand.yml for branding'
},
{
name: 'nested file within project inheriting project branding',
url: './revealjs/brand/project/subdir/index.html',
description: 'Tests a file in a subdirectory that inherits project branding from _brand.yml'
},
{
name: 'standalone file with inline brand configuration',
url: './revealjs/brand/single.html',
description: 'Tests a standalone file with inline brand configuration in YAML frontmatter'
},
{
name: 'file in subdirectory with inline brand configuration',
url: './revealjs/brand/subdir/index.html',
description: 'Tests a file in subdirectory with its own inline brand configuration'
}
];

// Run all test cases with the same pattern
for (const testCase of brandTestCases) {
test(testCase.name, async ({ page }, testInfo) => {
// Add the description as an annotation to the test report
testInfo.annotations.push({
type: 'description',
description: testCase.description
});

await page.goto(testCase.url);
await checkBrandedBackgroundColor(page);
});
}