mirror of
https://git.shipoclu.com/moon/plspace.git
synced 2026-08-13 02:42:30 +00:00
refactor and fix all references to emojis
This commit is contained in:
@@ -7,6 +7,51 @@ import { account, deferred, session, status, testServices, theme } from '$test/f
|
||||
import Profile from './Profile.svelte'
|
||||
|
||||
describe('Profile', () => {
|
||||
it('renders account custom emoji in the public profile heading', async () => {
|
||||
const profileAccount = account({
|
||||
display_name: ':smugkura: Kura :disconnecting: :kura_explode:',
|
||||
emojis: [
|
||||
{
|
||||
shortcode: 'smugkura',
|
||||
url: 'https://cdn.example/smugkura.png',
|
||||
static_url: 'https://cdn.example/smugkura.png',
|
||||
visible_in_picker: true,
|
||||
},
|
||||
{
|
||||
shortcode: 'disconnecting',
|
||||
url: 'https://cdn.example/disconnecting.png',
|
||||
static_url: 'https://cdn.example/disconnecting.png',
|
||||
visible_in_picker: true,
|
||||
},
|
||||
{
|
||||
shortcode: 'kura_explode',
|
||||
url: 'https://cdn.example/kura_explode.png',
|
||||
static_url: 'https://cdn.example/kura_explode.png',
|
||||
visible_in_picker: true,
|
||||
},
|
||||
],
|
||||
})
|
||||
const services = testServices({
|
||||
session: session(),
|
||||
theme: theme(),
|
||||
endpoints: {
|
||||
lookupAccount: vi.fn().mockResolvedValue(profileAccount),
|
||||
fetchAccountStatuses: vi.fn().mockResolvedValue({ items: [], links: {} }),
|
||||
},
|
||||
})
|
||||
const view = render(Profile, {
|
||||
props: { acct: 'alice' },
|
||||
context: new Map([[APP_SERVICES, services]]),
|
||||
})
|
||||
|
||||
const headingEmoji = (await view.findAllByAltText(':smugkura:')).find((node) =>
|
||||
node.closest('h1.profile-name'),
|
||||
)
|
||||
expect(headingEmoji).toBeDefined()
|
||||
expect(view.getAllByAltText(':disconnecting:').length).toBeGreaterThan(0)
|
||||
expect(view.getAllByAltText(':kura_explode:').length).toBeGreaterThan(0)
|
||||
})
|
||||
|
||||
it('does not apply profile CSS after it has unmounted', async () => {
|
||||
const lookup = deferred<Account>()
|
||||
const applyProfileCss = vi.fn()
|
||||
|
||||
Reference in New Issue
Block a user