diff options
| author | Adam Soltys <[email protected]> | 2026-10-02 15:01:43 -0700 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2026-10-02 15:01:43 -0700 |
| commit | 544c61e8c27652c71501277b10875eeead0a402c (patch) | |
| tree | f5d1426202b6d40c17e0903514955c280d089767 /tools | |
| parent | 875d7df2c1c83ecfa85fe1c4546be6b568cc2e25 (diff) | |
| download | coinosv3-544c61e8c27652c71501277b10875eeead0a402c.tar.gz coinosv3-544c61e8c27652c71501277b10875eeead0a402c.zip | |
Switching Spending/Savings opens Receive, with that account's address
It opened the history tab. Any open payment detail still closes with the
switch.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Dmcrt9KyNDKVWFKnb8BREo
Diffstat (limited to 'tools')
| -rw-r--r-- | tools/ark/cooperative-exit-ui-test.js | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/tools/ark/cooperative-exit-ui-test.js b/tools/ark/cooperative-exit-ui-test.js index 72e4705..d8f990d 100644 --- a/tools/ark/cooperative-exit-ui-test.js +++ b/tools/ark/cooperative-exit-ui-test.js @@ -9,7 +9,7 @@ const bundle = await Bun.build({ entrypoints: ['src/app.js'], target: 'browser', plugins: [{ name: 'cooperative-exit-test', setup(build) { build.onLoad({ filter: /src\/app\.js$/ }, async ({ path }) => ({ loader: 'js', contents: await Bun.file(path).text() + ` window.coopApp = { ui, wallet, ctx, render, enterWallet, get ready() { return !_bootDeciding; }, - setSpending: () => { const a = activeAccount(); if (a) a.kind = 'spending'; } }; + setSpending: (on = true) => { const a = activeAccount(); if (a) { if (on) a.kind = 'spending'; else delete a.kind; } } }; ` })); build.onLoad({ filter: /src\/features\/ark\.js$/ }, async ({ path }) => ({ loader: 'js', contents: (await Bun.file(path).text()).replace(' arkReady() { return arkAvailable(); },', ' arkReady() { return window.forceArkReady || arkAvailable(); },').replace(" return {\n id: 'ark',", ` @@ -100,6 +100,17 @@ try { assert.deepEqual(await page.evaluate(() => coopCalls), [], 'opening the form never starts an exit'); console.log('✓ From the Spending settings, the co-operative exit opens its form, prefilled to Savings'); await page.evaluate(() => { coopApp.ui.arkOffboardSend = null; coopApp.ui.tab = 'receive'; coopApp.render(); }); + // switching between Spending and Savings lands on the Receive page, with + // that account's address, whatever tab was open + await page.evaluate(() => { window.forceArkReady = true; coopApp.setSpending(false); coopApp.ui.account = 'spending'; coopApp.render(); }); + for (const [from, to] of [['history', 'savings'], ['send', 'savings']]) { + await page.evaluate((from) => { coopApp.ui.account = 'spending'; coopApp.ui.tab = from; coopApp.render(); }, from); + await page.evaluate((to) => coopApp.ctx.setAccount(to), to); + await new Promise((r) => setTimeout(r, 300)); + const got = await page.evaluate(() => ({ tab: coopApp.ui.tab, account: coopApp.ctx.getAccount(), address: /bcrt1|tark1|ark1/.test(document.querySelector('.tab-pane')?.innerText || '') })); + assert.deepEqual(got, { tab: 'receive', account: to, address: true }, from + ' → ' + to + ': ' + JSON.stringify(got)); + } + console.log('✓ Switching between Spending and Savings opens Receive, with that account\'s address'); await page.evaluate(() => { window.forceArkReady = false; coopApp.wallet.saveFeatureState('arkDepth', null); coopApp.ui.screen = 'wallet'; coopApp.render(); }); await manage(); |
