mirror of
https://github.com/wassname/talk.git
synced 2026-08-05 13:30:26 +08:00
* feat: Improve html handling, integrate new @coralproject/rte * chore: refactor and add comments * chore: remove obsolete line * chore: rename `inputId` to `inputID` * chore: upgrade @coralproject/rte * fix: update snapshots * chore: apply review suggestions * fix: snapshot / tests * fix: merge issues * [CORL-1056] Configurable RTE (#2967) * fix: merge issues * feat: Configure RTE * test: add tests * chore: just a comment * chore: remove unused translations
25 lines
711 B
TypeScript
25 lines
711 B
TypeScript
import removeTrailingEmptyLines from "./removeTrailingEmptyLines";
|
|
|
|
function createNodeWithHTML(html: string) {
|
|
const el = document.createElement("div");
|
|
el.innerHTML = html;
|
|
return el;
|
|
}
|
|
|
|
it("trims HTML", () => {
|
|
const examples = [
|
|
createNodeWithHTML(
|
|
"<div>a</div><div><br></div><div><br></div><div><br></div><div> <br></div>"
|
|
),
|
|
createNodeWithHTML(
|
|
"<div>a<br></div><div><br></div><div><b>b</b><br></div>"
|
|
),
|
|
];
|
|
|
|
examples.forEach((e) => removeTrailingEmptyLines(e));
|
|
expect(examples[0].innerHTML).toMatchInlineSnapshot(`"<div>a</div>"`);
|
|
expect(examples[1].innerHTML).toMatchInlineSnapshot(
|
|
`"<div>a<br></div><div><br></div><div><b>b</b><br></div>"`
|
|
);
|
|
});
|