schlechtenburg/packages/rich-text/lib/test/__snapshots__/to-dom.test.ts.snap
2024-10-08 09:15:26 +02:00

304 lines
4.2 KiB
Plaintext
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
exports[`recordToDom should create a value with formatting 1`] = `
<body>
<em
data-rich-text-format-boundary="true"
>
test
</em>
</body>
`;
exports[`recordToDom should create a value with formatting for split tags 1`] = `
<body>
<em
data-rich-text-format-boundary="true"
>
test
</em>
</body>
`;
exports[`recordToDom should create a value with formatting with attributes 1`] = `
<body>
<a
data-rich-text-format-boundary="true"
href="#"
>
test
</a>
</body>
`;
exports[`recordToDom should create a value with image object 1`] = `
<body>
<img
src=""
/>
</body>
`;
exports[`recordToDom should create a value with image object and formatting 1`] = `
<body>
<em
data-rich-text-format-boundary="true"
>
<img
src=""
/>
</em>
</body>
`;
exports[`recordToDom should create a value with image object and text after 1`] = `
<body>
<em>
<img
src=""
/>
te
</em>
st
</body>
`;
exports[`recordToDom should create a value with image object and text before 1`] = `
<body>
te
<em>
st
<img
src=""
/>
</em>
</body>
`;
exports[`recordToDom should create a value with nested formatting 1`] = `
<body>
<em>
<strong
data-rich-text-format-boundary="true"
>
test
</strong>
</em>
</body>
`;
exports[`recordToDom should create a value without formatting 1`] = `
<body>
test
</body>
`;
exports[`recordToDom should create an empty value 1`] = `
<body>

</body>
`;
exports[`recordToDom should create an empty value from empty tags 1`] = `
<body>

</body>
`;
exports[`recordToDom should disarm on* attribute 1`] = `
<body>
<img
data-disable-rich-text-onerror="alert('1')"
/>
</body>
`;
exports[`recordToDom should disarm script 1`] = `
<body>
<script
data-rich-text-script="alert(%221%22)"
/>
</body>
`;
exports[`recordToDom should filter format boundary attributes 1`] = `
<body>
<strong
data-rich-text-format-boundary="true"
>
test
</strong>
</body>
`;
exports[`recordToDom should handle br 1`] = `
<body>
<br
data-rich-text-line-break="true"
/>

</body>
`;
exports[`recordToDom should handle br with formatting 1`] = `
<body>
<em
data-rich-text-format-boundary="true"
>
<br
data-rich-text-line-break="true"
/>
</em>

</body>
`;
exports[`recordToDom should handle br with text 1`] = `
<body>
te
<br
data-rich-text-line-break="true"
/>
st
</body>
`;
exports[`recordToDom should handle double br 1`] = `
<body>
a
<br
data-rich-text-line-break="true"
/>
<br
data-rich-text-line-break="true"
/>
b
</body>
`;
exports[`recordToDom should handle selection before br 1`] = `
<body>
a
<br
data-rich-text-line-break="true"
/>
<br
data-rich-text-line-break="true"
/>
b
</body>
`;
exports[`recordToDom should ignore manually added object replacement character 1`] = `
<body>
test
</body>
`;
exports[`recordToDom should ignore manually added object replacement character with formatting 1`] = `
<body>
<em
data-rich-text-format-boundary="true"
>
hi
</em>
</body>
`;
exports[`recordToDom should not error with overlapping formats (1) 1`] = `
<body>
<a
href="#"
>
<em>
1
</em>
<strong
data-rich-text-format-boundary="true"
>
2
</strong>
</a>
</body>
`;
exports[`recordToDom should not error with overlapping formats (2) 1`] = `
<body>
<em>
<a
data-rich-text-format-boundary="true"
href="#"
>
1
</a>
</em>
<strong>
<a
data-rich-text-format-boundary="true"
href="#"
>
2
</a>
</strong>
</body>
`;
exports[`recordToDom should preserve emoji 1`] = `
<body>
🍒
</body>
`;
exports[`recordToDom should preserve emoji in formatting 1`] = `
<body>
<em
data-rich-text-format-boundary="true"
>
🍒
</em>
</body>
`;
exports[`recordToDom should preserve non breaking space 1`] = `
<body>
test  test
</body>
`;
exports[`recordToDom should remove padding 1`] = `
<body>

</body>
`;