refactor: use WidgetDelegate::SetAccessibleTitle()
(#46765)
* refactor: use WidgetDelegate::SetAccessibleTitle() * test: add window.accessibleTitle tests
This commit is contained in:
parent
c16ea8d54e
commit
924a8da940
3 changed files with 33 additions and 14 deletions
|
@ -16,6 +16,7 @@ import { setTimeout } from 'node:timers/promises';
|
|||
import * as nodeUrl from 'node:url';
|
||||
|
||||
import { emittedUntil, emittedNTimes } from './lib/events-helpers';
|
||||
import { randomString } from './lib/net-helpers';
|
||||
import { HexColors, hasCapturableScreen, ScreenCapture } from './lib/screen-helpers';
|
||||
import { ifit, ifdescribe, defer, listen, waitUntil } from './lib/spec-helpers';
|
||||
import { closeWindow, closeAllWindows } from './lib/window-helpers';
|
||||
|
@ -232,6 +233,36 @@ describe('BrowserWindow module', () => {
|
|||
});
|
||||
});
|
||||
|
||||
describe('window.accessibleTitle', () => {
|
||||
const title = 'Window Title';
|
||||
let w: BrowserWindow;
|
||||
beforeEach(() => {
|
||||
w = new BrowserWindow({ show: false, title, webPreferences: { nodeIntegration: true, contextIsolation: false } });
|
||||
});
|
||||
afterEach(async () => {
|
||||
await closeWindow(w);
|
||||
w = null as unknown as BrowserWindow;
|
||||
});
|
||||
|
||||
it('should default to the window title', async () => {
|
||||
expect(w.accessibleTitle).to.equal(title);
|
||||
});
|
||||
|
||||
it('should be mutable', async () => {
|
||||
const accessibleTitle = randomString(20);
|
||||
w.accessibleTitle = accessibleTitle;
|
||||
expect(w.accessibleTitle).to.equal(accessibleTitle);
|
||||
});
|
||||
|
||||
it('should be clearable', async () => {
|
||||
const accessibleTitle = randomString(20);
|
||||
w.accessibleTitle = accessibleTitle;
|
||||
expect(w.accessibleTitle).to.equal(accessibleTitle);
|
||||
w.accessibleTitle = '';
|
||||
expect(w.accessibleTitle).to.equal(title);
|
||||
});
|
||||
});
|
||||
|
||||
describe('window.close()', () => {
|
||||
let w: BrowserWindow;
|
||||
beforeEach(() => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue