Skip to content

Commit

Permalink
comments added
Browse files Browse the repository at this point in the history
  • Loading branch information
cypherean committed Jul 6, 2020
1 parent 4be3160 commit b487db7
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions test/ui-testing/center.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,22 @@ beforeAll(async () => {

describe('Center Text', () => {
test('Centering and decentering text', async () => {
// selects a string from textarea in md mode
await page.setViewport({ width: 1920, height: 1080 });
await page.waitForSelector('.ple-module-body');
await page.click('.woofmark-mode-markdown');
await page.focus('.ple-textarea');

// center aligns the string and checks for presence of '->' and '<-'
await page.click('.woofmark-command-autocenter');
let opening = await page.evaluate(() => document.querySelector('.ple-textarea').value.includes('->'));
let closing = await page.evaluate(() => document.querySelector('.ple-textarea').value.includes('<-'));
expect(opening).toBe(true);
expect(closing).toBe(true);

// the selection changes from '-> some text <-' to ->'some text'<-
await page.click('.woofmark-command-autocenter');
// clicking again removes the center alignment and tests for absence of '->' and '<-'
await page.click('.woofmark-command-autocenter');
opening = await page.evaluate(() => document.querySelector('.ple-textarea').value.includes('->'));
closing = await page.evaluate(() => document.querySelector('.ple-textarea').value.includes('<-'));
Expand Down

0 comments on commit b487db7

Please sign in to comment.