Files
wekan/tests/ruleCheckboxDescription.test.cjs
T
Lauri Ojansivu 846f190690 Send authorized card attachments with email rules
Add an opt-in native checkbox, read live triggering-card files through the storage strategy, recheck source access and attachment metadata after reads, and preserve byte snapshots through email localization and transport.

Verify filesystem and GridFS MIME delivery with local SMTP capture, soft deletion, missing-file failures, keyboard selection, permission changes and durable attachment integrity. Full card-content rendering remains open in #2713.

Thanks to kabi178, bbyszio and xet7 !
2026-09-28 19:35:19 +03:00

17 lines
1014 B
JavaScript

'use strict';
const { test } = require('node:test');
const assert = require('node:assert/strict');
const fs = require('node:fs');
const source = fs.readFileSync('client/lib/utils.js', 'utf8');
const start = source.indexOf(' getTriggerActionDesc(event, tempInstance) {') + ' getTriggerActionDesc(event, tempInstance) {'.length;
const describe = new Function('event', 'tempInstance', source.slice(start, source.indexOf('\n },', start)));
test('rule descriptions name selected checkboxes and omit unchecked choices instead of showing on', () => {
for (const checked of [true, false]) {
const label = { hasClass: () => false, text: () => ' Attachments ',
find: selector => selector === 'input[type=checkbox]' ? { length: 1, is: () => checked } : { length: 0 } };
const parent = {};
const tpl = { $: node => node === parent ? { find: () => ({ children: () => [label] }) } : node };
assert.equal(describe({ currentTarget: { parentNode: parent } }, tpl), checked ? 'Attachments' : '');
}
});