forked from logseq/logseq
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
22dc065
commit 8798ffe
Showing
2 changed files
with
79 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
import { expect } from '@playwright/test' | ||
import { test } from './fixtures' | ||
import { IsMac, createRandomPage, newBlock, lastBlock } from './utils' | ||
|
||
|
||
test('page alias', async ({ page }) => { | ||
let hotkeyOpenLink = 'Control+o' | ||
let hotkeyBack = 'Control+[' | ||
if (IsMac) { | ||
hotkeyOpenLink = 'Meta+o' | ||
hotkeyBack = 'Meta+[' | ||
} | ||
|
||
// shortcut opening test | ||
await createRandomPage(page) | ||
|
||
await page.fill(':nth-match(textarea, 1)', '[[page alias test target page]]') | ||
await page.keyboard.press(hotkeyOpenLink) | ||
|
||
// build target Page with alias | ||
await page.type(':nth-match(textarea, 1)', 'alias:: [[page alias test alias page]]') | ||
await page.press(':nth-match(textarea, 1)', 'Enter') // double Enter for exit property editing | ||
await page.press(':nth-match(textarea, 1)', 'Enter') | ||
await page.type(':nth-match(textarea, 1)', 'page alias test content') | ||
await page.keyboard.press(hotkeyBack) | ||
|
||
// create alias ref in origin Page | ||
await newBlock(page) | ||
await page.type(':nth-match(textarea, 1)', '[[page alias test alias page]]') | ||
await page.keyboard.press(hotkeyOpenLink) | ||
|
||
// shortcut opening test | ||
await lastBlock(page, true) | ||
expect(await page.inputValue(':nth-match(textarea, 1)')).toBe('page alias test content') | ||
await newBlock(page, true) | ||
await page.type(':nth-match(textarea, 1)', 'yet another page alias test content') | ||
await page.keyboard.press(hotkeyBack) | ||
|
||
// pressing enter opening test | ||
await lastBlock(page, true) | ||
await page.press(':nth-match(textarea, 1)', 'ArrowLeft') | ||
await page.press(':nth-match(textarea, 1)', 'ArrowLeft') | ||
await page.press(':nth-match(textarea, 1)', 'ArrowLeft') | ||
await page.press(':nth-match(textarea, 1)', 'Enter') | ||
await lastBlock(page, true) | ||
expect(await page.inputValue(':nth-match(textarea, 1)')).toBe('yet another page alias test content') | ||
await newBlock(page, true) | ||
await page.type(':nth-match(textarea, 1)', 'still another page alias test content') | ||
await page.keyboard.press(hotkeyBack) | ||
|
||
// clicking opening test | ||
await page.click('.page-blocks-inner .ls-block .page-ref >> nth=-1') | ||
await lastBlock(page, true) | ||
expect(await page.inputValue(':nth-match(textarea, 1)')).toBe('still another page alias test content') | ||
|
||
// TODO: test alias from graph clicking | ||
// TODO: test alias from search clicking | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters