Fix show/hide of spoilers
This commit is contained in:
parent
c3d6b64f4b
commit
4bf823f6cd
@ -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>` : '' }
|
||||
|
Loading…
Reference in New Issue
Block a user