BRM-118: у недоступных кнопок «Сводки» всплывающая подсказка — та же причина, что рядом
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
b54b70a56e
commit
6f2dc23b98
@ -363,7 +363,7 @@ export function createApp({ file, oppsFile, metricsFile, telegram = createTelegr
|
||||
page = page.replace("<table id=\"list\"></table>", metricsTable(pageLang, metrics.list()));
|
||||
for (const [id, offNow, why] of [["stop", off, "ui.sum.s.stopWhy"], ["resume", !off, "ui.sum.s.resumeWhy"]]) {
|
||||
if (!offNow) continue;
|
||||
page = page.replace(`<button id="${id}" `, `<button id="${id}" class="off" aria-disabled="true" `).replace(`<small id="${id}why"></small>`, `<small id="${id}why">${t(pageLang, why)}</small>`);
|
||||
page = page.replace(`<button id="${id}" `, `<button id="${id}" class="off" aria-disabled="true" `).replace(new RegExp(`(<button id="${id}"[^>]*?) title="[^"]*"`), `$1 title="${t(pageLang, why)}"`).replace(`<small id="${id}why"></small>`, `<small id="${id}why">${t(pageLang, why)}</small>`);
|
||||
}
|
||||
if (!telegram.connected()) page = page.replace('<small id="sendwhy"></small>', `<small id="sendwhy">${t(pageLang, telegram.missing?.() ? "why.tg.short." + telegram.missing() : "ui.sum.sendWhy")}</small>`);
|
||||
}
|
||||
|
||||
@ -92,12 +92,14 @@ test("BRM-96: «Сводка» и письмо до скриптов показ
|
||||
let h = await (await fetch(base + "/summary.html")).text();
|
||||
assert.match(h, /<button id="resume" class="off" aria-disabled="true"/);
|
||||
assert.ok(h.includes('<small id="resumewhy">Рассылка уже идёт.</small>'));
|
||||
assert.match(h, /id="resume"[^>]*title="Рассылка уже идёт\."/);
|
||||
assert.match(h, /<button id="stop" data-t/, "«Остановить» доступна, причины нет");
|
||||
assert.ok(h.includes('<small id="stopwhy"></small>'));
|
||||
await fetch(base + "/api/summary/stop", { method: "POST", headers: { "content-type": "application/json" }, body: "{}" });
|
||||
h = await (await fetch(base + "/summary.html")).text();
|
||||
assert.match(h, /<button id="stop" class="off" aria-disabled="true"/);
|
||||
assert.ok(h.includes('<small id="stopwhy">Рассылка уже остановлена.</small>'));
|
||||
assert.match(h, /id="stop"[^>]*title="Рассылка уже остановлена\."/);
|
||||
assert.ok(h.includes('<small id="resumewhy"></small>'));
|
||||
const o = await (await fetch(base + "/opportunities.html")).text();
|
||||
assert.match(o, /id="lmark" disabled aria-disabled="true"/);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user