Files
raucao 11f8d3f049 WIP: Add calendar settings and a nested modal stack
Add a 'days with events' preference (default 3, range 1-7) that drives the upcoming events widget, and extend the fetch window to 8 days so the largest window can populate.

Add a Calendar settings pane (moved under Integrations) that lists the connected CalDAV/ICS sources in a two-column grid with add/edit/remove, and remove calendars from Manage Integrations.

Turn the modal service into a stack so add/edit forms open on top of the settings dialog, with one dialog per level, per-entry title ids, and a softened stacked backdrop.

Move CALENDAR_ACTOR into its own config module to break the calendar/caldav/ics import cycle.
2026-11-06 15:48:08 +04:00

67 lines
1.8 KiB
JavaScript

import { module, test } from 'qunit';
import { setupTest } from 'dashtab/tests/helpers';
module('Unit | Service | modal', function (hooks) {
setupTest(hooks);
test('it tracks the open modal through open, replace and close', function (assert) {
const service = this.owner.lookup('service:modal');
assert.strictEqual(service.current, null);
const first = { component: 'first' };
service.open(first);
assert.strictEqual(service.current, first);
const second = { component: 'second' };
service.replace(second);
assert.strictEqual(service.current, second);
service.finished();
assert.strictEqual(service.current, null);
service.open(first);
service.close();
assert.strictEqual(service.current, null);
});
test('it stacks modals and pops them one at a time', function (assert) {
const service = this.owner.lookup('service:modal');
const first = { component: 'first' };
const second = { component: 'second' };
service.open(first);
service.open(second);
assert.strictEqual(service.stack.length, 2);
assert.strictEqual(service.current, second);
service.close();
assert.strictEqual(service.stack.length, 1);
assert.strictEqual(service.current, first);
});
test('finished removes the matching descriptor and is idempotent', function (assert) {
const service = this.owner.lookup('service:modal');
const first = { component: 'first' };
const second = { component: 'second' };
service.open(first);
service.open(second);
service.finished(second);
assert.strictEqual(service.stack.length, 1);
assert.strictEqual(service.current, first);
// Removing an already-removed descriptor is a no-op.
service.finished(second);
assert.strictEqual(service.stack.length, 1);
assert.strictEqual(service.current, first);
});
});