Skip to content
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

Enforcing fonts for galata #11682

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from
Draft
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
39 changes: 39 additions & 0 deletions galata/src/galata.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,48 @@ export namespace galata {
codeCellConfig: { cursorBlinkRate: 0 },
markdownCellConfig: { cursorBlinkRate: 0 },
rawCellConfig: { cursorBlinkRate: 0 }
},
'@jupyterlab/apputils-extension:themes': {
overrides: {
'content-font-family': 'DejaVu Sans',
'ui-font-family': 'DejaVu Sans',
'code-font-family': 'DejaVu Sans Mono'
}
}
};

/**
* Helper function to do a deep merge/override of DEFAULT_SETTINGS.
*
* Usage:
* test.use({mockSettings: galata.mergeOverrideDefaultSettings({@foo/bar:bla: 'xyz'})})
*
*/
export function mergeOverrideDefaultSettings(addendum: Record<string, any>) {
// helper for recursive merge/override
const mergeOverride = (
base: Record<string, any>,
addendum: Record<string, any>
) => {
let retval = { ...base };
for (const key of Object.keys(addendum)) {
if (key in retval) {
if (retval[key] instanceof Object) {
retval[key] = mergeOverride(retval[key], addendum[key]);
} else {
retval[key] = addendum[key];
}
} else {
retval[key] = addendum[key];
}
}
return retval;
};

// do it
return mergeOverride(DEFAULT_SETTINGS, addendum);
}

/**
* Sidebar position
*/
Expand Down
3 changes: 2 additions & 1 deletion galata/src/playwright-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,6 @@ module.exports = {

// Artifacts
video: 'retain-on-failure'
}
},
expect: { toMatchSnapshot: { threshold: 0.3 } }
} as PlaywrightTestConfig;
6 changes: 3 additions & 3 deletions galata/test/jupyterlab/collapsible-headings.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright (c) Jupyter Development Team.
// Distributed under the terms of the Modified BSD License.

import { IJupyterLabPageFixture, test } from '@jupyterlab/galata';
import { galata, IJupyterLabPageFixture, test } from '@jupyterlab/galata';
import { expect } from '@playwright/test';

const fileName = 'notebook.ipynb';
Expand Down Expand Up @@ -66,11 +66,11 @@ test.describe('Collapsible Headings; no_showHCB', () => {
});
// use non-standard showHiddenCellsButton=false
test.use({
mockSettings: {
mockSettings: galata.mergeOverrideDefaultSettings({
'@jupyterlab/notebook-extension:tracker': {
showHiddenCellsButton: false
}
}
})
});

test('Show Collapser Unselected; no_showHCB', async ({ page }) => {
Expand Down