Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Add support for MD / HTML in room topics #8215

Merged
merged 26 commits into from
Jun 7, 2022
Merged
Changes from 1 commit
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
78f8d38
Add support for MD / HTML in room topics
Johennes May 2, 2022
93c7fcf
Merge branch 'develop' into feature/html-topic
Johennes May 9, 2022
36cb244
Fix build error
Johennes May 9, 2022
e68273a
Add comment to explain origin of styles
Johennes May 11, 2022
080a485
Merge branch 'develop' into feature/html-topic
Johennes May 11, 2022
ec16b10
Empty commit to retrigger build
Johennes May 11, 2022
21a67f6
Merge branch 'develop' into feature/html-topic
Johennes May 17, 2022
0894a5b
Fix import grouping
Johennes May 17, 2022
29a1597
Merge branch 'develop' into feature/html-topic
Johennes May 18, 2022
a87d9b7
Fix useTopic test
Johennes May 18, 2022
e889223
Add tests for HtmlUtils
Johennes May 18, 2022
5c2ccf2
Add slash command test
Johennes May 19, 2022
000c29a
Add further serialize test
Johennes May 19, 2022
215ea37
Fix ternary formatting
Johennes May 20, 2022
2f19de8
Add blank line
Johennes May 20, 2022
f248472
Properly mock SettingsStore access
Johennes May 20, 2022
d7d74d5
Remove trailing space
Johennes May 20, 2022
f1b08ec
Assert on HTML content and add test for plain text in HTML parameter
Johennes May 20, 2022
553a02e
Appease the linter
Johennes May 20, 2022
87f114a
Fix JSDoc comment
Johennes May 25, 2022
04448ec
Fix toEqual call formatting
Johennes May 25, 2022
91bf281
Repurpose test for literal HTML case
Johennes May 25, 2022
d8bf47b
Merge branch 'develop' into feature/html-topic
Johennes May 25, 2022
ee089c5
Merge branch 'develop' into feature/html-topic
turt2live Jun 7, 2022
eac9691
Merge branch 'develop' into feature/html-topic
turt2live Jun 7, 2022
ee85b7d
Empty commit to fix CI
turt2live Jun 7, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 14 additions & 8 deletions test/HtmlUtils-test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,27 +33,33 @@ describe('HtmlUtils', () => {
it('converts plain text topic to HTML', () => {
const component = mount(<div>{ topicToHtml("pizza", null, null, false) }</div>);
const wrapper = component.render();
expect(wrapper.text()).toEqual("pizza");
expect(wrapper.children().first().html()).toEqual("pizza");
});

it('converts plain text topic with emoji to HTML', () => {
Johennes marked this conversation as resolved.
Show resolved Hide resolved
const component = mount(<div>{ topicToHtml("🍕", null, null, false) }</div>);
const component = mount(<div>{ topicToHtml("pizza 🍕", null, null, false) }</div>);
const wrapper = component.render();
expect(wrapper.find(".mx_Emoji").text()).toEqual("🍕");
expect(wrapper.children().first().html()).toEqual("pizza <span class=\"mx_Emoji\" title=\":pizza:\">🍕</span>");
});

it('converts HTML topic to HTML', async () => {
it('converts plain text HTML topic to HTML', async () => {
enableHtmlTopicFeature();
const component = mount(<div>{ topicToHtml("pizza", "pizza", null, false) }</div>);
const wrapper = component.render();
expect(wrapper.children().first().html()).toEqual("pizza");
});

it('converts true HTML topic to HTML', async () => {
enableHtmlTopicFeature();
const component = mount(<div>{ topicToHtml("**pizza**", "<b>pizza</b>", null, false) }</div>);
const wrapper = component.render();
expect(wrapper.find("b").text()).toEqual("pizza");
expect(wrapper.children().first().html()).toEqual("<b>pizza</b>");
});

it('converts HTML topic with emoji to HTML', async () => {
it('converts true HTML topic with emoji to HTML', async () => {
enableHtmlTopicFeature();
const component = mount(<div>{ topicToHtml("**pizza** 🍕", "<b>pizza</b> 🍕", null, false) }</div>);
const wrapper = component.render();
expect(wrapper.find("b").text()).toEqual("pizza");
expect(wrapper.find(".mx_Emoji").text()).toEqual("🍕");
expect(wrapper.children().first().html()).toEqual("<b>pizza</b> <span class=\"mx_Emoji\" title=\":pizza:\">🍕</span>");
});
});
Johennes marked this conversation as resolved.
Show resolved Hide resolved