Skip to content

Commit

Permalink
refined tests to test reversal and reset changes when completed
Browse files Browse the repository at this point in the history
  • Loading branch information
cypherean committed Jul 3, 2020
1 parent dd86ec9 commit ed360bb
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 8 deletions.
16 changes: 12 additions & 4 deletions test/ui-testing/bold.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,25 @@ describe('Bold Text', () => {
const stringIsIncluded = await page.evaluate(() => document.querySelector('.wk-wysiwyg').textContent.includes('strong text'));

expect(stringIsIncluded).toBe(true);
await page.keyboard.press("Backspace");

}, timeout);

test('Adds strong text in markdown mode', async () => {
await page.waitForSelector('.woofmark-mode-markdown');
await page.click('.woofmark-mode-markdown');
await page.waitForSelector('.ple-module-body');
await page.focus('.ple-module-body');
await page.evaluate(() => document.querySelector('.ple-textarea').value += ' ');
await page.click('.woofmark-command-bold');
const stringIsIncluded = await page.evaluate(() => document.querySelector('.ple-textarea').value.includes('**strong text**'));

let stringIsIncluded = await page.evaluate(() => document.querySelector('.ple-textarea').value.includes('**strong text**'));
expect(stringIsIncluded).toBe(true);

await page.click('.woofmark-command-bold');
stringIsIncluded = await page.evaluate(() => document.querySelector('.ple-textarea').value.includes('strong text'));
expect(stringIsIncluded).toBe(true);
stringIsIncluded = await page.evaluate(() => document.querySelector('.ple-textarea').value.includes('**strong text**'));
expect(stringIsIncluded).toBe(false);

await page.keyboard.press("Backspace");

}, timeout);
});
16 changes: 12 additions & 4 deletions test/ui-testing/italic.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,25 @@ describe('Italic Text', () => {
const stringIsIncluded = await page.evaluate(() => document.querySelector('.wk-wysiwyg').textContent.includes('emphasized text'));

expect(stringIsIncluded).toBe(true);
await page.keyboard.press("Backspace");

}, timeout);

test('Adds emphasized text in markdown mode', async () => {
await page.waitForSelector('.woofmark-mode-markdown');
await page.click('.woofmark-mode-markdown');
await page.waitForSelector('.ple-module-body');
await page.focus('.ple-module-body');
await page.evaluate(() => document.querySelector('.ple-textarea').value += ' ');
await page.click('.woofmark-command-italic');
const stringIsIncluded = await page.evaluate(() => document.querySelector('.ple-textarea').value.includes('_emphasized text_'));

let stringIsIncluded = await page.evaluate(() => document.querySelector('.ple-textarea').value.includes('*emphasized text*'));
expect(stringIsIncluded).toBe(true);

await page.click('.woofmark-command-italic');
stringIsIncluded = await page.evaluate(() => document.querySelector('.ple-textarea').value.includes('emphasized text'));
expect(stringIsIncluded).toBe(true);
stringIsIncluded = await page.evaluate(() => document.querySelector('.ple-textarea').value.includes('*emphasized text*'));
expect(stringIsIncluded).toBe(false);

await page.keyboard.press("Backspace");

}, timeout);

Expand Down

0 comments on commit ed360bb

Please sign in to comment.