mirror of
https://github.com/wekan/wekan.git
synced 2026-11-25 10:48:06 -05:00
Replace the Requested By and Assigned By Add text with plus icons while retaining localized tooltips and accessible names. Thanks to xet7 !
23 lines
1.0 KiB
JavaScript
23 lines
1.0 KiB
JavaScript
const test = require('node:test');
|
|
const assert = require('node:assert/strict');
|
|
const fs = require('node:fs');
|
|
|
|
const jade = fs.readFileSync('client/components/cards/cardDetails.jade', 'utf8');
|
|
|
|
for (const field of [
|
|
{ helper: 'getRequestedBy', selector: 'js-card-details-requester' },
|
|
{ helper: 'getAssignedBy', selector: 'js-card-details-assigner' },
|
|
]) {
|
|
test(`${field.selector} uses icons with accessible add/edit names`, () => {
|
|
const start = jade.indexOf(`classNames="${field.selector}"`);
|
|
assert.notEqual(start, -1);
|
|
const end = jade.indexOf('\n else', start);
|
|
const block = jade.slice(start, end);
|
|
assert.match(block, /title="\{\{#if .*\}\}\{\{_ 'edit'\}\}\{\{else\}\}\{\{_ 'add'\}\}\{\{\/if\}\}"/);
|
|
assert.match(block, /aria-label="\{\{#if .*\}\}\{\{_ 'edit'\}\}\{\{else\}\}\{\{_ 'add'\}\}\{\{\/if\}\}"/);
|
|
assert.match(block, /i\.fa\.fa-pencil-square-o\(aria-hidden="true"\)/);
|
|
assert.match(block, /i\.fa\.fa-plus\(aria-hidden="true"\)/);
|
|
assert.doesNotMatch(block, /^\s*\| \{\{_ 'add'\}\}/m);
|
|
});
|
|
}
|