mirror of
https://github.com/vector-im/hydrogen-web.git
synced 2024-12-23 11:35:04 +01:00
Add two new tests for replies
This commit is contained in:
parent
8dc80e68a7
commit
4c1aeb342a
@ -397,8 +397,8 @@ export function tests() {
|
|||||||
parseHTML: (html) => new HTMLParseResult(parse(html))
|
parseHTML: (html) => new HTMLParseResult(parse(html))
|
||||||
};
|
};
|
||||||
|
|
||||||
function test(assert, input, output) {
|
function test(assert, input, output, replies=true) {
|
||||||
assert.deepEqual(parseHTMLBody(platform, null, true, input), new MessageBody(input, output));
|
assert.deepEqual(parseHTMLBody(platform, null, replies, input), new MessageBody(input, output));
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
@ -495,6 +495,24 @@ export function tests() {
|
|||||||
new CodeBlock(null, code)
|
new CodeBlock(null, code)
|
||||||
];
|
];
|
||||||
test(assert, input, output);
|
test(assert, input, output);
|
||||||
|
},
|
||||||
|
"Replies are inserted when allowed": assert => {
|
||||||
|
const input = 'Hello, <em><mx-reply>World</mx-reply></em>!';
|
||||||
|
const output = [
|
||||||
|
new TextPart('Hello, '),
|
||||||
|
new FormatPart("em", [new TextPart('World')]),
|
||||||
|
new TextPart('!'),
|
||||||
|
];
|
||||||
|
test(assert, input, output);
|
||||||
|
},
|
||||||
|
"Replies are stripped when not allowed": assert => {
|
||||||
|
const input = 'Hello, <em><mx-reply>World</mx-reply></em>!';
|
||||||
|
const output = [
|
||||||
|
new TextPart('Hello, '),
|
||||||
|
new FormatPart("em", []),
|
||||||
|
new TextPart('!'),
|
||||||
|
];
|
||||||
|
test(assert, input, output, false);
|
||||||
}
|
}
|
||||||
/* Doesnt work: HTML library doesn't handle <pre><code> properly.
|
/* Doesnt work: HTML library doesn't handle <pre><code> properly.
|
||||||
"Text with code block": assert => {
|
"Text with code block": assert => {
|
||||||
|
Loading…
Reference in New Issue
Block a user