2023-02-08 14:47:57 +00:00
|
|
|
import { expect } from '@playwright/test'
|
|
|
|
import { test } from './fixtures'
|
|
|
|
import { createRandomPage, editFirstBlock, newInnerBlock } from './utils'
|
|
|
|
|
2023-04-10 08:13:41 +00:00
|
|
|
test('set heading to 1', async ({ page }) => {
|
2023-02-08 14:47:57 +00:00
|
|
|
await createRandomPage(page)
|
|
|
|
|
|
|
|
await page.type('textarea >> nth=0', 'foo')
|
|
|
|
|
|
|
|
await page.keyboard.press('Escape', { delay: 50 })
|
|
|
|
|
|
|
|
await page.locator('span.bullet-container >> nth=0').click({button: "right"})
|
|
|
|
|
|
|
|
await page.locator('#custom-context-menu .to-heading-button[title="Heading 1"]').click()
|
|
|
|
|
|
|
|
await editFirstBlock(page)
|
|
|
|
await page.waitForTimeout(500)
|
|
|
|
|
|
|
|
expect(await page.inputValue('textarea >> nth=0')).toBe('# foo')
|
|
|
|
|
|
|
|
await page.keyboard.press('Escape', { delay: 50 })
|
|
|
|
|
|
|
|
expect(await page.locator('.ls-block .block-content >> nth=0').innerHTML()).toContain('<h1>foo</h1>')
|
|
|
|
})
|
|
|
|
|
|
|
|
test('remove heading', async ({ page }) => {
|
|
|
|
await page.locator('span.bullet-container >> nth=0').click({button: "right"})
|
|
|
|
|
|
|
|
await page.locator('#custom-context-menu .to-heading-button[title="Remove heading"]').click()
|
|
|
|
|
|
|
|
expect(await page.locator('.ls-block .block-content >> nth=0').innerHTML()).toContain('foo')
|
|
|
|
})
|
|
|
|
|
|
|
|
test('set heading to 2', async ({ page }) => {
|
|
|
|
await page.locator('span.bullet-container >> nth=0').click({button: "right"})
|
2023-12-19 07:20:55 +00:00
|
|
|
await page.locator('#custom-context-menu .to-heading-button[title="Heading 2"]').click({ delay: 400})
|
2023-02-08 14:47:57 +00:00
|
|
|
|
|
|
|
expect(await page.locator('.ls-block .block-content >> nth=0').innerHTML()).toContain('<h2>foo</h2>')
|
|
|
|
})
|
|
|
|
|
|
|
|
test('switch to auto heading', async ({ page }) => {
|
|
|
|
await page.locator('span.bullet-container >> nth=0').click({button: "right"})
|
|
|
|
|
|
|
|
await page.locator('#custom-context-menu .to-heading-button[title="Auto heading"]').click()
|
|
|
|
|
|
|
|
await editFirstBlock(page)
|
|
|
|
await page.waitForTimeout(500)
|
|
|
|
|
|
|
|
expect(await page.inputValue('textarea >> nth=0')).toBe('foo')
|
|
|
|
|
|
|
|
await page.keyboard.press('Escape', { delay: 50 })
|
|
|
|
|
2023-06-28 20:01:58 +00:00
|
|
|
expect(await page.locator('.ls-block .block-content >> nth=0').innerHTML()).toContain('<h1>foo</h1>')
|
2023-02-08 14:47:57 +00:00
|
|
|
})
|
|
|
|
|
|
|
|
test('set heading of nested block to auto', async ({ page }) => {
|
|
|
|
await newInnerBlock(page)
|
|
|
|
await page.waitForTimeout(500)
|
|
|
|
|
|
|
|
await page.type('textarea >> nth=0', 'bar')
|
|
|
|
|
2024-01-15 11:45:29 +00:00
|
|
|
await page.keyboard.press("Tab", { delay: 100 })
|
2023-02-08 14:47:57 +00:00
|
|
|
|
2024-01-15 11:45:29 +00:00
|
|
|
await page.keyboard.press('Escape', { delay: 100 })
|
2023-02-08 14:47:57 +00:00
|
|
|
|
|
|
|
await page.locator('span.bullet-container >> nth=1').click({button: "right"})
|
|
|
|
|
|
|
|
await page.locator('#custom-context-menu .to-heading-button[title="Auto heading"]').click()
|
|
|
|
|
2024-01-15 11:45:29 +00:00
|
|
|
await page.waitForTimeout(100)
|
2023-10-16 13:17:59 +00:00
|
|
|
|
|
|
|
expect(await page.locator('.ls-block .block-content >> nth=1').innerHTML()).toContain('<h2>bar</h2>')
|
2023-02-08 14:47:57 +00:00
|
|
|
})
|
|
|
|
|
|
|
|
test('view nested block on a dedicated page', async ({ page }) => {
|
|
|
|
await page.locator('span.bullet-container >> nth=1').click()
|
2023-03-01 17:25:45 +00:00
|
|
|
await page.waitForTimeout(200)
|
2023-02-08 14:47:57 +00:00
|
|
|
|
|
|
|
expect(await page.locator('.ls-block .block-content >> nth=0').innerHTML()).toContain('<h1>bar</h1>')
|
|
|
|
})
|