mirror of
https://github.com/immich-app/immich
synced 2025-11-07 17:27:20 +00:00
feat(web): improve show & hide people accessibility (#10954)
This commit is contained in:
parent
eb89208abb
commit
a0f6d7444a
4 changed files with 41 additions and 30 deletions
|
|
@ -3,6 +3,7 @@ import ManagePeopleVisibility from '$lib/components/faces-page/manage-people-vis
|
|||
import type { PersonResponseDto } from '@immich/sdk';
|
||||
import { personFactory } from '@test-data/factories/person-factory';
|
||||
import { render } from '@testing-library/svelte';
|
||||
import { tick } from 'svelte';
|
||||
|
||||
describe('ManagePeopleVisibility Component', () => {
|
||||
let personVisible: PersonResponseDto;
|
||||
|
|
@ -48,10 +49,8 @@ describe('ManagePeopleVisibility Component', () => {
|
|||
},
|
||||
});
|
||||
|
||||
const toggleButton = getByTitle('toggle_visibility');
|
||||
toggleButton.click();
|
||||
const saveButton = getByText('done');
|
||||
saveButton.click();
|
||||
getByTitle('hide_unnamed_people').click();
|
||||
getByText('done').click();
|
||||
|
||||
expect(sdkMock.updatePeople).toHaveBeenCalledWith({
|
||||
peopleUpdateDto: {
|
||||
|
|
@ -60,7 +59,7 @@ describe('ManagePeopleVisibility Component', () => {
|
|||
});
|
||||
});
|
||||
|
||||
it('hides all people on second button press', () => {
|
||||
it('hides all people on second button press', async () => {
|
||||
const { getByText, getByTitle } = render(ManagePeopleVisibility, {
|
||||
props: {
|
||||
people: [personVisible, personHidden, personWithoutName],
|
||||
|
|
@ -68,11 +67,10 @@ describe('ManagePeopleVisibility Component', () => {
|
|||
},
|
||||
});
|
||||
|
||||
const toggleButton = getByTitle('toggle_visibility');
|
||||
toggleButton.click();
|
||||
toggleButton.click();
|
||||
const saveButton = getByText('done');
|
||||
saveButton.click();
|
||||
getByTitle('hide_unnamed_people').click();
|
||||
await tick();
|
||||
getByTitle('hide_all_people').click();
|
||||
getByText('done').click();
|
||||
|
||||
expect(sdkMock.updatePeople).toHaveBeenCalledWith({
|
||||
peopleUpdateDto: {
|
||||
|
|
@ -84,7 +82,7 @@ describe('ManagePeopleVisibility Component', () => {
|
|||
});
|
||||
});
|
||||
|
||||
it('shows all people on third button press', () => {
|
||||
it('shows all people on third button press', async () => {
|
||||
const { getByText, getByTitle } = render(ManagePeopleVisibility, {
|
||||
props: {
|
||||
people: [personVisible, personHidden, personWithoutName],
|
||||
|
|
@ -92,12 +90,12 @@ describe('ManagePeopleVisibility Component', () => {
|
|||
},
|
||||
});
|
||||
|
||||
const toggleButton = getByTitle('toggle_visibility');
|
||||
toggleButton.click();
|
||||
toggleButton.click();
|
||||
toggleButton.click();
|
||||
const saveButton = getByText('done');
|
||||
saveButton.click();
|
||||
getByTitle('hide_unnamed_people').click();
|
||||
await tick();
|
||||
getByTitle('hide_all_people').click();
|
||||
await tick();
|
||||
getByTitle('show_all_people').click();
|
||||
getByText('done').click();
|
||||
|
||||
expect(sdkMock.updatePeople).toHaveBeenCalledWith({
|
||||
peopleUpdateDto: {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue