feat(workspaces): add Korean flag shortcode (#11845)
This commit is contained in:
parent
3c05e03c6f
commit
e79304ccca
|
|
@ -7,10 +7,16 @@ import {
|
|||
} from './workspace-emoji-shortcodes'
|
||||
|
||||
describe('workspace emoji shortcodes', () => {
|
||||
it('finds standard emoji by Slack-style shortcode', () => {
|
||||
it('finds standard emoji by shortcode', () => {
|
||||
expect(searchWorkspaceEmojiShortcodes('wink', 1)).toEqual([{ emoji: '😉', shortcode: 'wink' }])
|
||||
})
|
||||
|
||||
it('finds the Korean flag by workspace shortcode', () => {
|
||||
expect(searchWorkspaceEmojiShortcodes('flag_kr', 1)).toEqual([
|
||||
{ emoji: '🇰🇷', shortcode: 'flag_kr' }
|
||||
])
|
||||
})
|
||||
|
||||
it('ranks an exact shortcode before longer aliases', () => {
|
||||
expect(searchWorkspaceEmojiShortcodes('heart', 3)[0]).toMatchObject({
|
||||
shortcode: 'heart'
|
||||
|
|
@ -39,6 +45,13 @@ describe('workspace emoji shortcodes', () => {
|
|||
})
|
||||
})
|
||||
|
||||
it('replaces the completed Korean flag shortcode', () => {
|
||||
expect(replaceCompletedWorkspaceEmojiShortcode(':flag_kr:', 9)).toEqual({
|
||||
value: '🇰🇷',
|
||||
cursor: 4
|
||||
})
|
||||
})
|
||||
|
||||
it('leaves unknown completed shortcodes unchanged', () => {
|
||||
expect(replaceCompletedWorkspaceEmojiShortcode(':orca_custom:', 13)).toBeNull()
|
||||
})
|
||||
|
|
|
|||
|
|
@ -16,7 +16,14 @@ export type WorkspaceEmojiReplacement = {
|
|||
value: string
|
||||
}
|
||||
|
||||
const SHORTCODE_ENTRIES = STANDARD_EMOJI_SHORTCODE_ENTRIES
|
||||
const WORKSPACE_EMOJI_SHORTCODE_ADDITIONS: readonly WorkspaceEmojiSuggestion[] = [
|
||||
{ emoji: '🇰🇷', shortcode: 'flag_kr' }
|
||||
]
|
||||
|
||||
const SHORTCODE_ENTRIES = [
|
||||
...STANDARD_EMOJI_SHORTCODE_ENTRIES,
|
||||
...WORKSPACE_EMOJI_SHORTCODE_ADDITIONS
|
||||
]
|
||||
|
||||
const EXACT_SHORTCODE = new Map(
|
||||
SHORTCODE_ENTRIES.map(({ emoji, shortcode }) => [shortcode, { emoji, shortcode }])
|
||||
|
|
|
|||
|
|
@ -190,7 +190,7 @@ test.describe('Create Workspace', () => {
|
|||
}
|
||||
})
|
||||
|
||||
test('enters emoji with Slack-style shortcode suggestions', async ({ orcaPage }) => {
|
||||
test('enters the Korean flag with a workspace shortcode suggestion', async ({ orcaPage }) => {
|
||||
try {
|
||||
await orcaPage.getByRole('button', { name: 'New workspace', exact: true }).click()
|
||||
|
||||
|
|
@ -198,11 +198,11 @@ test.describe('Create Workspace', () => {
|
|||
const nameInput = dialog.getByPlaceholder(/Type a name/i)
|
||||
await expect(nameInput).toBeVisible()
|
||||
|
||||
await nameInput.pressSequentially('Launch :wink', { delay: 100 })
|
||||
await nameInput.pressSequentially('Launch :flag_kr', { delay: 100 })
|
||||
const emojiSuggestions = orcaPage.locator('[data-workspace-emoji-suggestions="true"]')
|
||||
const sourceSuggestions = orcaPage.locator('[data-workspace-source-suggestions="true"]')
|
||||
await expect(emojiSuggestions).toBeVisible()
|
||||
await expect(emojiSuggestions.getByRole('option', { name: ':wink:' })).toBeVisible()
|
||||
await expect(emojiSuggestions.getByRole('option', { name: ':flag_kr:' })).toBeVisible()
|
||||
await expect(emojiSuggestions).toHaveAttribute('data-side', 'top')
|
||||
await expect(sourceSuggestions).toBeVisible()
|
||||
await expect(sourceSuggestions).toHaveAttribute('data-side', 'bottom')
|
||||
|
|
@ -210,10 +210,10 @@ test.describe('Create Workspace', () => {
|
|||
await orcaPage.waitForTimeout(750)
|
||||
|
||||
await nameInput.pressSequentially(':')
|
||||
await expect(nameInput).toHaveValue('Launch 😉')
|
||||
await expect(orcaPage.getByRole('option', { name: /:wink:/i })).toHaveCount(0)
|
||||
await expect(nameInput).toHaveValue('Launch 🇰🇷')
|
||||
await expect(orcaPage.getByRole('option', { name: /:flag_kr:/i })).toHaveCount(0)
|
||||
await nameInput.pressSequentially(' experiment')
|
||||
await expect(nameInput).toHaveValue('Launch 😉 experiment')
|
||||
await expect(nameInput).toHaveValue('Launch 🇰🇷 experiment')
|
||||
// Keep the asserted result visible in retained proof recordings.
|
||||
await orcaPage.waitForTimeout(750)
|
||||
} finally {
|
||||
|
|
|
|||
Loading…
Reference in New Issue