diff --git a/dist/PublicLab.Editor.js b/dist/PublicLab.Editor.js index 8e1307f3..c0422640 100644 --- a/dist/PublicLab.Editor.js +++ b/dist/PublicLab.Editor.js @@ -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(); }); diff --git a/src/PublicLab.Editor.js b/src/PublicLab.Editor.js index 2df20fc3..3becf8be 100644 --- a/src/PublicLab.Editor.js +++ b/src/PublicLab.Editor.js @@ -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(); }); diff --git a/test/ui-testing/bold.test.js b/test/ui-testing/bold.test.js new file mode 100644 index 00000000..76c9b79a --- /dev/null +++ b/test/ui-testing/bold.test.js @@ -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); + +});