CSR-917 Don't allow enter key for multiselects

This commit is contained in:
Katie 2022-11-03 08:35:25 -04:00
parent 99fa571ae3
commit 341bb7a7e4
2 changed files with 6 additions and 8 deletions

View file

@ -228,7 +228,7 @@ describe("baseInputButton.vue", () => {
expect(wrapper.emitted()).not.toHaveProperty("update:modelValue");
});
test("focus and click enter on a checkbox => update:modelValue is emitted with correct value", async () => {
test("focus and click enter on a checkbox => nothing should happen", async () => {
// Arrange
const { wrapper } = setupMocks({
mockData: {
@ -243,9 +243,10 @@ describe("baseInputButton.vue", () => {
// Act
await input.trigger("keypress", { key: "enter" });
console.log(wrapper.emitted()["update:modelValue"]);
// Assert
expect(wrapper.emitted()["update:modelValue"][0][0]).toEqual(["Hi"]);
expect(wrapper.emitted()["update:modelValue"]).toBe(undefined);
});
});
@ -319,7 +320,7 @@ describe("baseInputButton.vue", () => {
expect(wrapper.vm.handlePushClickEventToGACheck).not.toHaveBeenCalled();
});
test("eventType === eventTypes.ENTER => call handleClick and handlePushClickEventToGACheck", () => {
test("eventType === eventTypes.ENTER => do nothing", () => {
// Arrange
const { wrapper } = setupMocks({
mockData: {
@ -336,11 +337,9 @@ describe("baseInputButton.vue", () => {
wrapper.vm.handleEventAction("enter", { myEvent: "test" });
// Assert
expect(wrapper.vm.handleClick).toHaveBeenCalledWith({
myEvent: "test",
});
expect(wrapper.vm.handlePushClickEventToGACheck).toHaveBeenCalledWith("click");
expect(wrapper.vm.handleClick).not.toHaveBeenCalled();
expect(wrapper.vm.handleSelectionChange).not.toHaveBeenCalled();
expect(wrapper.vm.handlePushClickEventToGACheck).not.toHaveBeenCalled();
});
test("eventType === eventTypes.CHANGE => call handleClick and handlePushClickEventToGACheck", () => {

View file

@ -53,7 +53,6 @@ export default {
handleEventAction(eventType, e) {
if (this.isMultiSelect) {
switch (eventType) {
case this.eventTypes.ENTER:
case this.eventTypes.CHANGE:
this.handleClick(e);
this.handlePushClickEventToGACheck(this.eventTypes.CLICK);