mirror of
https://github.com/jason5ng32/MyIP.git
synced 2026-11-04 08:55:47 +00:00
A pass over every file the branch touched, after the iOS animation hunt left tries and reverts behind it. Removed what nothing reaches: the view-transition rule for a transition no code starts, an unreachable guard in the transition hook, a no-op KeepAlive key branch, a sign-in guard the menu already enforces, usage-dialog wrappers that only forwarded to the store, a duplicated modifier-click check and card filter (isPlainClick / listedTools), a test that hand-rolled listedTools, a drawer-era fixture parameter. auth-flow.js folded into auth-redirect.js. Comments cut to what the code cannot say itself — file headers of a few lines, the measured iOS reasons, non-obvious orderings — and stale ones fixed (Nav under KeepAlive, Home.vue reusing DEFAULT_META, "from Nav", enabledCards). AGENTS.md sections tightened to the code as it is now. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013GbLTGMZ45MV78qd2tHoco
35 lines
1.4 KiB
JavaScript
35 lines
1.4 KiB
JavaScript
// resolveBackTarget() — where the page breadcrumb's "Home" crumb goes.
|
|
|
|
import assert from 'node:assert/strict';
|
|
import { describe, it } from 'node:test';
|
|
import { resolveBackTarget } from '../frontend/utils/back-target.js';
|
|
|
|
describe('resolveBackTarget()', () => {
|
|
it('steps back when the previous entry is the homepage', () => {
|
|
assert.equal(resolveBackTarget({ back: '/', current: '/tools/whois' }), 'back');
|
|
});
|
|
|
|
it('treats a homepage entry with a query or hash as the homepage', () => {
|
|
assert.equal(resolveBackTarget({ back: '/?utm_source=x' }), 'back');
|
|
assert.equal(resolveBackTarget({ back: '/#AdvancedTools' }), 'back');
|
|
});
|
|
|
|
it('pushes home when the page was opened directly', () => {
|
|
assert.equal(resolveBackTarget({ back: null, current: '/tools/whois' }), '/');
|
|
assert.equal(resolveBackTarget(null), '/');
|
|
assert.equal(resolveBackTarget(undefined), '/');
|
|
assert.equal(resolveBackTarget({}), '/');
|
|
});
|
|
|
|
it('pushes home when the previous entry is another page', () => {
|
|
assert.equal(resolveBackTarget({ back: '/tools/ipcalculator' }), '/');
|
|
assert.equal(resolveBackTarget({ back: '/privacy' }), '/');
|
|
assert.equal(resolveBackTarget({ back: '/r/abc' }), '/');
|
|
});
|
|
|
|
it('ignores a non-string back entry', () => {
|
|
assert.equal(resolveBackTarget({ back: 1 }), '/');
|
|
assert.equal(resolveBackTarget({ back: { path: '/' } }), '/');
|
|
});
|
|
});
|