Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LPD-42578 Add "Clear" Action to Remove Selection #4763

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
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
Original file line number Diff line number Diff line change
Expand Up @@ -614,6 +614,7 @@ const FrontendDataSet = ({
deselectItems={(items) => deselectItems(items)}
fluid={style === 'fluid'}
items={items}
onBulkActionsClear={deselectItems(selectedItemsValue)}
selectItems={(items) => selectItems(items)}
selectedItems={selectedItems}
selectedItemsKey={selectedItemsKey}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ function ManagementBar({
deselectItems,
fluid,
items,
onBulkActionsClear,
selectItems,
selectedItems,
selectedItemsKey,
Expand Down Expand Up @@ -46,6 +47,7 @@ function ManagementBar({
fluid={fluid}
handleCheckboxClick={handleCheckboxClick}
items={items}
onClear={onBulkActionsClear}
pageSelectedItemsValue={pageSelectedItemsValue}
selectItems={selectItems}
selectedItems={selectedItems}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ function BulkActions({
fluid,
handleCheckboxClick,
items,
onClear,
pageSelectedItemsValue,
selectItems,
selectedItems,
Expand Down Expand Up @@ -270,6 +271,19 @@ function BulkActions({
)}
</span>

{Liferay.FeatureFlags['LPD-42570'] && (
<ClayLink
className="ml-3"
href="#"
onClick={(event) => {
event.preventDefault();
onClear();
}}
>
{Liferay.Language.get('clear')}
</ClayLink>
)}

<ClayLink
className="ml-3"
href="#"
Expand Down Expand Up @@ -343,6 +357,7 @@ BulkActions.propTypes = {
),
handleCheckboxClick: PropTypes.func.isRequired,
items: PropTypes.array.isRequired,
onClear: PropTypes.func.isRequired,
selectedItemsKey: PropTypes.string.isRequired,
selectedItemsValue: PropTypes.array.isRequired,
total: PropTypes.number,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -724,6 +724,16 @@ test('Check selection behavior', async ({page}) => {

await expect(page.getByText('15 of 75 Items Selected')).toBeVisible();
});

await test.step('Unselect all items using clear button', async () => {
await page.getByText('Clear').click();

await expect(itemsSelectorCheckbox).not.toBeChecked();

await expect(
page.getByText('15 of 75 Items Selected')
).not.toBeVisible();
});
});

accountSettingsTest(
Expand Down