Skip to content

Commit

Permalink
client: Hide spellcheck settings on web (closes #345)
Browse files Browse the repository at this point in the history
  • Loading branch information
eliandoran committed Aug 16, 2024
1 parent 1172908 commit ca6b4c3
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 3 deletions.
8 changes: 8 additions & 0 deletions integration-tests/settings.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,12 @@ test("Tray settings not displayed on web", async ({ page }) => {
await page.goto('http://localhost:8082/#root/_hidden/_options/_optionsOther');
await expect(page.getByRole('heading', { name: 'Note Erasure Timeout' })).toBeVisible();
await expect(page.getByRole('heading', { name: 'Tray' })).toBeHidden();
});

test("Spellcheck settings not displayed on web", async ({ page }) => {
await page.goto('http://localhost:8082/#root/_hidden/_options/_optionsSpellcheck');
await expect(page.getByRole('heading', { name: 'Spell Check' })).toBeVisible();
await expect(page.getByRole('heading', { name: 'Tray' })).toBeHidden();
await expect(page.getByText('These options apply only for desktop builds')).toBeVisible();
await expect(page.getByText('Enable spellcheck')).toBeHidden();
});
15 changes: 12 additions & 3 deletions src/public/app/widgets/type_widgets/options/spellcheck.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,19 @@
import utils from "../../../services/utils.js";
import OptionsWidget from "./options_widget.js";

const TPL = `
const TPL_WEB = `
<div class="options-section">
<h4>Spell Check</h4>
<p>These options apply only for desktop builds, browsers will use their own native spell check. App restart is required after change.</p>
<p>These options apply only for desktop builds, browsers will use their own native spell check.</p>
</div>
`;

const TPL_ELECTRON = `
<div class="options-section">
<h4>Spell Check</h4>
<p>App restart is required after change.</p>
<label>
<input type="checkbox" class="spell-check-enabled">
Expand All @@ -26,7 +34,8 @@ const TPL = `

export default class SpellcheckOptions extends OptionsWidget {
doRender() {
this.$widget = $(TPL);
const template = utils.isElectron() ? TPL_ELECTRON : TPL_WEB;
this.$widget = $(template);

this.$spellCheckEnabled = this.$widget.find(".spell-check-enabled");
this.$spellCheckLanguageCode = this.$widget.find(".spell-check-language-code");
Expand Down

0 comments on commit ca6b4c3

Please sign in to comment.