ep_file_menu_toolbar 0.2.46 → 0.2.47
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import {expect, test} from '@playwright/test';
|
|
2
|
+
import {clearPadContent, getPadBody, goToNewPad, writeToPad}
|
|
3
|
+
from 'ep_etherpad-lite/tests/frontend-new/helper/padHelper';
|
|
4
|
+
|
|
5
|
+
test.beforeEach(async ({page}) => {
|
|
6
|
+
await goToNewPad(page);
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
test.describe('ep_file_menu_toolbar', () => {
|
|
10
|
+
test('Uses file menu to toggle bold', async ({page}) => {
|
|
11
|
+
const padBody = await getPadBody(page);
|
|
12
|
+
await padBody.click();
|
|
13
|
+
await clearPadContent(page);
|
|
14
|
+
await writeToPad(page, 'hello world');
|
|
15
|
+
|
|
16
|
+
// Select all the text in the pad.
|
|
17
|
+
await page.keyboard.press('ControlOrMeta+A');
|
|
18
|
+
|
|
19
|
+
const boldEntry = page.locator('.dropdown-menu #bold > a');
|
|
20
|
+
await boldEntry.click();
|
|
21
|
+
await expect(padBody.locator('div').first().locator('b')).toHaveCount(1);
|
|
22
|
+
await expect(padBody.locator('div').first()).toHaveText('hello world');
|
|
23
|
+
|
|
24
|
+
// Re-select and click again to disable.
|
|
25
|
+
await page.keyboard.press('ControlOrMeta+A');
|
|
26
|
+
await boldEntry.click();
|
|
27
|
+
await expect(padBody.locator('div').first().locator('b')).toHaveCount(0);
|
|
28
|
+
await expect(padBody.locator('div').first()).toHaveText('hello world');
|
|
29
|
+
});
|
|
30
|
+
});
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
describe('File Menu Toolbar', function () {
|
|
4
|
-
// create a new pad before each test run
|
|
5
|
-
beforeEach(function (cb) {
|
|
6
|
-
helper.newPad(cb);
|
|
7
|
-
this.timeout(60000);
|
|
8
|
-
});
|
|
9
|
-
|
|
10
|
-
// Create Pad
|
|
11
|
-
// Check Highlighting text and setting it to bold works
|
|
12
|
-
// Check Highlighting text and setting it to un-bold works
|
|
13
|
-
|
|
14
|
-
it('Uses file menu to enable boldness', function (done) {
|
|
15
|
-
const inner$ = helper.padInner$;
|
|
16
|
-
const chrome$ = helper.padChrome$;
|
|
17
|
-
|
|
18
|
-
// get the first text element out of the inner iframe
|
|
19
|
-
const $firstTextElement = inner$('div').first();
|
|
20
|
-
|
|
21
|
-
// select this text element
|
|
22
|
-
$firstTextElement.sendkeys('{selectall}');
|
|
23
|
-
|
|
24
|
-
// get the bold button and click it
|
|
25
|
-
const $boldButton = chrome$('.dropdown-menu #bold > a');
|
|
26
|
-
$boldButton.click();
|
|
27
|
-
|
|
28
|
-
// ace creates a new dom element when you press a button
|
|
29
|
-
// so just get the first text element again
|
|
30
|
-
const $newFirstTextElement = inner$('div').first();
|
|
31
|
-
|
|
32
|
-
// is there a <b> element now?
|
|
33
|
-
const isBold = $newFirstTextElement.find('b').length === 1;
|
|
34
|
-
|
|
35
|
-
// expect it to be bold
|
|
36
|
-
expect(isBold).to.be(true);
|
|
37
|
-
|
|
38
|
-
// make sure the text hasn't changed
|
|
39
|
-
expect($newFirstTextElement.text()).to.eql($firstTextElement.text());
|
|
40
|
-
|
|
41
|
-
done();
|
|
42
|
-
});
|
|
43
|
-
|
|
44
|
-
it('Uses file menu to disable boldness', function (done) {
|
|
45
|
-
const inner$ = helper.padInner$;
|
|
46
|
-
const chrome$ = helper.padChrome$;
|
|
47
|
-
|
|
48
|
-
// get the first text element out of the inner iframe
|
|
49
|
-
const $firstTextElement = inner$('div').first();
|
|
50
|
-
|
|
51
|
-
// select this text element
|
|
52
|
-
$firstTextElement.sendkeys('{selectall}');
|
|
53
|
-
|
|
54
|
-
// get the bold button and click it
|
|
55
|
-
const $boldButton = chrome$('.dropdown-menu #bold > a');
|
|
56
|
-
$boldButton.click();
|
|
57
|
-
|
|
58
|
-
// click it again to disable boldness
|
|
59
|
-
$boldButton.click();
|
|
60
|
-
|
|
61
|
-
const $newFirstTextElement = inner$('div').first();
|
|
62
|
-
|
|
63
|
-
// is there a <b> element now?
|
|
64
|
-
const isBold = $newFirstTextElement.find('b').length === 1;
|
|
65
|
-
|
|
66
|
-
// expect it to be bold
|
|
67
|
-
expect(isBold).to.be(false);
|
|
68
|
-
|
|
69
|
-
// make sure the text hasn't changed
|
|
70
|
-
expect($newFirstTextElement.text()).to.eql($firstTextElement.text());
|
|
71
|
-
|
|
72
|
-
done();
|
|
73
|
-
});
|
|
74
|
-
});
|