Skip to content
Closed
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion dist/PublicLab.Editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -20479,7 +20479,7 @@ PL.MapModule = require('./modules/PublicLab.MapModule.js');

$(document).ready(function() {
PL.Util.preventModalScrollToTop();
PL.Util.enableRichTextModeKeyboardShortcut();
PL.Util.enableTextModeKeyboardShortcut();
PL.Util.preventUploadedImagesDragging();
});

Expand Down
2 changes: 1 addition & 1 deletion src/PublicLab.Editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ PL.MapModule = require('./modules/PublicLab.MapModule.js');

$(document).ready(function() {
PL.Util.preventModalScrollToTop();
PL.Util.enableRichTextModeKeyboardShortcut();
PL.Util.enableTextModeKeyboardShortcut();
PL.Util.preventUploadedImagesDragging();
});

Expand Down
38 changes: 38 additions & 0 deletions test/ui-testing/bold.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
const timeout = process.env.SLOWMO ? 60000 : 10000;
const fs = require('fs');
beforeAll(async () => {
path = fs.realpathSync('file://../examples/index.html');
await page.goto('file://' + path, {waitUntil: 'domcontentloaded'});
});

describe('Bold Text', () => {
test('Adds strong text in rich text mode', async () => {
await page.waitForSelector('.ple-module-body');
await page.click('.woofmark-command-bold');
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.evaluate(() => document.querySelector('.ple-textarea').value += ' ');
await page.click('.woofmark-command-bold');
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");
await page.click('.woofmark-mode-wysiwyg');

}, timeout);

});