@omega.js/desktop 0.52.0 → 0.53.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +17 -12
- package/dist/assets/css/core/_initialize.scss +1 -1
- package/dist/assets/js/core/app-shell.js +14 -15
- package/dist/assets/themes/_template/_theme.js +6 -6
- package/dist/assets/themes/base/_includes/global/sections/account.html +4 -4
- package/dist/assets/themes/base/_includes/global/sections/app-sidebar.html +5 -5
- package/dist/assets/themes/base/_layouts/frontend/pages/account/index.html +3 -3
- package/dist/assets/themes/base/_layouts/frontend/pages/alternatives/index.html +1 -1
- package/dist/assets/themes/base/_layouts/frontend/pages/blog/tags/tag.html +1 -1
- package/dist/assets/themes/base/_layouts/frontend/pages/payment/confirmation.html +1 -1
- package/dist/assets/themes/base/_sections/marketing/newsletter-cta/section.js +2 -3
- package/dist/assets/themes/base/_sections/verts/unit/section.html +1 -1
- package/dist/assets/themes/base/_sections/verts/unit/section.js +3 -4
- package/dist/assets/themes/base/_theme.js +4 -3
- package/dist/assets/themes/bootstrap/_theme.js +2 -2
- package/dist/assets/themes/bootstrap/overrides/_links.scss +1 -1
- package/dist/assets/themes/classy/_theme.js +8 -6
- package/dist/assets/themes/classy/css/marketing/_sections.scss +1 -2
- package/dist/assets/themes/classy/js/hero-demo-form.js +3 -2
- package/dist/assets/themes/neobrutalism/_theme.js +5 -5
- package/dist/assets/themes/neobrutalism/js/pages/test/libraries/layers/index.js +1 -1
- package/dist/assets/themes/newsflash/_theme.js +6 -6
- package/dist/assets/themes/newsflash/js/pages/test/libraries/layers/index.js +1 -1
- package/dist/build.js +87 -111
- package/dist/cli.js +1 -1
- package/dist/commands/build.js +2 -2
- package/dist/commands/cdp/capture.js +2 -2
- package/dist/commands/cdp/quit.js +2 -2
- package/dist/commands/cdp/relaunch.js +2 -2
- package/dist/commands/cdp/theme.js +1 -1
- package/dist/commands/clean.js +2 -2
- package/dist/commands/deploy.js +4 -4
- package/dist/commands/finalize-release.js +4 -4
- package/dist/commands/install.js +3 -3
- package/dist/commands/launch.js +2 -2
- package/dist/commands/lib/deploy-precheck.js +3 -3
- package/dist/commands/lib/ensure-target.js +6 -6
- package/dist/commands/package.js +2 -2
- package/dist/commands/publish.js +2 -2
- package/dist/commands/release.js +3 -3
- package/dist/commands/runner.js +11 -11
- package/dist/commands/sign-windows.js +5 -5
- package/dist/commands/test.js +4 -4
- package/dist/commands/update.js +2 -2
- package/dist/commands/validate-certs.js +4 -4
- package/dist/commands/version.js +3 -3
- package/dist/defaults/AGENTS.md +17 -8
- package/dist/defaults/config/omega.json5 +7 -7
- package/dist/defaults/hooks/build/post.js +1 -1
- package/dist/defaults/hooks/build/pre.js +1 -1
- package/dist/defaults/hooks/deploy/pre.js +1 -1
- package/dist/defaults/hooks/release/post.js +1 -1
- package/dist/defaults/hooks/release/pre.js +1 -1
- package/dist/defaults/src/assets/js/components/about/index.js +3 -5
- package/dist/defaults/src/assets/js/components/main/index.js +3 -5
- package/dist/defaults/src/assets/js/components/settings/index.js +3 -5
- package/dist/defaults/src/integrations/context-menu/index.js +2 -2
- package/dist/defaults/src/integrations/menu/index.js +3 -3
- package/dist/defaults/src/integrations/tray/index.js +3 -3
- package/dist/defaults/src/main.js +3 -5
- package/dist/defaults/src/preload.js +3 -5
- package/dist/defaults/test/README.md +2 -2
- package/dist/gulp/main.js +9 -10
- package/dist/gulp/tasks/audit.js +7 -7
- package/dist/gulp/tasks/build-config.js +8 -8
- package/dist/gulp/tasks/bundle.js +16 -16
- package/dist/gulp/tasks/defaults.js +3 -3
- package/dist/gulp/tasks/distribute.js +2 -2
- package/dist/gulp/tasks/html.js +9 -9
- package/dist/gulp/tasks/package-quick.js +3 -3
- package/dist/gulp/tasks/package.js +3 -3
- package/dist/gulp/tasks/release.js +3 -3
- package/dist/gulp/tasks/sass.js +6 -6
- package/dist/gulp/tasks/serve.js +4 -4
- package/dist/hooks/notarize-artifacts.js +1 -1
- package/dist/hooks/notarize.js +1 -1
- package/dist/index.js +5 -8
- package/dist/lib/_environment-mixin.js +50 -0
- package/dist/lib/_lifecycle-mixin.js +45 -0
- package/dist/lib/analytics.js +33 -35
- package/dist/lib/app-state.js +14 -14
- package/dist/lib/auth-flow.js +18 -18
- package/dist/lib/auth-persistence.js +12 -12
- package/dist/lib/auth.js +421 -0
- package/dist/lib/auto-updater.js +49 -49
- package/dist/lib/context-menu.js +13 -13
- package/dist/lib/context.js +19 -19
- package/dist/lib/deep-link.js +34 -34
- package/dist/lib/fontawesome.js +5 -5
- package/dist/lib/ipc.js +4 -4
- package/dist/lib/menu.js +25 -25
- package/dist/lib/protocol.js +5 -5
- package/dist/lib/remote-config.js +22 -22
- package/dist/lib/remote-scripts.js +21 -21
- package/dist/lib/restart-manager/index.js +28 -28
- package/dist/lib/sign-helpers/exec-with-limit.js +1 -1
- package/dist/lib/sign-helpers/sign-events.js +1 -1
- package/dist/lib/startup.js +18 -13
- package/dist/lib/storage.js +10 -10
- package/dist/lib/templating.js +16 -16
- package/dist/lib/theme.js +10 -10
- package/dist/lib/tray.js +27 -27
- package/dist/lib/usage.js +11 -11
- package/dist/lib/window-manager.js +26 -26
- package/dist/main.js +398 -483
- package/dist/preload.js +236 -176
- package/dist/renderer.js +417 -391
- package/dist/test/fixtures/consumer-app/config/omega.json5 +1 -1
- package/dist/test/fixtures/consumer-app/src/assets/js/components/main/index.js +8 -11
- package/dist/test/fixtures/consumer-app/src/main.js +5 -7
- package/dist/test/fixtures/consumer-app/src/preload.js +2 -2
- package/dist/test/harness/boot-entry.js +22 -20
- package/dist/test/harness/main-entry.js +31 -30
- package/dist/test/harness/renderer-entry.js +5 -5
- package/dist/test/harness/renderer-preload.js +137 -141
- package/dist/test/index.js +10 -10
- package/dist/test/runner.js +2 -2
- package/dist/test/runners/boot.js +7 -6
- package/dist/test/runners/electron.js +3 -2
- package/dist/test/runners/render-event.js +2 -2
- package/dist/test/suites/boot/consumer-app-boots.test.js +57 -26
- package/dist/test/suites/boot/restart-manager.test.js +2 -2
- package/dist/test/suites/boot/storage-bundled.test.js +5 -5
- package/dist/test/suites/boot/theme.test.js +13 -13
- package/dist/test/suites/build/audit.test.js +1 -1
- package/dist/test/suites/build/auth-persistence-resolve.test.js +6 -6
- package/dist/test/suites/build/boot-fixture.test.js +2 -2
- package/dist/test/suites/build/boot-runner-timeout.test.js +6 -5
- package/dist/test/suites/build/brand-scss.test.js +1 -1
- package/dist/test/suites/build/build-json-bake.test.js +1 -1
- package/dist/test/suites/build/cli.test.js +2 -2
- package/dist/test/suites/build/config-schema.test.js +5 -5
- package/dist/test/suites/build/defaults-scaffold.test.js +2 -2
- package/dist/test/suites/build/deploy-hook.test.js +3 -3
- package/dist/test/suites/build/ensure-target.test.js +2 -2
- package/dist/test/suites/build/env-delivery.test.js +2 -2
- package/dist/test/suites/build/esm-only-dependency.test.js +2 -2
- package/dist/test/suites/build/exports.test.js +9 -8
- package/dist/test/suites/build/get-config.test.js +4 -4
- package/dist/test/suites/build/manifest-deps.test.js +1 -1
- package/dist/test/suites/build/merge-line-files.test.js +1 -1
- package/dist/test/suites/build/omega-shell.test.js +34 -2
- package/dist/test/suites/build/omega.test.js +350 -0
- package/dist/test/suites/build/renderer-auth-bridge.test.js +211 -78
- package/dist/test/suites/build/runner.test.js +2 -2
- package/dist/test/suites/build/sentry.test.js +2 -2
- package/dist/test/suites/build/sign-windows-e2e.test.js +2 -2
- package/dist/test/suites/build/templating.test.js +3 -3
- package/dist/test/suites/build/test-stealth.test.js +7 -9
- package/dist/test/suites/build/url-helpers.test.js +55 -56
- package/dist/test/suites/build/validate-config.test.js +2 -2
- package/dist/test/suites/build/wave5-pins.test.js +2 -2
- package/dist/test/suites/main/analytics.test.js +59 -59
- package/dist/test/suites/main/app-state.test.js +66 -66
- package/dist/test/suites/main/auth-flow.test.js +41 -41
- package/dist/test/suites/main/auth-persistence.test.js +54 -43
- package/dist/test/suites/main/{client-bridge.integration.test.js → auth.integration.test.js} +10 -9
- package/dist/test/suites/main/auth.test.js +336 -0
- package/dist/test/suites/main/auto-updater.test.js +134 -134
- package/dist/test/suites/main/boot-sequence.test.js +37 -49
- package/dist/test/suites/main/context-menu.test.js +51 -50
- package/dist/test/suites/main/context.test.js +25 -25
- package/dist/test/suites/main/deep-link.test.js +74 -74
- package/dist/test/suites/main/fontawesome.test.js +27 -27
- package/dist/test/suites/main/ipc.test.js +35 -35
- package/dist/test/suites/main/menu.test.js +101 -100
- package/dist/test/suites/main/protocol.test.js +19 -19
- package/dist/test/suites/main/remote-config.test.js +63 -63
- package/dist/test/suites/main/remote-scripts.test.js +103 -103
- package/dist/test/suites/main/request.test.js +71 -0
- package/dist/test/suites/main/restart-manager.test.js +33 -33
- package/dist/test/suites/main/startup-paths-and-ua.test.js +4 -4
- package/dist/test/suites/main/startup.test.js +26 -26
- package/dist/test/suites/main/stealth-window.test.js +1 -1
- package/dist/test/suites/main/storage.test.js +25 -25
- package/dist/test/suites/main/theme.test.js +34 -34
- package/dist/test/suites/main/tray.test.js +79 -79
- package/dist/test/suites/main/url-helpers.test.js +133 -133
- package/dist/test/suites/main/usage.test.js +25 -25
- package/dist/test/suites/main/window-bounds.test.js +27 -27
- package/dist/test/suites/main/window-manager.test.js +44 -44
- package/dist/test/suites/renderer/analytics-bridge.test.js +5 -5
- package/dist/test/suites/renderer/cross-context-helpers.test.js +37 -31
- package/dist/test/suites/renderer/round-trip.test.js +3 -3
- package/dist/test/suites/renderer/tooltips.test.js +15 -15
- package/dist/test/suites/renderer/{window-em-surface.test.js → window-desktop-surface.test.js} +27 -7
- package/dist/test/utils/extended-mode-warning.js +1 -1
- package/dist/utils/boot-harness.js +56 -0
- package/dist/utils/mode-helpers.js +2 -15
- package/dist/utils/ship-keys.js +3 -3
- package/dist/utils/signing-status.js +51 -0
- package/dist/utils/test-events.js +7 -0
- package/dist/utils/test-stealth.js +6 -6
- package/dist/utils/url-helpers.js +52 -42
- package/dist/utils/user-agent.js +44 -0
- package/dist/vendor/account/engine.js +3 -3
- package/dist/vendor/account/index.js +14 -45
- package/dist/vendor/account/resolve-account.js +44 -0
- package/dist/vendor/account/schema.js +1 -1
- package/dist/vendor/account/user.js +99 -0
- package/dist/vendor/config/client-config.js +1 -1
- package/dist/vendor/config/environment.js +11 -30
- package/dist/vendor/config/index.js +8 -11
- package/dist/vendor/config/load.js +1 -2
- package/dist/vendor/config/platforms.js +1 -1
- package/dist/vendor/config/retired-keys.js +2 -2
- package/dist/vendor/config/schema.js +5 -8
- package/dist/vendor/config/site-global.js +2 -3
- package/dist/vendor/config/validate.js +1 -2
- package/dist/vendor/config/winback.js +1 -1
- package/dist/vendor/devkit/actions-secrets.js +1 -1
- package/dist/vendor/devkit/attach-log-file.js +1 -1
- package/dist/vendor/devkit/build-json.js +1 -1
- package/dist/vendor/devkit/cli-router.js +3 -4
- package/dist/vendor/devkit/defaults-engine.js +9 -11
- package/dist/vendor/devkit/local.js +2 -0
- package/dist/vendor/devkit/merge-line-files.js +2 -3
- package/dist/vendor/devkit/test/runner-core.js +6 -6
- package/dist/vendor/monitoring/env.js +2 -2
- package/dist/vendor/monitoring/index.js +1 -1
- package/dist/vendor/monitoring/main.js +1 -1
- package/dist/vendor/monitoring/preload.js +1 -1
- package/dist/vendor/monitoring/renderer.js +1 -1
- package/docs/analytics.md +8 -8
- package/docs/app-state.md +19 -19
- package/docs/audit.md +4 -4
- package/docs/{client-bridge.md → auth.md} +88 -73
- package/docs/auto-updater.md +8 -8
- package/docs/boot-sequence.md +11 -6
- package/docs/build-system.md +1 -1
- package/docs/cdp-debugging.md +1 -1
- package/docs/common-mistakes.md +7 -7
- package/docs/config-schema.md +1 -1
- package/docs/context-menu.md +13 -13
- package/docs/context.md +11 -11
- package/docs/css.md +3 -9
- package/docs/deep-link.md +25 -25
- package/docs/environment-detection.md +16 -16
- package/docs/fontawesome.md +7 -5
- package/docs/hooks.md +8 -8
- package/docs/index.md +38 -27
- package/docs/ipc.md +10 -10
- package/docs/lib-modules.md +9 -9
- package/docs/logging.md +12 -14
- package/docs/menu.md +18 -18
- package/docs/remote-config.md +9 -9
- package/docs/remote-scripts.md +12 -12
- package/docs/restart-manager.md +8 -8
- package/docs/sentry.md +4 -4
- package/docs/shared/analytics.md +1 -1
- package/docs/shared/breaking-changes.md +79 -13
- package/docs/shared/config.md +17 -21
- package/docs/shared/logging.md +1 -1
- package/docs/shared/monitoring.md +5 -5
- package/docs/shared/testing.md +2 -2
- package/docs/shared/theming.md +1 -1
- package/docs/shared/translation.md +19 -10
- package/docs/startup.md +16 -16
- package/docs/storage.md +11 -11
- package/docs/templating.md +3 -3
- package/docs/test-boot-layer.md +12 -12
- package/docs/test-framework.md +17 -17
- package/docs/themes.md +7 -7
- package/docs/tooltips.md +2 -2
- package/docs/tray.md +31 -31
- package/docs/usage.md +7 -7
- package/docs/verts.md +1 -1
- package/docs/windows.md +22 -22
- package/package.json +3 -4
- package/dist/lib/client-bridge.js +0 -374
- package/dist/lib/logger.js +0 -4
- package/dist/test/suites/build/manager.test.js +0 -213
- package/dist/test/suites/main/client-bridge.test.js +0 -262
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
// harness, " (Development)" in dev, untouched in production
|
|
4
4
|
// - app.userAgentFallback is set to a branded template via node-powertools.template
|
|
5
5
|
//
|
|
6
|
-
// These are observable side-effects of `
|
|
6
|
+
// These are observable side-effects of `omega.initialize()` so we just inspect
|
|
7
7
|
// the live electron `app` after the harness boot.
|
|
8
8
|
|
|
9
9
|
const defineCases = require('../../../vendor/devkit/test/define-cases.js');
|
|
@@ -34,7 +34,7 @@ module.exports = defineCases({
|
|
|
34
34
|
const userData = app.getPath('userData');
|
|
35
35
|
// The wipe ran before storage.initialize(); only files written by THIS
|
|
36
36
|
// boot may exist. A marker from a previous run must never survive.
|
|
37
|
-
const marker = path.join(userData, '
|
|
37
|
+
const marker = path.join(userData, '__omega-wipe-marker');
|
|
38
38
|
ctx.expect(fs.existsSync(marker)).toBe(false);
|
|
39
39
|
// Leave a marker so the NEXT run proves the wipe (self-perpetuating check).
|
|
40
40
|
fs.mkdirSync(userData, { recursive: true });
|
|
@@ -63,8 +63,8 @@ module.exports = defineCases({
|
|
|
63
63
|
name: 'userAgentFallback contains the brand name from config',
|
|
64
64
|
run: (ctx) => {
|
|
65
65
|
const { app } = require('electron');
|
|
66
|
-
const brand = ctx.
|
|
67
|
-
|| ctx.
|
|
66
|
+
const brand = ctx.omega.config?.brand?.name
|
|
67
|
+
|| ctx.omega.config?.app?.productName
|
|
68
68
|
|| 'App';
|
|
69
69
|
ctx.expect(app.userAgentFallback).toContain(brand);
|
|
70
70
|
},
|
|
@@ -13,78 +13,78 @@ module.exports = defineCases({
|
|
|
13
13
|
description: 'startup (main)',
|
|
14
14
|
cleanup: (ctx) => {
|
|
15
15
|
// Restore default mode so no later suite is affected.
|
|
16
|
-
if (ctx.
|
|
17
|
-
ctx.
|
|
16
|
+
if (ctx.omega.config?.startup) {
|
|
17
|
+
ctx.omega.config.startup.mode = 'normal';
|
|
18
18
|
}
|
|
19
19
|
},
|
|
20
20
|
tests: [
|
|
21
21
|
{
|
|
22
22
|
name: 'initialize ran during boot',
|
|
23
23
|
run: (ctx) => {
|
|
24
|
-
ctx.expect(ctx.
|
|
24
|
+
ctx.expect(ctx.omega.startup._initialized).toBe(true);
|
|
25
25
|
},
|
|
26
26
|
},
|
|
27
27
|
{
|
|
28
28
|
name: 'getMode returns "normal" by default',
|
|
29
29
|
run: (ctx) => {
|
|
30
|
-
ctx.
|
|
31
|
-
ctx.expect(ctx.
|
|
30
|
+
ctx.omega.config.startup.mode = 'normal';
|
|
31
|
+
ctx.expect(ctx.omega.startup.getMode()).toBe('normal');
|
|
32
32
|
},
|
|
33
33
|
},
|
|
34
34
|
{
|
|
35
35
|
name: 'getMode honors valid values',
|
|
36
36
|
run: (ctx) => {
|
|
37
37
|
for (const mode of ['normal', 'hidden']) {
|
|
38
|
-
ctx.
|
|
39
|
-
ctx.expect(ctx.
|
|
38
|
+
ctx.omega.config.startup.mode = mode;
|
|
39
|
+
ctx.expect(ctx.omega.startup.getMode()).toBe(mode);
|
|
40
40
|
}
|
|
41
41
|
},
|
|
42
42
|
},
|
|
43
43
|
{
|
|
44
44
|
name: 'getMode falls back to "normal" for unknown values',
|
|
45
45
|
run: (ctx) => {
|
|
46
|
-
ctx.
|
|
47
|
-
ctx.expect(ctx.
|
|
46
|
+
ctx.omega.config.startup.mode = 'banana';
|
|
47
|
+
ctx.expect(ctx.omega.startup.getMode()).toBe('normal');
|
|
48
48
|
},
|
|
49
49
|
},
|
|
50
50
|
{
|
|
51
51
|
name: 'getMode rejects deprecated tray-only as unknown (falls back to normal)',
|
|
52
52
|
run: (ctx) => {
|
|
53
53
|
// tray-only was folded into hidden; it's no longer a valid mode.
|
|
54
|
-
ctx.
|
|
55
|
-
ctx.expect(ctx.
|
|
54
|
+
ctx.omega.config.startup.mode = 'tray-only';
|
|
55
|
+
ctx.expect(ctx.omega.startup.getMode()).toBe('normal');
|
|
56
56
|
},
|
|
57
57
|
},
|
|
58
58
|
{
|
|
59
59
|
name: 'isLaunchHidden true for hidden, false for normal',
|
|
60
60
|
run: (ctx) => {
|
|
61
|
-
ctx.
|
|
62
|
-
ctx.expect(ctx.
|
|
63
|
-
ctx.
|
|
64
|
-
ctx.expect(ctx.
|
|
61
|
+
ctx.omega.config.startup.mode = 'normal';
|
|
62
|
+
ctx.expect(ctx.omega.startup.isLaunchHidden()).toBe(false);
|
|
63
|
+
ctx.omega.config.startup.mode = 'hidden';
|
|
64
|
+
ctx.expect(ctx.omega.startup.isLaunchHidden()).toBe(true);
|
|
65
65
|
},
|
|
66
66
|
},
|
|
67
67
|
{
|
|
68
68
|
name: 'applyEarly is a no-op outside hidden mode',
|
|
69
69
|
run: (ctx) => {
|
|
70
|
-
ctx.
|
|
70
|
+
ctx.omega.config.startup.mode = 'normal';
|
|
71
71
|
// Just confirm it doesn't throw.
|
|
72
|
-
ctx.
|
|
72
|
+
ctx.omega.startup.applyEarly();
|
|
73
73
|
ctx.expect(true).toBe(true);
|
|
74
74
|
},
|
|
75
75
|
},
|
|
76
76
|
{
|
|
77
77
|
name: 'applyEarly does not throw for hidden mode',
|
|
78
78
|
run: (ctx) => {
|
|
79
|
-
ctx.
|
|
80
|
-
ctx.
|
|
79
|
+
ctx.omega.config.startup.mode = 'hidden';
|
|
80
|
+
ctx.omega.startup.applyEarly();
|
|
81
81
|
ctx.expect(true).toBe(true);
|
|
82
82
|
},
|
|
83
83
|
},
|
|
84
84
|
{
|
|
85
85
|
name: 'isOpenAtLogin returns a boolean (or null on platforms without support)',
|
|
86
86
|
run: (ctx) => {
|
|
87
|
-
const v = ctx.
|
|
87
|
+
const v = ctx.omega.startup.isOpenAtLogin();
|
|
88
88
|
ctx.expect(v === null || typeof v === 'boolean').toBe(true);
|
|
89
89
|
},
|
|
90
90
|
},
|
|
@@ -92,7 +92,7 @@ module.exports = defineCases({
|
|
|
92
92
|
name: 'setOpenAtLogin runs without throwing',
|
|
93
93
|
run: (ctx) => {
|
|
94
94
|
// Set to false to avoid actually registering the test harness for login on the dev box.
|
|
95
|
-
ctx.
|
|
95
|
+
ctx.omega.startup.setOpenAtLogin(false);
|
|
96
96
|
ctx.expect(true).toBe(true);
|
|
97
97
|
},
|
|
98
98
|
},
|
|
@@ -100,17 +100,17 @@ module.exports = defineCases({
|
|
|
100
100
|
name: 'setOpenAtLogin accepts the object form { enabled, mode }',
|
|
101
101
|
run: (ctx) => {
|
|
102
102
|
// Object form should not throw and should round-trip the args/openAsHidden flags.
|
|
103
|
-
ctx.
|
|
104
|
-
ctx.
|
|
103
|
+
ctx.omega.startup.setOpenAtLogin({ enabled: false, mode: 'normal' });
|
|
104
|
+
ctx.omega.startup.setOpenAtLogin({ enabled: true, mode: 'hidden' });
|
|
105
105
|
// Restore to disabled at end so we don't leave the test harness as a login item.
|
|
106
|
-
ctx.
|
|
106
|
+
ctx.omega.startup.setOpenAtLogin(false);
|
|
107
107
|
ctx.expect(true).toBe(true);
|
|
108
108
|
},
|
|
109
109
|
},
|
|
110
110
|
{
|
|
111
111
|
name: 'wasLaunchedAtLogin returns a boolean',
|
|
112
112
|
run: (ctx) => {
|
|
113
|
-
ctx.expect(typeof ctx.
|
|
113
|
+
ctx.expect(typeof ctx.omega.startup.wasLaunchedAtLogin()).toBe('boolean');
|
|
114
114
|
},
|
|
115
115
|
},
|
|
116
116
|
{
|
|
@@ -119,7 +119,7 @@ module.exports = defineCases({
|
|
|
119
119
|
// The harness runs unpackaged, so initialize() must have force-OFF'd the login item.
|
|
120
120
|
// Confirm the current OS state reflects that — getLoginItemSettings should report
|
|
121
121
|
// openAtLogin: false. (Note: returns null on platforms without LoginItemSettings.)
|
|
122
|
-
const live = ctx.
|
|
122
|
+
const live = ctx.omega.startup.isOpenAtLogin();
|
|
123
123
|
if (live !== null) {
|
|
124
124
|
ctx.expect(live).toBe(false);
|
|
125
125
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Main-process tests for the global raw-BrowserWindow test stealth:
|
|
2
2
|
// utils/stealth-window.js applied by main.js's `browser-window-created` hook
|
|
3
|
-
// (registered during
|
|
3
|
+
// (registered during omega.initialize() step 1a-ii — this harness IS Testing
|
|
4
4
|
// mode, so the hook is live).
|
|
5
5
|
//
|
|
6
6
|
// Named windows created through lib/window-manager have their own stealth path
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Main-process tests for lib/storage.js — round-trip, dot-notation, persistence, broadcast.
|
|
2
2
|
//
|
|
3
|
-
// ctx.
|
|
3
|
+
// ctx.omega is a fully-initialized @omega.js/desktop main instance (skipWindowCreation: true).
|
|
4
4
|
|
|
5
5
|
const defineCases = require('../../../vendor/devkit/test/define-cases.js');
|
|
6
6
|
|
|
@@ -9,58 +9,58 @@ module.exports = defineCases({
|
|
|
9
9
|
layer: 'main',
|
|
10
10
|
description: 'storage (main)',
|
|
11
11
|
cleanup: async (ctx) => {
|
|
12
|
-
ctx.
|
|
12
|
+
ctx.omega.storage.clear();
|
|
13
13
|
},
|
|
14
14
|
tests: [
|
|
15
15
|
{
|
|
16
16
|
name: 'set + get round-trip',
|
|
17
17
|
run: (ctx) => {
|
|
18
|
-
ctx.
|
|
19
|
-
ctx.expect(ctx.
|
|
18
|
+
ctx.omega.storage.set('hello', 'world');
|
|
19
|
+
ctx.expect(ctx.omega.storage.get('hello')).toBe('world');
|
|
20
20
|
},
|
|
21
21
|
},
|
|
22
22
|
{
|
|
23
23
|
name: 'get returns default when missing',
|
|
24
24
|
run: (ctx) => {
|
|
25
|
-
ctx.expect(ctx.
|
|
26
|
-
ctx.expect(ctx.
|
|
25
|
+
ctx.expect(ctx.omega.storage.get('nope', 'fallback')).toBe('fallback');
|
|
26
|
+
ctx.expect(ctx.omega.storage.get('nope')).toBeUndefined();
|
|
27
27
|
},
|
|
28
28
|
},
|
|
29
29
|
{
|
|
30
30
|
name: 'has reflects presence',
|
|
31
31
|
run: (ctx) => {
|
|
32
|
-
ctx.
|
|
33
|
-
ctx.expect(ctx.
|
|
34
|
-
ctx.expect(ctx.
|
|
32
|
+
ctx.omega.storage.set('present', 1);
|
|
33
|
+
ctx.expect(ctx.omega.storage.has('present')).toBe(true);
|
|
34
|
+
ctx.expect(ctx.omega.storage.has('absent')).toBe(false);
|
|
35
35
|
},
|
|
36
36
|
},
|
|
37
37
|
{
|
|
38
38
|
name: 'delete removes the key',
|
|
39
39
|
run: (ctx) => {
|
|
40
|
-
ctx.
|
|
41
|
-
ctx.
|
|
42
|
-
ctx.expect(ctx.
|
|
40
|
+
ctx.omega.storage.set('temp', 'x');
|
|
41
|
+
ctx.omega.storage.delete('temp');
|
|
42
|
+
ctx.expect(ctx.omega.storage.has('temp')).toBe(false);
|
|
43
43
|
},
|
|
44
44
|
},
|
|
45
45
|
{
|
|
46
46
|
name: 'dot-notation nested paths',
|
|
47
47
|
run: (ctx) => {
|
|
48
|
-
ctx.
|
|
49
|
-
ctx.expect(ctx.
|
|
50
|
-
ctx.expect(ctx.
|
|
48
|
+
ctx.omega.storage.set('window.main.bounds', { x: 10, y: 20, w: 800, h: 600 });
|
|
49
|
+
ctx.expect(ctx.omega.storage.get('window.main.bounds')).toEqual({ x: 10, y: 20, w: 800, h: 600 });
|
|
50
|
+
ctx.expect(ctx.omega.storage.get('window.main.bounds.w')).toBe(800);
|
|
51
51
|
},
|
|
52
52
|
},
|
|
53
53
|
{
|
|
54
54
|
name: 'onChange fires for the watched key',
|
|
55
55
|
run: async (ctx) => {
|
|
56
56
|
const calls = [];
|
|
57
|
-
const unsub = ctx.
|
|
57
|
+
const unsub = ctx.omega.storage.onChange('watched', (value, previous) => {
|
|
58
58
|
calls.push({ value, previous });
|
|
59
59
|
});
|
|
60
|
-
ctx.
|
|
61
|
-
ctx.
|
|
60
|
+
ctx.omega.storage.set('watched', 'first');
|
|
61
|
+
ctx.omega.storage.set('watched', 'second');
|
|
62
62
|
unsub();
|
|
63
|
-
ctx.
|
|
63
|
+
ctx.omega.storage.set('watched', 'third'); // should NOT fire after unsub
|
|
64
64
|
ctx.expect(calls.length).toBe(2);
|
|
65
65
|
ctx.expect(calls[0].value).toBe('first');
|
|
66
66
|
ctx.expect(calls[1].value).toBe('second');
|
|
@@ -70,17 +70,17 @@ module.exports = defineCases({
|
|
|
70
70
|
{
|
|
71
71
|
name: 'clear empties the store',
|
|
72
72
|
run: (ctx) => {
|
|
73
|
-
ctx.
|
|
74
|
-
ctx.
|
|
75
|
-
ctx.
|
|
76
|
-
ctx.expect(ctx.
|
|
77
|
-
ctx.expect(ctx.
|
|
73
|
+
ctx.omega.storage.set('a', 1);
|
|
74
|
+
ctx.omega.storage.set('b', 2);
|
|
75
|
+
ctx.omega.storage.clear();
|
|
76
|
+
ctx.expect(ctx.omega.storage.has('a')).toBe(false);
|
|
77
|
+
ctx.expect(ctx.omega.storage.has('b')).toBe(false);
|
|
78
78
|
},
|
|
79
79
|
},
|
|
80
80
|
{
|
|
81
81
|
name: 'getPath returns the on-disk file location',
|
|
82
82
|
run: (ctx) => {
|
|
83
|
-
const p = ctx.
|
|
83
|
+
const p = ctx.omega.storage.getPath();
|
|
84
84
|
ctx.expect(typeof p).toBe('string');
|
|
85
85
|
ctx.expect(p).toMatch(/omega-storage\.json$/);
|
|
86
86
|
},
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// Main-process tests for lib/theme.js — source/resolved round-trip, nativeTheme
|
|
2
2
|
// wiring, persistence, change events (with dedupe), IPC handlers, validation.
|
|
3
3
|
//
|
|
4
|
-
// ctx.
|
|
4
|
+
// ctx.omega is a fully-initialized @omega.js/desktop main instance. Every test that mutates the theme
|
|
5
5
|
// restores it; cleanup() resets to the pre-suite source and clears the persisted
|
|
6
6
|
// override so later suites (and re-runs) start clean.
|
|
7
7
|
|
|
@@ -15,60 +15,60 @@ module.exports = defineCases({
|
|
|
15
15
|
description: 'theme (main)',
|
|
16
16
|
cleanup: async (ctx) => {
|
|
17
17
|
if (originalSource) {
|
|
18
|
-
ctx.
|
|
18
|
+
ctx.omega.theme.set(originalSource);
|
|
19
19
|
}
|
|
20
|
-
ctx.
|
|
20
|
+
ctx.omega.storage.delete('theme.appearance');
|
|
21
21
|
},
|
|
22
22
|
tests: [
|
|
23
23
|
{
|
|
24
|
-
name: '
|
|
24
|
+
name: 'omega.theme is initialized with the full API surface',
|
|
25
25
|
run: (ctx) => {
|
|
26
|
-
originalSource = ctx.
|
|
27
|
-
ctx.expect(ctx.
|
|
28
|
-
ctx.expect(typeof ctx.
|
|
29
|
-
ctx.expect(typeof ctx.
|
|
30
|
-
ctx.expect(typeof ctx.
|
|
31
|
-
ctx.expect(typeof ctx.
|
|
26
|
+
originalSource = ctx.omega.theme.get();
|
|
27
|
+
ctx.expect(ctx.omega.theme._initialized).toBe(true);
|
|
28
|
+
ctx.expect(typeof ctx.omega.theme.get).toBe('function');
|
|
29
|
+
ctx.expect(typeof ctx.omega.theme.set).toBe('function');
|
|
30
|
+
ctx.expect(typeof ctx.omega.theme.resolved).toBe('function');
|
|
31
|
+
ctx.expect(typeof ctx.omega.theme.onChange).toBe('function');
|
|
32
32
|
},
|
|
33
33
|
},
|
|
34
34
|
{
|
|
35
35
|
name: 'get() returns a valid source and resolved() a concrete appearance',
|
|
36
36
|
run: (ctx) => {
|
|
37
|
-
ctx.expect(['system', 'light', 'dark'].includes(ctx.
|
|
38
|
-
ctx.expect(['light', 'dark'].includes(ctx.
|
|
37
|
+
ctx.expect(['system', 'light', 'dark'].includes(ctx.omega.theme.get())).toBe(true);
|
|
38
|
+
ctx.expect(['light', 'dark'].includes(ctx.omega.theme.resolved())).toBe(true);
|
|
39
39
|
},
|
|
40
40
|
},
|
|
41
41
|
{
|
|
42
42
|
name: 'set("dark") drives nativeTheme.themeSource, resolution, and persistence',
|
|
43
43
|
run: (ctx) => {
|
|
44
44
|
const { nativeTheme } = require('electron');
|
|
45
|
-
ctx.
|
|
46
|
-
ctx.expect(ctx.
|
|
47
|
-
ctx.expect(ctx.
|
|
45
|
+
ctx.omega.theme.set('dark');
|
|
46
|
+
ctx.expect(ctx.omega.theme.get()).toBe('dark');
|
|
47
|
+
ctx.expect(ctx.omega.theme.resolved()).toBe('dark');
|
|
48
48
|
ctx.expect(nativeTheme.themeSource).toBe('dark');
|
|
49
49
|
ctx.expect(nativeTheme.shouldUseDarkColors).toBe(true);
|
|
50
|
-
ctx.expect(ctx.
|
|
50
|
+
ctx.expect(ctx.omega.storage.get('theme.appearance')).toBe('dark');
|
|
51
51
|
},
|
|
52
52
|
},
|
|
53
53
|
{
|
|
54
54
|
name: 'set("light") flips the resolution',
|
|
55
55
|
run: (ctx) => {
|
|
56
|
-
ctx.
|
|
57
|
-
ctx.expect(ctx.
|
|
58
|
-
ctx.expect(ctx.
|
|
59
|
-
ctx.expect(ctx.
|
|
56
|
+
ctx.omega.theme.set('light');
|
|
57
|
+
ctx.expect(ctx.omega.theme.get()).toBe('light');
|
|
58
|
+
ctx.expect(ctx.omega.theme.resolved()).toBe('light');
|
|
59
|
+
ctx.expect(ctx.omega.storage.get('theme.appearance')).toBe('light');
|
|
60
60
|
},
|
|
61
61
|
},
|
|
62
62
|
{
|
|
63
63
|
name: 'set("system") returns to following the OS',
|
|
64
64
|
run: (ctx) => {
|
|
65
65
|
const { nativeTheme } = require('electron');
|
|
66
|
-
ctx.
|
|
67
|
-
ctx.expect(ctx.
|
|
66
|
+
ctx.omega.theme.set('system');
|
|
67
|
+
ctx.expect(ctx.omega.theme.get()).toBe('system');
|
|
68
68
|
ctx.expect(nativeTheme.themeSource).toBe('system');
|
|
69
69
|
// In system mode the resolution is whatever the OS says — assert coherence,
|
|
70
70
|
// not a specific value (the test machine's OS preference is not ours to pin).
|
|
71
|
-
ctx.expect(ctx.
|
|
71
|
+
ctx.expect(ctx.omega.theme.resolved()).toBe(nativeTheme.shouldUseDarkColors ? 'dark' : 'light');
|
|
72
72
|
},
|
|
73
73
|
},
|
|
74
74
|
{
|
|
@@ -76,7 +76,7 @@ module.exports = defineCases({
|
|
|
76
76
|
run: (ctx) => {
|
|
77
77
|
let threw = false;
|
|
78
78
|
try {
|
|
79
|
-
ctx.
|
|
79
|
+
ctx.omega.theme.set('auto');
|
|
80
80
|
} catch (e) {
|
|
81
81
|
threw = true;
|
|
82
82
|
}
|
|
@@ -84,7 +84,7 @@ module.exports = defineCases({
|
|
|
84
84
|
|
|
85
85
|
threw = false;
|
|
86
86
|
try {
|
|
87
|
-
ctx.
|
|
87
|
+
ctx.omega.theme.set(undefined);
|
|
88
88
|
} catch (e) {
|
|
89
89
|
threw = true;
|
|
90
90
|
}
|
|
@@ -94,17 +94,17 @@ module.exports = defineCases({
|
|
|
94
94
|
{
|
|
95
95
|
name: 'onChange fires once per effective change (deduped) and unsubscribes',
|
|
96
96
|
run: (ctx) => {
|
|
97
|
-
ctx.
|
|
97
|
+
ctx.omega.theme.set('light');
|
|
98
98
|
|
|
99
99
|
const calls = [];
|
|
100
|
-
const unsub = ctx.
|
|
100
|
+
const unsub = ctx.omega.theme.onChange((payload) => calls.push(payload));
|
|
101
101
|
|
|
102
|
-
ctx.
|
|
103
|
-
ctx.
|
|
104
|
-
ctx.
|
|
102
|
+
ctx.omega.theme.set('dark'); // change → fires
|
|
103
|
+
ctx.omega.theme.set('dark'); // no-op → silent
|
|
104
|
+
ctx.omega.theme.set('light'); // change → fires
|
|
105
105
|
|
|
106
106
|
unsub();
|
|
107
|
-
ctx.
|
|
107
|
+
ctx.omega.theme.set('dark'); // unsubscribed → silent
|
|
108
108
|
|
|
109
109
|
ctx.expect(calls.length).toBe(2);
|
|
110
110
|
ctx.expect(calls[0]).toEqual({ source: 'dark', resolved: 'dark' });
|
|
@@ -114,10 +114,10 @@ module.exports = defineCases({
|
|
|
114
114
|
{
|
|
115
115
|
name: 'desktop:theme:get / desktop:theme:set IPC handlers round-trip',
|
|
116
116
|
run: async (ctx) => {
|
|
117
|
-
const set = await ctx.
|
|
117
|
+
const set = await ctx.omega.ipc.invoke('desktop:theme:set', { source: 'dark' });
|
|
118
118
|
ctx.expect(set).toEqual({ source: 'dark', resolved: 'dark' });
|
|
119
119
|
|
|
120
|
-
const got = await ctx.
|
|
120
|
+
const got = await ctx.omega.ipc.invoke('desktop:theme:get');
|
|
121
121
|
ctx.expect(got).toEqual({ source: 'dark', resolved: 'dark' });
|
|
122
122
|
},
|
|
123
123
|
},
|
|
@@ -126,7 +126,7 @@ module.exports = defineCases({
|
|
|
126
126
|
run: async (ctx) => {
|
|
127
127
|
let threw = false;
|
|
128
128
|
try {
|
|
129
|
-
await ctx.
|
|
129
|
+
await ctx.omega.ipc.invoke('desktop:theme:set', { source: 'midnight' });
|
|
130
130
|
} catch (e) {
|
|
131
131
|
threw = true;
|
|
132
132
|
}
|