Commit 4bf823f6 authored by JC Brand's avatar JC Brand

Fix show/hide of spoilers

parent c3d6b64f
......@@ -153,15 +153,15 @@ describe("A spoiler message", function () {
await u.waitUntil(() => message_content.textContent === spoiler);
const spoiler_msg_el = view.el.querySelector('.chat-msg__text.spoiler');
expect(Array.from(spoiler_msg_el.classList).includes('collapsed')).toBeTruthy();
expect(Array.from(spoiler_msg_el.classList).includes('hidden')).toBeTruthy();
spoiler_toggle = view.el.querySelector('.spoiler-toggle');
expect(spoiler_toggle.textContent.trim()).toBe('Show more');
spoiler_toggle.click();
await u.waitUntil(() => !Array.from(spoiler_msg_el.classList).includes('collapsed'));
await u.waitUntil(() => !Array.from(spoiler_msg_el.classList).includes('hidden'));
expect(spoiler_toggle.textContent.trim()).toBe('Show less');
spoiler_toggle.click();
await u.waitUntil(() => Array.from(spoiler_msg_el.classList).includes('collapsed'));
await u.waitUntil(() => Array.from(spoiler_msg_el.classList).includes('hidden'));
done();
}));
......@@ -235,15 +235,15 @@ describe("A spoiler message", function () {
await u.waitUntil(() => message_content.textContent === spoiler);
const spoiler_msg_el = view.el.querySelector('.chat-msg__text.spoiler');
expect(Array.from(spoiler_msg_el.classList).includes('collapsed')).toBeTruthy();
expect(Array.from(spoiler_msg_el.classList).includes('hidden')).toBeTruthy();
spoiler_toggle = view.el.querySelector('.spoiler-toggle');
expect(spoiler_toggle.textContent.trim()).toBe('Show more');
spoiler_toggle.click();
await u.waitUntil(() => !Array.from(spoiler_msg_el.classList).includes('collapsed'));
await u.waitUntil(() => !Array.from(spoiler_msg_el.classList).includes('hidden'));
expect(spoiler_toggle.textContent.trim()).toBe('Show less');
spoiler_toggle.click();
await u.waitUntil(() => Array.from(spoiler_msg_el.classList).includes('collapsed'));
await u.waitUntil(() => Array.from(spoiler_msg_el.classList).includes('hidden'));
done();
}));
});
......@@ -223,7 +223,7 @@ export default class Message extends CustomElement {
</a>
</div>
`;
const spoiler_classes = this.is_spoiler ? `spoiler ${this.is_spoiler_visible ? '' : 'collapsed'}` : '';
const spoiler_classes = this.is_spoiler ? `spoiler ${this.is_spoiler_visible ? '' : 'hidden'}` : '';
return html`
${ this.is_spoiler ? tpl_spoiler_hint : '' }
${ this.subject ? html`<div class="chat-msg__subject">${this.subject}</div>` : '' }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment