diff --git a/integration-tests/settings.spec.ts b/integration-tests/settings.spec.ts new file mode 100644 index 000000000..aba6b7d06 --- /dev/null +++ b/integration-tests/settings.spec.ts @@ -0,0 +1,8 @@ +import test, { expect } from "@playwright/test"; + +test("Native Title Bar not displayed on web", async ({ page }) => { + await page.goto('http://localhost:8082/#root/_hidden/_options/_optionsAppearance'); + await expect(page.getByRole('heading', { name: 'Theme' })).toBeVisible(); + await expect(page.getByRole('heading', { name: 'Native Title Bar (requires' })).toBeHidden(); +}); + diff --git a/src/public/app/services/utils.js b/src/public/app/services/utils.js index 281db023d..7cbdfb351 100644 --- a/src/public/app/services/utils.js +++ b/src/public/app/services/utils.js @@ -85,6 +85,9 @@ function now() { return formatTimeWithSeconds(new Date()); } +/** + * Returns `true` if the client is currently running under Electron, or `false` if running in a web browser. + */ function isElectron() { return !!(window && window.process && window.process.type); } diff --git a/src/public/app/widgets/basic_widget.js b/src/public/app/widgets/basic_widget.js index 75373238e..b60a74e8c 100644 --- a/src/public/app/widgets/basic_widget.js +++ b/src/public/app/widgets/basic_widget.js @@ -131,6 +131,10 @@ class BasicWidget extends Component { return this.$widget; } + /** + * Indicates if the widget is enabled. Widgets are enabled by default. Generally setting this to `false` will cause the widget not to be displayed, however it will still be available on the DOM but hidden. + * @returns + */ isEnabled() { return true; } diff --git a/src/public/app/widgets/note_context_aware_widget.js b/src/public/app/widgets/note_context_aware_widget.js index 1d3a98b9c..76b3ab1bb 100644 --- a/src/public/app/widgets/note_context_aware_widget.js +++ b/src/public/app/widgets/note_context_aware_widget.js @@ -48,6 +48,8 @@ class NoteContextAwareWidget extends BasicWidget { } /** + * @inheritdoc + * * @returns {boolean} true when an active note exists */ isEnabled() { diff --git a/src/public/app/widgets/type_widgets/options/appearance/native_title_bar.js b/src/public/app/widgets/type_widgets/options/appearance/native_title_bar.js index fc72a5a22..afe2e0dbd 100644 --- a/src/public/app/widgets/type_widgets/options/appearance/native_title_bar.js +++ b/src/public/app/widgets/type_widgets/options/appearance/native_title_bar.js @@ -1,5 +1,6 @@ import OptionsWidget from "../options_widget.js"; import { t } from "../../../../services/i18n.js"; +import utils from "../../../../services/utils.js"; const TPL = `