mirror of
https://github.com/hcengineering/platform.git
synced 2026-08-17 18:05:42 +02:00
Generalized implementation of the text editor toolbar (#9147)
Signed-off-by: Victor Ilyushchenko <alt13ri@gmail.com>
This commit is contained in:
@@ -312,11 +312,12 @@ test.describe('Content in the Documents tests', () => {
|
||||
})
|
||||
|
||||
test('Checking styles in a Document', async ({ page, browser, request }) => {
|
||||
const content: string = [...new Array(20).keys()].map((index) => `Line ${index + 1}`).join('\n')
|
||||
const content: string = [...new Array(21).keys()].map((index) => `Line ${index}`).join('\n')
|
||||
const testLink: string = 'http://test/link/123456'
|
||||
const testNote: string = 'Test Note'
|
||||
|
||||
await documentContentPage.addContentToTheNewLine(content, false)
|
||||
await documentContentPage.applyToolbarCommand('Line 0', 'btnH1')
|
||||
await documentContentPage.applyToolbarCommand('Line 1', 'btnH1')
|
||||
await documentContentPage.applyToolbarCommand('Line 2', 'btnH2')
|
||||
await documentContentPage.applyToolbarCommand('Line 3', 'btnH3')
|
||||
|
||||
@@ -229,14 +229,18 @@ export class DocumentContentPage extends CommonPage {
|
||||
await this.buttonOnToolbar(id).click()
|
||||
}
|
||||
|
||||
async selectLine (text: string): Promise<void> {
|
||||
async selectLine (text: string, shallow: boolean = true): Promise<void> {
|
||||
const loc: Locator = this.page.locator('p', { hasText: text }).first()
|
||||
await expect(loc).toBeVisible()
|
||||
await loc.click({ clickCount: 3 })
|
||||
if (shallow) {
|
||||
await loc.click({ clickCount: 3 })
|
||||
} else {
|
||||
await loc.selectText()
|
||||
}
|
||||
}
|
||||
|
||||
async applyToolbarCommand (text: string, btnId: string): Promise<void> {
|
||||
await this.selectLine(text)
|
||||
await this.selectLine(text, false)
|
||||
await this.clickButtonOnTooltip(btnId)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user