Reimplement as a tokenizer with GFM parity
This commit is contained in:
@@ -433,6 +433,55 @@ async function runTests() {
|
||||
assert(html.includes('<h2'), `Missing h2: ${html}`);
|
||||
assert(html.includes('<li') || html.includes('<ul'), `Missing list: ${html}`);
|
||||
});
|
||||
|
||||
console.log(' Strikethrough:');
|
||||
|
||||
await test('~~text~~ transforms to <del>', async () => {
|
||||
await resetEditor();
|
||||
await typeString('~~gone~~');
|
||||
const html = await getHTML();
|
||||
assert(html.includes('<del'), `No <del>: ${html}`);
|
||||
assert(!html.includes('data-speculative'), `Still speculative: ${html}`);
|
||||
assert(html.includes('gone'), `Missing content: ${html}`);
|
||||
});
|
||||
|
||||
await test('~~text shows speculative strikethrough', async () => {
|
||||
await resetEditor();
|
||||
await typeString('~~hel');
|
||||
const html = await getHTML();
|
||||
assert(html.includes('data-speculative'), `No speculative: ${html}`);
|
||||
assert(html.includes('<del'), `No <del>: ${html}`);
|
||||
});
|
||||
|
||||
console.log(' Alternate syntax:');
|
||||
|
||||
await test('~~~ transforms to fenced code', async () => {
|
||||
await resetEditor();
|
||||
await typeString('~~~');
|
||||
await driver.sleep(50);
|
||||
const html = await getHTML();
|
||||
assert(html.includes('<pre') || html.includes('<code'), `No code block: ${html}`);
|
||||
});
|
||||
|
||||
await test('+ space transforms to unordered list', async () => {
|
||||
await resetEditor();
|
||||
await typeChar('+');
|
||||
let html = await getHTML();
|
||||
assert(!html.includes('<ul'), `Premature ul: ${html}`);
|
||||
|
||||
await typeChar(' ');
|
||||
html = await getHTML();
|
||||
assert(html.includes('<ul') || html.includes('<li'), `No list after "+ ": ${html}`);
|
||||
});
|
||||
|
||||
console.log(' Backslash escapes:');
|
||||
|
||||
await test('backslash is just a character in WYSIWYG', async () => {
|
||||
await resetEditor();
|
||||
await typeString('hello\\world');
|
||||
const html = await getHTML();
|
||||
assert(html.includes('hello') && html.includes('world'), `Missing content: ${html}`);
|
||||
});
|
||||
}
|
||||
|
||||
(async () => {
|
||||
|
||||
Reference in New Issue
Block a user