mirror of
https://github.com/tenrok/vue-select.git
synced 2026-06-19 09:50:33 +03:00
refactor: apply eslint fixes (#1469)
This commit is contained in:
@@ -1,59 +1,59 @@
|
||||
import { selectWithProps } from "../helpers";
|
||||
import { selectWithProps } from '../helpers'
|
||||
|
||||
describe("Selectable prop", () => {
|
||||
it("should select selectable option if clicked", async () => {
|
||||
describe('Selectable prop', () => {
|
||||
it('should select selectable option if clicked', async () => {
|
||||
const Select = selectWithProps({
|
||||
options: ["one", "two", "three"],
|
||||
selectable: (option) => option === "one"
|
||||
});
|
||||
options: ['one', 'two', 'three'],
|
||||
selectable: (option) => option === 'one',
|
||||
})
|
||||
|
||||
Select.vm.$data.open = true;
|
||||
await Select.vm.$nextTick();
|
||||
Select.vm.$data.open = true
|
||||
await Select.vm.$nextTick()
|
||||
|
||||
Select.find(".vs__dropdown-menu li:first-child").trigger("mousedown");
|
||||
Select.find('.vs__dropdown-menu li:first-child').trigger('mousedown')
|
||||
|
||||
await Select.vm.$nextTick();
|
||||
expect(Select.vm.selectedValue).toEqual(["one"]);
|
||||
await Select.vm.$nextTick()
|
||||
expect(Select.vm.selectedValue).toEqual(['one'])
|
||||
})
|
||||
|
||||
it("should not select not selectable option if clicked", async () => {
|
||||
it('should not select not selectable option if clicked', async () => {
|
||||
const Select = selectWithProps({
|
||||
options: ["one", "two", "three"],
|
||||
selectable: (option) => option === "one"
|
||||
});
|
||||
options: ['one', 'two', 'three'],
|
||||
selectable: (option) => option === 'one',
|
||||
})
|
||||
|
||||
Select.vm.$data.open = true;
|
||||
await Select.vm.$nextTick();
|
||||
Select.vm.$data.open = true
|
||||
await Select.vm.$nextTick()
|
||||
|
||||
Select.find(".vs__dropdown-menu li:last-child").trigger("mousedown");
|
||||
await Select.vm.$nextTick();
|
||||
Select.find('.vs__dropdown-menu li:last-child').trigger('mousedown')
|
||||
await Select.vm.$nextTick()
|
||||
|
||||
expect(Select.vm.selectedValue).toEqual([]);
|
||||
});
|
||||
|
||||
it("should skip non-selectable option on down arrow keyDown", () => {
|
||||
const Select = selectWithProps({
|
||||
options: ["one", "two", "three"],
|
||||
selectable: (option) => option !== "two"
|
||||
});
|
||||
|
||||
Select.vm.typeAheadPointer = 1;
|
||||
|
||||
Select.find({ ref: "search" }).trigger("keydown.down");
|
||||
|
||||
expect(Select.vm.typeAheadPointer).toEqual(2);
|
||||
expect(Select.vm.selectedValue).toEqual([])
|
||||
})
|
||||
|
||||
it("should skip non-selectable option on up arrow keyDown", () => {
|
||||
it('should skip non-selectable option on down arrow keyDown', () => {
|
||||
const Select = selectWithProps({
|
||||
options: ["one", "two", "three"],
|
||||
selectable: (option) => option !== "two"
|
||||
});
|
||||
options: ['one', 'two', 'three'],
|
||||
selectable: (option) => option !== 'two',
|
||||
})
|
||||
|
||||
Select.vm.typeAheadPointer = 2;
|
||||
Select.vm.typeAheadPointer = 1
|
||||
|
||||
Select.find({ ref: "search" }).trigger("keydown.up");
|
||||
Select.find({ ref: 'search' }).trigger('keydown.down')
|
||||
|
||||
expect(Select.vm.typeAheadPointer).toEqual(0);
|
||||
expect(Select.vm.typeAheadPointer).toEqual(2)
|
||||
})
|
||||
|
||||
it('should skip non-selectable option on up arrow keyDown', () => {
|
||||
const Select = selectWithProps({
|
||||
options: ['one', 'two', 'three'],
|
||||
selectable: (option) => option !== 'two',
|
||||
})
|
||||
|
||||
Select.vm.typeAheadPointer = 2
|
||||
|
||||
Select.find({ ref: 'search' }).trigger('keydown.up')
|
||||
|
||||
expect(Select.vm.typeAheadPointer).toEqual(0)
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user