chore: document deprecated systemPreferences APIs (#39343)

* chore: document deprecated systemPreferences APIs

* chore: forgot systemPreferences.appLevelAppearance

* test: expect deprecation messages
This commit is contained in:
David Sanders 2023-08-14 02:34:04 -07:00 committed by GitHub
parent d5f31c2208
commit 1b3e4dae8d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 97 additions and 19 deletions

View file

@ -4,6 +4,7 @@ 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';
@ -59,11 +60,16 @@ describe('nativeTheme module', () => {
});
ifdescribe(process.platform === 'darwin')('on macOS', () => {
it('should update appLevelAppearance when set', () => {
nativeTheme.themeSource = 'dark';
expect(systemPreferences.appLevelAppearance).to.equal('dark');
nativeTheme.themeSource = 'light';
expect(systemPreferences.appLevelAppearance).to.equal('light');
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."
);
});
});