-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
BC 8586 - Make Visible Action Menu on Mobile View (#3487)
BC-8586 - implement sticky action menu on mobile view
- Loading branch information
1 parent
e02c986
commit 398ac8b
Showing
9 changed files
with
241 additions
and
112 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
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
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
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,50 @@ | ||
import { | ||
createTestingI18n, | ||
createTestingVuetify, | ||
} from "@@/tests/test-utils/setup"; | ||
import ActionMenu from "./ActionMenu.vue"; | ||
|
||
describe("ActionMenu", () => { | ||
const setup = (selectedIds: string[] = ["test-id#1", "test-id#2"]) => { | ||
const wrapper = mount(ActionMenu, { | ||
global: { | ||
plugins: [createTestingVuetify(), createTestingI18n()], | ||
}, | ||
props: { | ||
selectedIds, | ||
}, | ||
}); | ||
|
||
return { wrapper }; | ||
}; | ||
|
||
it("should be rendered", () => { | ||
const { wrapper } = setup(); | ||
expect(wrapper).toBeDefined(); | ||
}); | ||
|
||
it("should show selected count", async () => { | ||
const { wrapper } = setup(); | ||
const selectedCount = wrapper.find(".selected-count"); | ||
expect(selectedCount.html()).toContain("2 pages.administration.selected"); | ||
}); | ||
|
||
it("should emit 'remove:selected' event when 'Remove' button is clicked", async () => { | ||
const { wrapper } = setup(); | ||
await wrapper | ||
.findComponent({ ref: "removeSelectedMembers" }) | ||
.trigger("click"); | ||
const emitted = wrapper.emitted("remove:selected"); | ||
expect(wrapper.emitted()).toHaveProperty("remove:selected"); | ||
expect(emitted![0][0]).toStrictEqual(["test-id#1", "test-id#2"]); | ||
}); | ||
|
||
it("should emit 'reset:selected' event when 'Reset' button is clicked", async () => { | ||
const { wrapper } = setup(); | ||
await wrapper | ||
.findComponent({ ref: "resetSelectedMembers" }) | ||
.trigger("click"); | ||
|
||
expect(wrapper.emitted()).toHaveProperty("reset:selected"); | ||
}); | ||
}); |
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,52 @@ | ||
<template> | ||
<div class="mr-2 pa-0 pl-4" data-testid="multi-action-menu"> | ||
<span class="d-inline-flex selected-count"> | ||
{{ selectedIds.length }} | ||
{{ t("pages.administration.selected") }} | ||
</span> | ||
<v-btn | ||
ref="removeSelectedMembers" | ||
class="ml-2" | ||
size="x-small" | ||
variant="text" | ||
:icon="mdiTrashCanOutline" | ||
:aria-label="t('pages.rooms.members.multipleRemove.ariaLabel')" | ||
@click="onRemove" | ||
/> | ||
|
||
<v-btn | ||
ref="resetSelectedMembers" | ||
class="ml-2 mr-2" | ||
size="x-small" | ||
variant="text" | ||
:icon="mdiClose" | ||
:aria-label="t('pages.rooms.members.remove.ariaLabel')" | ||
@click="onReset" | ||
/> | ||
</div> | ||
</template> | ||
|
||
<script setup lang="ts"> | ||
import { mdiClose, mdiTrashCanOutline } from "@icons/material"; | ||
import { useI18n } from "vue-i18n"; | ||
const props = defineProps({ | ||
selectedIds: { | ||
type: Array<string>, | ||
required: true, | ||
}, | ||
}); | ||
const { t } = useI18n(); | ||
const emit = defineEmits<{ | ||
(e: "remove:selected", selectedIds: string[]): void; | ||
(e: "reset:selected"): void; | ||
}>(); | ||
const onRemove = () => { | ||
emit("remove:selected", props.selectedIds); | ||
}; | ||
const onReset = () => { | ||
emit("reset:selected"); | ||
}; | ||
</script> |
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.