CSR-917 Don't allow enter key for multiselects
This commit is contained in:
parent
99fa571ae3
commit
341bb7a7e4
2 changed files with 6 additions and 8 deletions
|
|
@ -228,7 +228,7 @@ describe("baseInputButton.vue", () => {
|
||||||
expect(wrapper.emitted()).not.toHaveProperty("update:modelValue");
|
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
|
// Arrange
|
||||||
const { wrapper } = setupMocks({
|
const { wrapper } = setupMocks({
|
||||||
mockData: {
|
mockData: {
|
||||||
|
|
@ -243,9 +243,10 @@ describe("baseInputButton.vue", () => {
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
await input.trigger("keypress", { key: "enter" });
|
await input.trigger("keypress", { key: "enter" });
|
||||||
|
console.log(wrapper.emitted()["update:modelValue"]);
|
||||||
|
|
||||||
// Assert
|
// 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();
|
expect(wrapper.vm.handlePushClickEventToGACheck).not.toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
|
|
||||||
test("eventType === eventTypes.ENTER => call handleClick and handlePushClickEventToGACheck", () => {
|
test("eventType === eventTypes.ENTER => do nothing", () => {
|
||||||
// Arrange
|
// Arrange
|
||||||
const { wrapper } = setupMocks({
|
const { wrapper } = setupMocks({
|
||||||
mockData: {
|
mockData: {
|
||||||
|
|
@ -336,11 +337,9 @@ describe("baseInputButton.vue", () => {
|
||||||
wrapper.vm.handleEventAction("enter", { myEvent: "test" });
|
wrapper.vm.handleEventAction("enter", { myEvent: "test" });
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
expect(wrapper.vm.handleClick).toHaveBeenCalledWith({
|
expect(wrapper.vm.handleClick).not.toHaveBeenCalled();
|
||||||
myEvent: "test",
|
|
||||||
});
|
|
||||||
expect(wrapper.vm.handlePushClickEventToGACheck).toHaveBeenCalledWith("click");
|
|
||||||
expect(wrapper.vm.handleSelectionChange).not.toHaveBeenCalled();
|
expect(wrapper.vm.handleSelectionChange).not.toHaveBeenCalled();
|
||||||
|
expect(wrapper.vm.handlePushClickEventToGACheck).not.toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
|
|
||||||
test("eventType === eventTypes.CHANGE => call handleClick and handlePushClickEventToGACheck", () => {
|
test("eventType === eventTypes.CHANGE => call handleClick and handlePushClickEventToGACheck", () => {
|
||||||
|
|
|
||||||
|
|
@ -53,7 +53,6 @@ export default {
|
||||||
handleEventAction(eventType, e) {
|
handleEventAction(eventType, e) {
|
||||||
if (this.isMultiSelect) {
|
if (this.isMultiSelect) {
|
||||||
switch (eventType) {
|
switch (eventType) {
|
||||||
case this.eventTypes.ENTER:
|
|
||||||
case this.eventTypes.CHANGE:
|
case this.eventTypes.CHANGE:
|
||||||
this.handleClick(e);
|
this.handleClick(e);
|
||||||
this.handlePushClickEventToGACheck(this.eventTypes.CLICK);
|
this.handlePushClickEventToGACheck(this.eventTypes.CLICK);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue