-
-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #48955 from nextcloud/backport/48889/stable28
- Loading branch information
Showing
5 changed files
with
58 additions
and
13 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,40 @@ | ||
/*! | ||
* SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors | ||
* SPDX-License-Identifier: AGPL-3.0-or-later | ||
*/ | ||
import { afterEach, describe, it, expect } from '@jest/globals' | ||
import { generateAvatarSvg } from './AccountIcon' | ||
describe('AccountIcon', () => { | ||
|
||
afterEach(() => { | ||
delete document.body.dataset.themes | ||
}) | ||
|
||
it('should generate regular account avatar svg', () => { | ||
const svg = generateAvatarSvg('admin') | ||
expect(svg).toContain('/avatar/admin/32') | ||
expect(svg).not.toContain('dark') | ||
expect(svg).toContain('?guestFallback=true') | ||
}) | ||
|
||
it('should generate guest account avatar svg', () => { | ||
const svg = generateAvatarSvg('admin', true) | ||
expect(svg).toContain('/avatar/guest/admin/32') | ||
expect(svg).not.toContain('dark') | ||
expect(svg).not.toContain('?guestFallback=true') | ||
}) | ||
|
||
it('should generate dark mode account avatar svg', () => { | ||
document.body.dataset.themes = 'dark' | ||
const svg = generateAvatarSvg('admin') | ||
expect(svg).toContain('/avatar/admin/32/dark') | ||
expect(svg).toContain('?guestFallback=true') | ||
}) | ||
|
||
it('should generate dark mode guest account avatar svg', () => { | ||
document.body.dataset.themes = 'dark' | ||
const svg = generateAvatarSvg('admin', true) | ||
expect(svg).toContain('/avatar/guest/admin/32/dark') | ||
expect(svg).not.toContain('?guestFallback=true') | ||
}) | ||
}) |
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
Oops, something went wrong.