Skip to content

Commit

Permalink
Backport PR #15957: Fix Theme color is not applied to Toolbar Button (#…
Browse files Browse the repository at this point in the history
…15995)

Co-authored-by: FoSuCloud <49218295+FoSuCloud@users.noreply.github.com>
  • Loading branch information
meeseeksmachine and FoSuCloud authored Mar 14, 2024
1 parent 2b42e0f commit a5fa0aa
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 16 deletions.
54 changes: 39 additions & 15 deletions galata/test/jupyterlab/toolbars.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,23 +37,47 @@ toolbars.forEach(([plugin, parameter]) => {
expect(missingCommands).toEqual([]);
});
});
test.describe('Toolbar Button', () => {
test.beforeEach(async ({ page, tmpPath }) => {
await page.notebook.createNew();
});

test('Render Switch Kernel ToolbarButton', async ({ page }) => {
await page.notebook.createNew();
test('Render Switch Kernel ToolbarButton in default theme', async ({
page
}) => {
const label = await page.$(
'jp-button.jp-Toolbar-kernelName .jp-ToolbarButtonComponent-label'
);
const labelColor = await page.evaluate(
el => getComputedStyle(el).color,
label
);

const label = await page.$(
'jp-button.jp-Toolbar-kernelName .jp-ToolbarButtonComponent-label'
);
const labelColor = await page.evaluate(
el => getComputedStyle(el).color,
label
);
const color = await page.evaluate(() =>
getComputedStyle(document.body)
.getPropertyValue('--jp-ui-font-color1')
.trim()
);

const color = await page.evaluate(() =>
getComputedStyle(document.body)
.getPropertyValue('--jp-ui-font-color1')
.trim()
);
expect(labelColor).toEqual(color);
});

expect(labelColor).toEqual(color);
test('Render Switch Kernel ToolbarButton in dark theme', async ({ page }) => {
await page.theme.setDarkTheme();
const label = await page.$(
'jp-button.jp-Toolbar-kernelName .jp-ToolbarButtonComponent-label'
);
const labelColor = await page.evaluate(
el => getComputedStyle(el).color,
label
);

const color = await page.evaluate(() =>
getComputedStyle(document.body)
.getPropertyValue('--jp-ui-font-color1')
.trim()
);

expect(labelColor).toEqual(color);
});
});
2 changes: 1 addition & 1 deletion packages/ui-components/style/toolbar.css
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ button.jp-ToolbarButtonComponent .jp-ToolbarButtonComponent-label {
font-family: var(--jp-ui-font-family);
}

jp-button.jp-Toolbar-kernelName {
.jp-Toolbar .jp-ToolbarButtonComponent {
color: var(--jp-ui-font-color1);
}

Expand Down

0 comments on commit a5fa0aa

Please sign in to comment.