Refractoring Stage 6.23 Moved the mail API factory from the standalone window.epMailUiModules global into window.epMailFeatures.modules; mail-ui.js now uses the shared feature namespace. Bumped to 0.4.35 (Android version code 435) and updated REFACTOR_PLAN.md.
This commit is contained in:
@@ -2,6 +2,7 @@ const test = require('node:test');
|
||||
const assert = require('node:assert/strict');
|
||||
const fs = require('node:fs');
|
||||
const path = require('node:path');
|
||||
const vm = require('node:vm');
|
||||
const { createMailUiApi } = require('../renderer-mail-api.js');
|
||||
|
||||
test('mail feature API exposes explicit state and account/sync UI actions', () => {
|
||||
@@ -56,6 +57,16 @@ test('mail feature API exposes explicit state and account/sync UI actions', () =
|
||||
assert.equal(Object.isFrozen(api), true);
|
||||
});
|
||||
|
||||
test('browser mail API factory is registered under the shared feature namespace', () => {
|
||||
const root = path.resolve(__dirname, '..');
|
||||
const source = fs.readFileSync(path.join(root, 'renderer-mail-api.js'), 'utf8');
|
||||
const window = {};
|
||||
vm.runInNewContext(source, { window });
|
||||
assert.equal(typeof window.epMailFeatures.modules.createMailUiApi, 'function');
|
||||
assert.equal(Object.isFrozen(window.epMailFeatures.modules), true);
|
||||
assert.equal(Object.hasOwn(window, 'epMailUiModules'), false);
|
||||
});
|
||||
|
||||
test('account and snooze UI consume the explicit mail API instead of selected legacy globals', () => {
|
||||
const root = path.resolve(__dirname, '..');
|
||||
const accountUi = fs.readFileSync(path.join(root, 'account-ui.js'), 'utf8');
|
||||
@@ -88,6 +99,7 @@ test('account and snooze UI consume the explicit mail API instead of selected le
|
||||
assert.match(mailUi, /appShell\.wrapOpenMessage/);
|
||||
assert.match(mailUi, /appShell\.wrapShowCompose/);
|
||||
assert.match(mailUi, /^\(\(\) => \{/);
|
||||
assert.match(mailUi, /window\.epMailFeatures\.modules\.createMailUiApi/);
|
||||
assert.match(mailUi, /window\.epMailFeatures\.mail = mailUiApi/);
|
||||
assert.doesNotMatch(mailUi, /(?<!\.)\bopenPreferences\s*\(|(?<!\.)\bquery\s*=/);
|
||||
assert.match(shortcutsUi, /window\.epMailFeatures\.mail/);
|
||||
|
||||
Reference in New Issue
Block a user