Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bold newline empty line test attempt #659

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
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
23 changes: 23 additions & 0 deletions test/ui-testing/bold.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,27 @@ describe('Bold Text', () => {
await page.keyboard.press("Backspace");
await page.click('.woofmark-mode-wysiwyg');
}, timeout);

test('does not leave empty lines with ** bold markdown tags when adding newlines from end of bold text', async () => {
// switches to wysiwyg mode if it is in markdown mode
if (await page.evaluate(() => $(".woofmark-mode-markdown").is(":disabled"))) {
await page.click('.woofmark-mode-wysiwyg');
}
await page.waitForSelector('.ple-module-body');
await page.waitForSelector('.wk-wysiwyg');

await page.type('.wk-wysiwyg', "Normal text");
await page.type('.wk-wysiwyg', String.fromCharCode(13)); // Enter (see https://stackoverflow.com/questions/46442253/pressing-enter-button-in-puppeteer)

await page.click('.woofmark-command-bold');
await page.type('.wk-wysiwyg', "Bold text");
await page.type('.wk-wysiwyg', String.fromCharCode(13));
await page.type('.wk-wysiwyg', String.fromCharCode(13));

// here we observed a bug where we get 2 empty lines with just `**` on each
await page.type('.wk-wysiwyg', "Bold again");

stringMatches = await page.evaluate(() => document.querySelector('.ple-textarea').value == "Normal text\n\n**Bold text**\n\n**Bold again**");
expect(stringMatches).toBe(true);
}, timeout);
});