2
0
mirror of https://github.com/tenrok/vue-select.git synced 2026-06-07 07:12:23 +03:00

test: move backspace test (#1109)

This commit is contained in:
Jeff Sagal
2020-03-15 19:31:45 -07:00
committed by GitHub
parent 60947c2925
commit ca4f3c4017
2 changed files with 12 additions and 11 deletions
+12 -1
View File
@@ -1,4 +1,4 @@
import { selectWithProps } from "../helpers";
import { mountDefault, selectWithProps } from '../helpers';
describe("Removing values", () => {
it("can remove the given tag when its close icon is clicked", async () => {
@@ -48,6 +48,17 @@ describe("Removing values", () => {
expect(Select.vm.selectedValue).toEqual([]);
});
it('will not emit input event if value has not changed with backspace', () => {
const Select = mountDefault();
Select.vm.$data._value = 'one';
Select.find({ ref: 'search' }).trigger('keydown.backspace');
expect(Select.emitted().input.length).toBe(1);
Select.find({ ref: 'search' }).trigger('keydown.backspace');
Select.find({ ref: 'search' }).trigger('keydown.backspace');
expect(Select.emitted().input.length).toBe(1);
});
describe("Clear button", () => {
it("should be displayed on single select when value is selected", () => {
const Select = selectWithProps({
-10
View File
@@ -69,16 +69,6 @@ describe('Custom Keydown Handlers', () => {
expect(spy).toHaveBeenCalledTimes(1);
});
it('will not emit input event if value has not changed with backspace', () => {
const Select = mountDefault();
Select.vm.$data._value = 'one';
Select.find({ ref: 'search' }).trigger('keydown.backspace');
expect(Select.emitted().input.length).toBe(1);
Select.find({ ref: 'search' }).trigger('keydown.backspace');
Select.find({ ref: 'search' }).trigger('keydown.backspace');
expect(Select.emitted().input.length).toBe(1);
});
});
});