mirror of
https://github.com/tenrok/vue-select.git
synced 2026-06-22 10:30:34 +03:00
refactor: apply eslint fixes (#1469)
This commit is contained in:
@@ -1,61 +1,61 @@
|
||||
import { mountDefault } from "../helpers";
|
||||
import { mountDefault } from '../helpers'
|
||||
|
||||
describe("Automatic Scrolling", () => {
|
||||
it("should check if the scroll position needs to be adjusted on up arrow keyUp", async () => {
|
||||
describe('Automatic Scrolling', () => {
|
||||
it('should check if the scroll position needs to be adjusted on up arrow keyUp', async () => {
|
||||
// Given
|
||||
const Select = mountDefault();
|
||||
const spy = jest.spyOn(Select.vm, "maybeAdjustScroll");
|
||||
Select.vm.typeAheadPointer = 1;
|
||||
const Select = mountDefault()
|
||||
const spy = jest.spyOn(Select.vm, 'maybeAdjustScroll')
|
||||
Select.vm.typeAheadPointer = 1
|
||||
|
||||
// When
|
||||
Select.find({ ref: "search" }).trigger("keydown.up");
|
||||
await Select.vm.$nextTick();
|
||||
Select.find({ ref: 'search' }).trigger('keydown.up')
|
||||
await Select.vm.$nextTick()
|
||||
|
||||
// Then
|
||||
expect(spy).toHaveBeenCalled();
|
||||
});
|
||||
expect(spy).toHaveBeenCalled()
|
||||
})
|
||||
|
||||
it("should check if the scroll position needs to be adjusted on down arrow keyUp", async () => {
|
||||
it('should check if the scroll position needs to be adjusted on down arrow keyUp', async () => {
|
||||
// Given
|
||||
const Select = mountDefault();
|
||||
const spy = jest.spyOn(Select.vm, "maybeAdjustScroll");
|
||||
Select.vm.typeAheadPointer = 1;
|
||||
const Select = mountDefault()
|
||||
const spy = jest.spyOn(Select.vm, 'maybeAdjustScroll')
|
||||
Select.vm.typeAheadPointer = 1
|
||||
|
||||
// When
|
||||
Select.find({ ref: "search" }).trigger("keydown.down");
|
||||
await Select.vm.$nextTick();
|
||||
Select.find({ ref: 'search' }).trigger('keydown.down')
|
||||
await Select.vm.$nextTick()
|
||||
|
||||
// Then
|
||||
expect(spy).toHaveBeenCalled();
|
||||
});
|
||||
expect(spy).toHaveBeenCalled()
|
||||
})
|
||||
|
||||
it("should check if the scroll position needs to be adjusted when filtered options changes", async () => {
|
||||
it('should check if the scroll position needs to be adjusted when filtered options changes', async () => {
|
||||
// Given
|
||||
const Select = mountDefault();
|
||||
const spy = jest.spyOn(Select.vm, "maybeAdjustScroll");
|
||||
Select.vm.typeAheadPointer = 1;
|
||||
const Select = mountDefault()
|
||||
const spy = jest.spyOn(Select.vm, 'maybeAdjustScroll')
|
||||
Select.vm.typeAheadPointer = 1
|
||||
|
||||
// When
|
||||
Select.vm.search = "two";
|
||||
await Select.vm.$nextTick();
|
||||
Select.vm.search = 'two'
|
||||
await Select.vm.$nextTick()
|
||||
|
||||
// Then
|
||||
expect(spy).toHaveBeenCalled();
|
||||
});
|
||||
expect(spy).toHaveBeenCalled()
|
||||
})
|
||||
|
||||
it("should not adjust scroll position when autoscroll is false", async () => {
|
||||
it('should not adjust scroll position when autoscroll is false', async () => {
|
||||
// Given
|
||||
const Select = mountDefault({
|
||||
autoscroll: false
|
||||
});
|
||||
const spy = jest.spyOn(Select.vm, "maybeAdjustScroll");
|
||||
Select.vm.typeAheadPointer = 1;
|
||||
autoscroll: false,
|
||||
})
|
||||
const spy = jest.spyOn(Select.vm, 'maybeAdjustScroll')
|
||||
Select.vm.typeAheadPointer = 1
|
||||
|
||||
// When
|
||||
Select.vm.search = "two";
|
||||
await Select.vm.$nextTick();
|
||||
Select.vm.search = 'two'
|
||||
await Select.vm.$nextTick()
|
||||
|
||||
// Then
|
||||
expect(spy).toHaveBeenCalledTimes(0);
|
||||
});
|
||||
});
|
||||
expect(spy).toHaveBeenCalledTimes(0)
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user