chore: remove deprecated systemPreferences APIs (#39696)
This commit is contained in:
parent
d182794179
commit
aceb432f45
9 changed files with 45 additions and 147 deletions
|
@ -1,11 +1,9 @@
|
|||
import { expect } from 'chai';
|
||||
import { nativeTheme, systemPreferences, BrowserWindow, ipcMain } from 'electron/main';
|
||||
import { nativeTheme, BrowserWindow, ipcMain } from 'electron/main';
|
||||
import { once } from 'node:events';
|
||||
import * as path from 'node:path';
|
||||
import { setTimeout } from 'node:timers/promises';
|
||||
|
||||
import { expectDeprecationMessages } from './lib/deprecate-helpers';
|
||||
import { ifdescribe } from './lib/spec-helpers';
|
||||
import { closeAllWindows } from './lib/window-helpers';
|
||||
|
||||
describe('nativeTheme module', () => {
|
||||
|
@ -59,20 +57,6 @@ describe('nativeTheme module', () => {
|
|||
expect(called).to.equal(false);
|
||||
});
|
||||
|
||||
ifdescribe(process.platform === 'darwin')('on macOS', () => {
|
||||
it('should update appLevelAppearance when set', async () => {
|
||||
await expectDeprecationMessages(
|
||||
() => {
|
||||
nativeTheme.themeSource = 'dark';
|
||||
expect(systemPreferences.appLevelAppearance).to.equal('dark');
|
||||
nativeTheme.themeSource = 'light';
|
||||
expect(systemPreferences.appLevelAppearance).to.equal('light');
|
||||
},
|
||||
"(electron) 'appLevelAppearance' is deprecated and will be removed."
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
const getPrefersColorSchemeIsDark = async (w: Electron.BrowserWindow) => {
|
||||
const isDark: boolean = await w.webContents.executeJavaScript(
|
||||
'matchMedia("(prefers-color-scheme: dark)").matches'
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue