Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions config/locales/js-en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1158,6 +1158,14 @@ en:
scheduling:
is_parent: "The dates of this work package are automatically deduced from its children. Activate 'Manual scheduling' to set the dates."
is_switched_from_manual_to_automatic: "The dates of this work package may need to be recalculated after switching from manual to automatic scheduling due to relationships with other work packages."
selection:
all_selected:
one: "All %{count} work package on this page selected."
other: "All %{count} work packages on this page selected."
cleared: "Selection cleared."
selected:
one: "%{count} work package selected."
other: "%{count} work packages selected."
sharing:
show_all_users: "Show all users with whom the work package has been shared with"
title: "Share work package"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,12 @@ import { usePlatform } from 'core-common/testing/platform';
import { ElementRef, EventEmitter, Injector } from '@angular/core';
import { TestBed } from '@angular/core/testing';
import { fireEvent } from '@testing-library/dom';
import { LiveRegionElement } from '@primer/live-region-element';
import { type MockInstance } from 'vitest';
import { States } from 'core-app/core/states/states.service';
import { WorkPackageResource } from 'core-app/features/hal/resources/work-package-resource';
import { IsolatedQuerySpace } from 'core-app/features/work-packages/directives/query-space/isolated-query-space';
import { registerWorkPackageSelectAll } from 'core-app/features/work-packages/routing/wp-view-base/event-handling/wp-selection-keyboard';
import { registerWorkPackageDeselectAll, registerWorkPackageSelectAll } from 'core-app/features/work-packages/routing/wp-view-base/event-handling/wp-selection-keyboard';
import { WorkPackageViewFocusService } from 'core-app/features/work-packages/routing/wp-view-base/view-services/wp-view-focus.service';
import { WorkPackageViewSelectionGesturesService } from 'core-app/features/work-packages/routing/wp-view-base/view-services/wp-view-selection-gestures.service';
import { WorkPackageViewSelectionService } from 'core-app/features/work-packages/routing/wp-view-base/view-services/wp-view-selection.service';
Expand Down Expand Up @@ -122,6 +124,40 @@ describe('CardClickHandler', () => {
expect(itemClicked.map((event) => event.workPackageId)).toEqual(['A', 'C', 'E', 'C']);
});

describe('with a live region on the page', () => {
let announce:MockInstance<typeof LiveRegionElement.prototype.announce>;
let unregisterDeselectAll:() => void;

beforeEach(() => {
document.body.append(document.createElement('live-region'));
announce = vi.spyOn(LiveRegionElement.prototype, 'announce');
unregisterDeselectAll = registerWorkPackageDeselectAll({
root,
hasState: () => selection.hasSelectionState,
clear: () => selection.reset(),
});
});

afterEach(() => {
unregisterDeselectAll();
announce.mockRestore();
document.querySelector('live-region')?.remove();
});

it('never announces selection changes', () => {
click('A');
click('C', { ctrlKey: true });
click('E', { shiftKey: true });
fireEvent.keyDown(cardSurface('E'), { key: 'a', ctrlKey: true });
expect(selected()).toEqual(['A', 'B', 'C', 'D', 'E']);

fireEvent.keyDown(cardSurface('A'), { key: 'Escape' });

expect(selected()).toEqual([]);
expect(announce).not.toHaveBeenCalled();
});
});

it('keeps the final member deselected after its focus update', () => {
click('C');
click('C', { ctrlKey: true });
Expand Down
Loading
Loading