From bb94f7a5fa510a889472a2d5d1288baf720e7d80 Mon Sep 17 00:00:00 2001 From: schmidi314 Date: Mon, 13 Dec 2021 23:07:18 +0100 Subject: [PATCH 1/5] Added content font in --- galata/src/galata.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/galata/src/galata.ts b/galata/src/galata.ts index d908f4e536d5..6a75f9448a0e 100644 --- a/galata/src/galata.ts +++ b/galata/src/galata.ts @@ -32,6 +32,9 @@ export namespace galata { codeCellConfig: { cursorBlinkRate: 0 }, markdownCellConfig: { cursorBlinkRate: 0 }, rawCellConfig: { cursorBlinkRate: 0 } + }, + '@jupyterlab/apputils-extension:themes': { + overrides: { 'content-font-family': 'DejaVu Sans' } } }; From a7f5c5dd62db9620e4d3d39a6a6b9e3b44bab5de Mon Sep 17 00:00:00 2001 From: schmidi314 Date: Wed, 15 Dec 2021 07:05:26 +0100 Subject: [PATCH 2/5] Adding galata helper function for overriding default mockSettings --- galata/src/galata.ts | 32 +++++++++++++++++++ .../jupyterlab/collapsible-headings.test.ts | 6 ++-- 2 files changed, 35 insertions(+), 3 deletions(-) diff --git a/galata/src/galata.ts b/galata/src/galata.ts index 6a75f9448a0e..ebd065299853 100644 --- a/galata/src/galata.ts +++ b/galata/src/galata.ts @@ -38,6 +38,38 @@ export namespace galata { } }; + /** + * 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) { + // helper for recursive merge/override + const mergeOverride = ( + base: Record, + addendum: Record + ) => { + 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 */ diff --git a/galata/test/jupyterlab/collapsible-headings.test.ts b/galata/test/jupyterlab/collapsible-headings.test.ts index d5f7419fc5f3..b3465703ff16 100644 --- a/galata/test/jupyterlab/collapsible-headings.test.ts +++ b/galata/test/jupyterlab/collapsible-headings.test.ts @@ -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'; @@ -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 }) => { From d306bdce417bac3439abc77a666737d78c2aa4db Mon Sep 17 00:00:00 2001 From: schmidi314 Date: Wed, 15 Dec 2021 07:42:02 +0100 Subject: [PATCH 3/5] Enforcing ui-font-familiy=DejaVu Sans --- galata/src/galata.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/galata/src/galata.ts b/galata/src/galata.ts index ebd065299853..67cf02618d40 100644 --- a/galata/src/galata.ts +++ b/galata/src/galata.ts @@ -34,7 +34,10 @@ export namespace galata { rawCellConfig: { cursorBlinkRate: 0 } }, '@jupyterlab/apputils-extension:themes': { - overrides: { 'content-font-family': 'DejaVu Sans' } + overrides: { + 'content-font-family': 'DejaVu Sans', + 'ui-font-family': 'DejaVu Sans' + } } }; From 8a782e1292aa37b08630d36cdf6293ca7730bee3 Mon Sep 17 00:00:00 2001 From: schmidi314 Date: Wed, 15 Dec 2021 09:33:00 +0100 Subject: [PATCH 4/5] Adding pixelmatch threshold 0.3 --- galata/src/playwright-config.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/galata/src/playwright-config.ts b/galata/src/playwright-config.ts index 13bfda52772f..16d895dd95ea 100644 --- a/galata/src/playwright-config.ts +++ b/galata/src/playwright-config.ts @@ -18,5 +18,6 @@ module.exports = { // Artifacts video: 'retain-on-failure' - } + }, + expect: { toMatchSnapshot: { threshold: 0.3 } } } as PlaywrightTestConfig; From 09945c02b7e96db7bbf1fb79cb4924dbe85ac4fb Mon Sep 17 00:00:00 2001 From: schmidi314 Date: Wed, 15 Dec 2021 10:46:00 +0100 Subject: [PATCH 5/5] For completeness: code-font-familiy set --- galata/src/galata.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/galata/src/galata.ts b/galata/src/galata.ts index 67cf02618d40..64ae40fac8f3 100644 --- a/galata/src/galata.ts +++ b/galata/src/galata.ts @@ -36,7 +36,8 @@ export namespace galata { '@jupyterlab/apputils-extension:themes': { overrides: { 'content-font-family': 'DejaVu Sans', - 'ui-font-family': 'DejaVu Sans' + 'ui-font-family': 'DejaVu Sans', + 'code-font-family': 'DejaVu Sans Mono' } } };