editor.spec.ts 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606
  1. import { expect } from '@playwright/test'
  2. import { test } from './fixtures'
  3. import { createRandomPage, enterNextBlock, modKey } from './utils'
  4. import { dispatch_kb_events } from './util/keyboard-events'
  5. import * as kb_events from './util/keyboard-events'
  6. test('hashtag and quare brackets in same line #4178', async ({ page }) => {
  7. await createRandomPage(page)
  8. await page.type('textarea >> nth=0', '#foo bar')
  9. await enterNextBlock(page)
  10. await page.type('textarea >> nth=0', 'bar [[blah]]', { delay: 100 })
  11. for (let i = 0; i < 12; i++) {
  12. await page.press('textarea >> nth=0', 'ArrowLeft')
  13. }
  14. await page.type('textarea >> nth=0', ' ')
  15. await page.press('textarea >> nth=0', 'ArrowLeft')
  16. await page.type('textarea >> nth=0', '#')
  17. await page.waitForSelector('text="Search for a page"', { state: 'visible' })
  18. await page.type('textarea >> nth=0', 'fo')
  19. await page.click('.absolute >> text=' + 'foo')
  20. expect(await page.inputValue('textarea >> nth=0')).toBe(
  21. '#foo bar [[blah]]'
  22. )
  23. })
  24. test('hashtag search page auto-complete', async ({ page, block }) => {
  25. await createRandomPage(page)
  26. await block.activeEditing(0)
  27. await page.type('textarea >> nth=0', '#', { delay: 100 })
  28. await page.waitForSelector('text="Search for a page"', { state: 'visible' })
  29. await page.keyboard.press('Escape', { delay: 50 })
  30. await block.mustFill("done")
  31. await enterNextBlock(page)
  32. await page.type('textarea >> nth=0', 'Some #', { delay: 100 })
  33. await page.waitForSelector('text="Search for a page"', { state: 'visible' })
  34. await page.keyboard.press('Escape', { delay: 50 })
  35. await block.mustFill("done")
  36. })
  37. test('disappeared children #4814', async ({ page, block }) => {
  38. await createRandomPage(page)
  39. await block.mustType('parent')
  40. await block.enterNext()
  41. expect(await block.indent()).toBe(true)
  42. for (let i = 0; i < 5; i++) {
  43. await block.mustType(i.toString())
  44. await block.enterNext()
  45. }
  46. // collapse
  47. await page.click('.block-control >> nth=0')
  48. // expand
  49. await page.click('.block-control >> nth=0')
  50. await block.waitForBlocks(7) // 1 + 5 + 1 empty
  51. // Ensures there's no active editor
  52. await expect(page.locator('.editor-inner')).toHaveCount(0, { timeout: 500 })
  53. })
  54. test('create new page from bracketing text #4971', async ({ page, block }) => {
  55. let title = 'Page not Exists yet'
  56. await createRandomPage(page)
  57. await block.mustType(`[[${title}]]`)
  58. await page.keyboard.press(modKey + '+o')
  59. // Check page title equals to `title`
  60. await page.waitForTimeout(100)
  61. expect(await page.locator('h1.title').innerText()).toContain(title)
  62. // Check there're linked references
  63. await page.waitForSelector(`.references .ls-block >> nth=1`, { state: 'detached', timeout: 100 })
  64. })
  65. test.skip('backspace and cursor position #4897', async ({ page, block }) => {
  66. await createRandomPage(page)
  67. // Delete to previous block, and check cursor position, with markup
  68. await block.mustFill('`012345`')
  69. await block.enterNext()
  70. await block.mustType('`abcdef', { toBe: '`abcdef`' }) // "`" auto-completes
  71. expect(await block.selectionStart()).toBe(7)
  72. expect(await block.selectionEnd()).toBe(7)
  73. for (let i = 0; i < 7; i++) {
  74. await page.keyboard.press('ArrowLeft')
  75. }
  76. expect(await block.selectionStart()).toBe(0)
  77. await page.keyboard.press('Backspace')
  78. await block.waitForBlocks(1) // wait for delete and re-render
  79. expect(await block.selectionStart()).toBe(8)
  80. })
  81. test.skip('next block and cursor position', async ({ page, block }) => {
  82. await createRandomPage(page)
  83. // Press Enter and check cursor position, with markup
  84. await block.mustType('abcde`12345', { toBe: 'abcde`12345`' }) // "`" auto-completes
  85. for (let i = 0; i < 7; i++) {
  86. await page.keyboard.press('ArrowLeft')
  87. }
  88. expect(await block.selectionStart()).toBe(5) // after letter 'e'
  89. await block.enterNext()
  90. expect(await block.selectionStart()).toBe(0) // should at the beginning of the next block
  91. const locator = page.locator('textarea >> nth=0')
  92. await expect(locator).toHaveText('`12345`', { timeout: 1000 })
  93. })
  94. test(
  95. "Press CJK Left Black Lenticular Bracket `【` by 2 times #3251 should trigger [[]], " +
  96. "but dont trigger RIME #3440 ",
  97. // cases should trigger [[]] #3251
  98. async ({ page, block }) => {
  99. // This test requires dev mode
  100. test.skip(process.env.RELEASE === 'true', 'not available for release version')
  101. for (let [idx, events] of [
  102. kb_events.win10_pinyin_left_full_square_bracket,
  103. kb_events.macos_pinyin_left_full_square_bracket
  104. // TODO: support #3741
  105. // kb_events.win10_legacy_pinyin_left_full_square_bracket,
  106. ].entries()) {
  107. await createRandomPage(page)
  108. let check_text = "#3251 test " + idx
  109. await block.mustFill(check_text + "【")
  110. await dispatch_kb_events(page, ':nth-match(textarea, 1)', events)
  111. expect(await page.inputValue(':nth-match(textarea, 1)')).toBe(check_text + '【')
  112. await block.mustFill(check_text + "【【")
  113. await dispatch_kb_events(page, ':nth-match(textarea, 1)', events)
  114. expect(await page.inputValue(':nth-match(textarea, 1)')).toBe(check_text + '[[]]')
  115. };
  116. // dont trigger RIME #3440
  117. for (let [idx, events] of [
  118. kb_events.macos_pinyin_selecting_candidate_double_left_square_bracket,
  119. kb_events.win10_RIME_selecting_candidate_double_left_square_bracket
  120. ].entries()) {
  121. await createRandomPage(page)
  122. let check_text = "#3440 test " + idx
  123. await block.mustFill(check_text)
  124. await dispatch_kb_events(page, ':nth-match(textarea, 1)', events)
  125. expect(await page.inputValue(':nth-match(textarea, 1)')).toBe(check_text)
  126. await dispatch_kb_events(page, ':nth-match(textarea, 1)', events)
  127. expect(await page.inputValue(':nth-match(textarea, 1)')).toBe(check_text)
  128. }
  129. })
  130. test('copy & paste block ref and replace its content', async ({ page, block }) => {
  131. await createRandomPage(page)
  132. await block.mustType('Some random text')
  133. // FIXME: https://github.com/logseq/logseq/issues/7541
  134. await page.waitForTimeout(1000)
  135. await page.keyboard.press(modKey + '+c')
  136. await page.press('textarea >> nth=0', 'Enter')
  137. await block.waitForBlocks(2)
  138. await page.keyboard.press(modKey + '+v')
  139. await page.keyboard.press('Enter')
  140. // Check if the newly created block-ref has the same referenced content
  141. await expect(page.locator('.block-ref >> text="Some random text"')).toHaveCount(1);
  142. // Move cursor into the block ref
  143. for (let i = 0; i < 4; i++) {
  144. await page.press('textarea >> nth=0', 'ArrowLeft')
  145. }
  146. await expect(page.locator('textarea >> nth=0')).not.toHaveValue('Some random text')
  147. // Trigger replace-block-reference-with-content-at-point
  148. await page.keyboard.press(modKey + '+Shift+r')
  149. await expect(page.locator('textarea >> nth=0')).toHaveValue('Some random text')
  150. await block.escapeEditing()
  151. await expect(page.locator('.block-ref >> text="Some random text"')).toHaveCount(0);
  152. await expect(page.locator('text="Some random text"')).toHaveCount(2);
  153. })
  154. test('copy and paste block after editing new block #5962', async ({ page, block }) => {
  155. await createRandomPage(page)
  156. // Create a block and copy it in block-select mode
  157. await block.mustType('Block being copied')
  158. await page.keyboard.press('Escape')
  159. await expect(page.locator('.ls-block.selected')).toHaveCount(1)
  160. await page.keyboard.press(modKey + '+c', { delay: 10 })
  161. await page.keyboard.press('Enter')
  162. await expect(page.locator('.ls-block.selected')).toHaveCount(0)
  163. await expect(page.locator('textarea >> nth=0')).toBeVisible()
  164. await page.keyboard.press('Enter')
  165. await block.waitForBlocks(2)
  166. await block.mustType('Typed block')
  167. await page.keyboard.press(modKey + '+v')
  168. await expect(page.locator('text="Typed block"')).toHaveCount(1)
  169. await block.waitForBlocks(3)
  170. })
  171. test('undo and redo after starting an action should not destroy text #6267', async ({ page, block }) => {
  172. await createRandomPage(page)
  173. // Get one piece of undo state onto the stack
  174. await block.mustType('text1 ')
  175. await page.waitForTimeout(500) // Wait for 500ms autosave period to expire
  176. // Then type more, start an action prompt, and undo
  177. await page.keyboard.type('text2 ', { delay: 50 })
  178. await page.keyboard.type('[[', { delay: 50 })
  179. await expect(page.locator(`[data-modal-name="page-search"]`)).toBeVisible()
  180. await page.keyboard.press(modKey + '+z')
  181. await page.waitForTimeout(100)
  182. // Should close the action menu when we undo the action prompt
  183. await expect(page.locator(`[data-modal-name="page-search"]`)).not.toBeVisible()
  184. // It should undo to the last saved state, and not erase the previous undo action too
  185. await expect(page.locator('text="text1"')).toHaveCount(1)
  186. // And it should keep what was undone as a redo action
  187. await page.keyboard.press(modKey + '+Shift+z')
  188. await expect(page.locator('text="text2"')).toHaveCount(1)
  189. })
  190. test('undo after starting an action should close the action menu #6269', async ({ page, block }) => {
  191. for (const [commandTrigger, modalName] of [['/', 'commands'], ['[[', 'page-search']]) {
  192. await createRandomPage(page)
  193. // Open the action modal
  194. await block.mustType('text1 ')
  195. await page.waitForTimeout(550)
  196. await page.keyboard.type(commandTrigger, { delay: 20 })
  197. await page.waitForTimeout(100) // Tolerable delay for the action menu to open
  198. await expect(page.locator(`[data-modal-name="${modalName}"]`)).toBeVisible()
  199. // Undo, removing "/today", and closing the action modal
  200. await page.keyboard.press(modKey + '+z')
  201. await page.waitForTimeout(100)
  202. await expect(page.locator('text="/today"')).toHaveCount(0)
  203. await expect(page.locator(`[data-modal-name="${modalName}"]`)).not.toBeVisible()
  204. }
  205. })
  206. test('#6266 moving cursor outside of brackets should close autocomplete menu', async ({ page, block, autocompleteMenu }) => {
  207. for (const [commandTrigger, modalName] of [['[[', 'page-search'], ['((', 'block-search']]) {
  208. // First, left arrow
  209. await createRandomPage(page)
  210. await block.mustFill('t ')
  211. await page.keyboard.type(commandTrigger, { delay: 20 })
  212. await page.waitForTimeout(100) // Sometimes it doesn't trigger without this
  213. await autocompleteMenu.expectVisible(modalName)
  214. await page.keyboard.press('ArrowLeft')
  215. await page.waitForTimeout(100)
  216. await autocompleteMenu.expectHidden(modalName)
  217. // Then, right arrow
  218. await createRandomPage(page)
  219. await block.mustFill('t ')
  220. await page.keyboard.type(commandTrigger, { delay: 20 })
  221. await autocompleteMenu.expectVisible(modalName)
  222. await page.waitForTimeout(100)
  223. // Move cursor outside of the space strictly between the double brackets
  224. await page.keyboard.press('ArrowRight')
  225. await page.waitForTimeout(100)
  226. await autocompleteMenu.expectHidden(modalName)
  227. }
  228. })
  229. // Old logic would fail this because it didn't do the check if @search-timeout was set
  230. test('#6266 moving cursor outside of parens immediately after searching should still close autocomplete menu', async ({ page, block, autocompleteMenu }) => {
  231. for (const [commandTrigger, modalName] of [['((', 'block-search']]) {
  232. await createRandomPage(page)
  233. // Open the autocomplete menu
  234. await block.mustFill('t ')
  235. await page.keyboard.type(commandTrigger, { delay: 20 })
  236. await page.waitForTimeout(100)
  237. await page.keyboard.type("some block search text")
  238. await page.waitForTimeout(100) // Sometimes it doesn't trigger without this
  239. await autocompleteMenu.expectVisible(modalName)
  240. // Move cursor outside of the space strictly between the double parens
  241. await page.keyboard.press('ArrowRight')
  242. await page.waitForTimeout(100)
  243. await autocompleteMenu.expectHidden(modalName)
  244. }
  245. })
  246. test('pressing up and down should NOT close autocomplete menu', async ({ page, block, autocompleteMenu }) => {
  247. for (const [commandTrigger, modalName] of [['[[', 'page-search'], ['((', 'block-search']]) {
  248. await createRandomPage(page)
  249. // Open the autocomplete menu
  250. await block.mustFill('t ')
  251. await page.keyboard.type(commandTrigger, { delay: 20 })
  252. await autocompleteMenu.expectVisible(modalName)
  253. const cursorPos = await block.selectionStart()
  254. await page.keyboard.press('ArrowUp')
  255. await page.waitForTimeout(100)
  256. await autocompleteMenu.expectVisible(modalName)
  257. await expect(await block.selectionStart()).toEqual(cursorPos)
  258. await page.keyboard.press('ArrowDown')
  259. await page.waitForTimeout(100)
  260. await autocompleteMenu.expectVisible(modalName)
  261. await expect(await block.selectionStart()).toEqual(cursorPos)
  262. }
  263. })
  264. test('moving cursor inside of brackets should NOT close autocomplete menu', async ({ page, block, autocompleteMenu }) => {
  265. for (const [commandTrigger, modalName] of [['[[', 'page-search'], ['((', 'block-search']]) {
  266. await createRandomPage(page)
  267. // Open the autocomplete menu
  268. await block.mustType('test ')
  269. await page.keyboard.type(commandTrigger, { delay: 20 })
  270. await page.waitForTimeout(100)
  271. if (commandTrigger === '[[') {
  272. await autocompleteMenu.expectVisible(modalName)
  273. }
  274. await page.keyboard.type("search", { delay: 20 })
  275. await autocompleteMenu.expectVisible(modalName)
  276. // Move cursor, still inside the brackets
  277. await page.keyboard.press('ArrowLeft')
  278. await page.waitForTimeout(100)
  279. await autocompleteMenu.expectVisible(modalName)
  280. }
  281. })
  282. test('moving cursor inside of brackets when autocomplete menu is closed should NOT open autocomplete menu', async ({ page, block, autocompleteMenu }) => {
  283. // Note: (( behaves differently and doesn't auto-trigger when typing in it after exiting the search prompt once
  284. for (const [commandTrigger, modalName] of [['[[', 'page-search']]) {
  285. await createRandomPage(page)
  286. // Open the autocomplete menu
  287. await block.mustFill('')
  288. await page.keyboard.type(commandTrigger, { delay: 20 })
  289. await page.waitForTimeout(100) // Sometimes it doesn't trigger without this
  290. await autocompleteMenu.expectVisible(modalName)
  291. await block.escapeEditing()
  292. await autocompleteMenu.expectHidden(modalName)
  293. // Move cursor left until it's inside the brackets; shouldn't open autocomplete menu
  294. await page.locator('.block-content').click()
  295. await page.waitForTimeout(100)
  296. await autocompleteMenu.expectHidden(modalName)
  297. await page.keyboard.press('ArrowLeft', { delay: 50 })
  298. await autocompleteMenu.expectHidden(modalName)
  299. await page.keyboard.press('ArrowLeft', { delay: 50 })
  300. await autocompleteMenu.expectHidden(modalName)
  301. // Type a letter, this should open the autocomplete menu
  302. await page.keyboard.type('z', { delay: 20 })
  303. await page.waitForTimeout(100)
  304. await autocompleteMenu.expectVisible(modalName)
  305. }
  306. })
  307. test('selecting text inside of brackets should NOT close autocomplete menu', async ({ page, block, autocompleteMenu }) => {
  308. for (const [commandTrigger, modalName] of [['[[', 'page-search'], ['((', 'block-search']]) {
  309. await createRandomPage(page)
  310. // Open the autocomplete menu
  311. await block.mustFill('')
  312. await page.keyboard.type(commandTrigger, { delay: 20 })
  313. await page.waitForTimeout(100)
  314. await autocompleteMenu.expectVisible(modalName)
  315. await page.keyboard.type("some page search text", { delay: 10 })
  316. await page.waitForTimeout(100)
  317. await autocompleteMenu.expectVisible(modalName)
  318. // Select some text within the brackets
  319. await page.keyboard.press('Shift+ArrowLeft')
  320. await page.waitForTimeout(100)
  321. await autocompleteMenu.expectVisible(modalName)
  322. }
  323. })
  324. test('pressing backspace and remaining inside of brackets should NOT close autocomplete menu', async ({ page, block, autocompleteMenu }) => {
  325. for (const [commandTrigger, modalName] of [['[[', 'page-search'], ['((', 'block-search']]) {
  326. await createRandomPage(page)
  327. // Open the autocomplete menu
  328. await block.mustFill('test ')
  329. await page.keyboard.type(commandTrigger, { delay: 20 })
  330. await page.waitForTimeout(100)
  331. await autocompleteMenu.expectVisible(modalName)
  332. await page.keyboard.type("some page search text", { delay: 10 })
  333. await page.waitForTimeout(100)
  334. await autocompleteMenu.expectVisible(modalName)
  335. // Delete one character inside the brackets
  336. await page.keyboard.press('Backspace')
  337. await page.waitForTimeout(100)
  338. await autocompleteMenu.expectVisible(modalName)
  339. }
  340. })
  341. test('press escape when autocomplete menu is open, should close autocomplete menu only #6270', async ({ page, block }) => {
  342. for (const [commandTrigger, modalName] of [['[[', 'page-search'], ['/', 'commands']]) {
  343. await createRandomPage(page)
  344. // Open the action modal
  345. await block.mustFill('text ')
  346. await page.waitForTimeout(550)
  347. await page.keyboard.type(commandTrigger, { delay: 20 })
  348. await page.waitForTimeout(100)
  349. await expect(page.locator(`[data-modal-name="${modalName}"]`)).toBeVisible()
  350. await page.waitForTimeout(100)
  351. // Press escape; should close action modal instead of exiting edit mode
  352. await page.keyboard.press('Escape')
  353. await page.waitForTimeout(100)
  354. await expect(page.locator(`[data-modal-name="${modalName}"]`)).not.toBeVisible()
  355. await page.waitForTimeout(1000)
  356. expect(await block.isEditing()).toBe(true)
  357. }
  358. })
  359. test('press escape when link/image dialog is open, should restore focus to input', async ({ page, block }) => {
  360. for (const [commandTrigger, modalName] of [['/link', 'commands']]) {
  361. await createRandomPage(page)
  362. // Open the action modal
  363. await block.mustFill('')
  364. await page.waitForTimeout(550)
  365. await page.keyboard.type(commandTrigger, { delay: 20 })
  366. await page.waitForTimeout(100)
  367. await expect(page.locator(`[data-modal-name="${modalName}"]`)).toBeVisible()
  368. await page.waitForTimeout(100)
  369. // Press enter to open the link dialog
  370. await page.keyboard.press('Enter')
  371. await expect(page.locator(`[data-modal-name="input"]`)).toBeVisible()
  372. // Press escape; should close link dialog and restore focus to the block textarea
  373. await page.keyboard.press('Escape')
  374. await page.waitForTimeout(100)
  375. await expect(page.locator(`[data-modal-name="input"]`)).not.toBeVisible()
  376. await page.waitForTimeout(1000)
  377. expect(await block.isEditing()).toBe(true)
  378. }
  379. })
  380. test('should show text after soft return when node is collapsed #5074', async ({ page, block }) => {
  381. const delay = 300
  382. await createRandomPage(page)
  383. await page.type('textarea >> nth=0', 'Before soft return', { delay: 10 })
  384. await page.keyboard.press('Shift+Enter', { delay: 10 })
  385. await page.type('textarea >> nth=0', 'After soft return', { delay: 10 })
  386. await block.enterNext()
  387. expect(await block.indent()).toBe(true)
  388. await block.mustType('Child text')
  389. // collapse
  390. await page.click('.block-control >> nth=0')
  391. await block.waitForBlocks(1)
  392. // select the block that has the soft return
  393. await page.keyboard.press('ArrowDown')
  394. await page.waitForTimeout(delay)
  395. await page.keyboard.press('Enter')
  396. await page.waitForTimeout(delay)
  397. await expect(page.locator('textarea >> nth=0')).toHaveText('Before soft return\nAfter soft return')
  398. // zoom into the block
  399. page.click('a.block-control + a')
  400. await page.waitForNavigation()
  401. await page.waitForTimeout(delay * 3)
  402. // select the block that has the soft return
  403. await page.keyboard.press('ArrowDown')
  404. await page.waitForTimeout(delay)
  405. await page.keyboard.press('Enter')
  406. await page.waitForTimeout(delay)
  407. await expect(page.locator('textarea >> nth=0')).toHaveText('Before soft return\nAfter soft return')
  408. })
  409. test('should not erase typed text when expanding block quickly after typing #3891', async ({ page, block }) => {
  410. await createRandomPage(page)
  411. await block.mustFill('initial text,')
  412. await page.waitForTimeout(500)
  413. await page.type('textarea >> nth=0', ' then expand', { delay: 10 })
  414. // A quick cmd-down must not destroy the typed text
  415. await page.keyboard.press(modKey + '+ArrowDown')
  416. await page.waitForTimeout(500)
  417. expect(await page.inputValue('textarea >> nth=0')).toBe(
  418. 'initial text, then expand'
  419. )
  420. // First undo should delete the last typed information, not undo a no-op expand action
  421. await page.keyboard.press(modKey + '+z')
  422. expect(await page.inputValue('textarea >> nth=0')).toBe(
  423. 'initial text,'
  424. )
  425. await page.keyboard.press(modKey + '+z')
  426. expect(await page.inputValue('textarea >> nth=0')).toBe(
  427. ''
  428. )
  429. })
  430. test('should keep correct undo and redo seq after indenting or outdenting the block #7615',async({page,block}) => {
  431. await createRandomPage(page)
  432. await block.mustFill("foo")
  433. await page.keyboard.press("Enter")
  434. await expect(page.locator('textarea >> nth=0')).toHaveText("")
  435. await block.indent()
  436. await block.mustFill("bar")
  437. await expect(page.locator('textarea >> nth=0')).toHaveText("bar")
  438. await page.keyboard.press(modKey + '+z')
  439. // should undo "bar" input
  440. await expect(page.locator('textarea >> nth=0')).toHaveText("")
  441. await page.keyboard.press(modKey + '+Shift+z')
  442. // should redo "bar" input
  443. await expect(page.locator('textarea >> nth=0')).toHaveText("bar")
  444. await page.keyboard.press("Shift+Tab")
  445. await page.keyboard.press("Enter")
  446. await expect(page.locator('textarea >> nth=0')).toHaveText("")
  447. // swap input seq
  448. await block.mustFill("baz")
  449. await block.indent()
  450. await page.keyboard.press(modKey + '+z')
  451. // should undo indention
  452. await expect(page.locator('textarea >> nth=0')).toHaveText("baz")
  453. await page.keyboard.press("Shift+Tab")
  454. await page.keyboard.press("Enter")
  455. await expect(page.locator('textarea >> nth=0')).toHaveText("")
  456. // #7615
  457. await page.keyboard.type("aaa")
  458. await block.indent()
  459. await page.keyboard.type(" bbb")
  460. await expect(page.locator('textarea >> nth=0')).toHaveText("aaa bbb")
  461. await page.keyboard.press(modKey + '+z')
  462. await expect(page.locator('textarea >> nth=0')).toHaveText("aaa")
  463. await page.keyboard.press(modKey + '+z')
  464. await expect(page.locator('textarea >> nth=0')).toHaveText("aaa")
  465. await page.keyboard.press(modKey + '+z')
  466. await expect(page.locator('textarea >> nth=0')).toHaveText("")
  467. await page.keyboard.press(modKey + '+Shift+z')
  468. await expect(page.locator('textarea >> nth=0')).toHaveText("aaa")
  469. await page.keyboard.press(modKey + '+Shift+z')
  470. await expect(page.locator('textarea >> nth=0')).toHaveText("aaa")
  471. await page.keyboard.press(modKey + '+Shift+z')
  472. await expect(page.locator('textarea >> nth=0')).toHaveText("aaa bbb")
  473. })