mirror of
https://github.com/lana-k/sqliteviz.git
synced 2025-12-06 18:18:53 +08:00
fix lint errors
This commit is contained in:
@@ -17,7 +17,7 @@ describe('DbUploader.vue', () => {
|
|||||||
saveSchema: sinon.stub()
|
saveSchema: sinon.stub()
|
||||||
}
|
}
|
||||||
const store = new Vuex.Store({ state, mutations })
|
const store = new Vuex.Store({ state, mutations })
|
||||||
|
|
||||||
// mock getting a file from user
|
// mock getting a file from user
|
||||||
const file = {}
|
const file = {}
|
||||||
sinon.stub(fu, 'getFileFromUser').resolves(file)
|
sinon.stub(fu, 'getFileFromUser').resolves(file)
|
||||||
@@ -72,7 +72,7 @@ describe('DbUploader.vue', () => {
|
|||||||
value: [file],
|
value: [file],
|
||||||
writable: false
|
writable: false
|
||||||
})
|
})
|
||||||
|
|
||||||
await wrapper.find('.drop-area').trigger('drop', dropData)
|
await wrapper.find('.drop-area').trigger('drop', dropData)
|
||||||
expect($db.loadDb.calledOnceWith(file)).to.equal(true)
|
expect($db.loadDb.calledOnceWith(file)).to.equal(true)
|
||||||
await $db.loadDb.returnValues[0]
|
await $db.loadDb.returnValues[0]
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { expect } from 'chai'
|
import { expect } from 'chai'
|
||||||
import sinon from 'sinon'
|
import sinon from 'sinon'
|
||||||
import { mount, shallowMount } from '@vue/test-utils'
|
import { mount } from '@vue/test-utils'
|
||||||
import Pager from '@/components/Pager.vue'
|
import Pager from '@/components/Pager.vue'
|
||||||
|
|
||||||
describe('Pager.vue', () => {
|
describe('Pager.vue', () => {
|
||||||
@@ -9,11 +9,13 @@ describe('Pager.vue', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it('emits input event with a page', async () => {
|
it('emits input event with a page', async () => {
|
||||||
const wrapper = mount(Pager, { propsData: {
|
const wrapper = mount(Pager, {
|
||||||
pageCount: 5
|
propsData: {
|
||||||
}})
|
pageCount: 5
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
// click on 'next page' link
|
// click on 'next page' link
|
||||||
await wrapper.find('.paginator-next').trigger('click')
|
await wrapper.find('.paginator-next').trigger('click')
|
||||||
expect(wrapper.emitted('input')[0]).to.eql([2])
|
expect(wrapper.emitted('input')[0]).to.eql([2])
|
||||||
|
|
||||||
@@ -23,9 +25,11 @@ describe('Pager.vue', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it('changes the page when value is changed', async () => {
|
it('changes the page when value is changed', async () => {
|
||||||
const wrapper = mount(Pager, { propsData: {
|
const wrapper = mount(Pager, {
|
||||||
pageCount: 5
|
propsData: {
|
||||||
}})
|
pageCount: 5
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
await wrapper.setProps({ value: 5 })
|
await wrapper.setProps({ value: 5 })
|
||||||
expect(wrapper.emitted('input')[0]).to.eql([5])
|
expect(wrapper.emitted('input')[0]).to.eql([5])
|
||||||
|
|||||||
@@ -15,8 +15,7 @@ describe('Splitpanes.vue', () => {
|
|||||||
after: { size: 40, max: 100 }
|
after: { size: 40, max: 100 }
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
expect(wrapper.findAll('.splitpanes-pane')).to.have.lengthOf(2)
|
expect(wrapper.findAll('.splitpanes-pane')).to.have.lengthOf(2)
|
||||||
expect(wrapper.findAll('.splitpanes-pane').at(0).element.style.width).to.equal('60%')
|
expect(wrapper.findAll('.splitpanes-pane').at(0).element.style.width).to.equal('60%')
|
||||||
expect(wrapper.findAll('.splitpanes-pane').at(1).element.style.width).to.equal('40%')
|
expect(wrapper.findAll('.splitpanes-pane').at(1).element.style.width).to.equal('40%')
|
||||||
@@ -35,8 +34,7 @@ describe('Splitpanes.vue', () => {
|
|||||||
horizontal: true
|
horizontal: true
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
expect(wrapper.findAll('.splitpanes-pane')).to.have.lengthOf(2)
|
expect(wrapper.findAll('.splitpanes-pane')).to.have.lengthOf(2)
|
||||||
expect(wrapper.findAll('.splitpanes-pane').at(0).element.style.height).to.equal('60%')
|
expect(wrapper.findAll('.splitpanes-pane').at(0).element.style.height).to.equal('60%')
|
||||||
expect(wrapper.findAll('.splitpanes-pane').at(1).element.style.height).to.equal('40%')
|
expect(wrapper.findAll('.splitpanes-pane').at(1).element.style.height).to.equal('40%')
|
||||||
@@ -54,7 +52,7 @@ describe('Splitpanes.vue', () => {
|
|||||||
after: { size: 40, max: 100 }
|
after: { size: 40, max: 100 }
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
await wrapper.find('.toggle-btn').trigger('click')
|
await wrapper.find('.toggle-btn').trigger('click')
|
||||||
expect(wrapper.findAll('.splitpanes-pane').at(0).element.style.width).to.equal('0%')
|
expect(wrapper.findAll('.splitpanes-pane').at(0).element.style.width).to.equal('0%')
|
||||||
expect(wrapper.findAll('.splitpanes-pane').at(1).element.style.width).to.equal('100%')
|
expect(wrapper.findAll('.splitpanes-pane').at(1).element.style.width).to.equal('100%')
|
||||||
@@ -79,7 +77,7 @@ describe('Splitpanes.vue', () => {
|
|||||||
root.style.height = '500px'
|
root.style.height = '500px'
|
||||||
root.appendChild(place)
|
root.appendChild(place)
|
||||||
document.body.appendChild(root)
|
document.body.appendChild(root)
|
||||||
|
|
||||||
// mount the component
|
// mount the component
|
||||||
const wrapper = shallowMount(Splitpanes, {
|
const wrapper = shallowMount(Splitpanes, {
|
||||||
attachTo: place,
|
attachTo: place,
|
||||||
@@ -92,13 +90,13 @@ describe('Splitpanes.vue', () => {
|
|||||||
after: { size: 40, max: 100 }
|
after: { size: 40, max: 100 }
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
await wrapper.find('.splitpanes-splitter').trigger('mousedown')
|
await wrapper.find('.splitpanes-splitter').trigger('mousedown')
|
||||||
document.dispatchEvent(new MouseEvent("mousemove", {
|
document.dispatchEvent(new MouseEvent('mousemove', {
|
||||||
clientX: 300,
|
clientX: 300,
|
||||||
clientY: 80
|
clientY: 80
|
||||||
}))
|
}))
|
||||||
document.dispatchEvent(new MouseEvent("mouseup"))
|
document.dispatchEvent(new MouseEvent('mouseup'))
|
||||||
await wrapper.vm.$nextTick()
|
await wrapper.vm.$nextTick()
|
||||||
expect(wrapper.findAll('.splitpanes-pane').at(0).element.style.width).to.equal('50%')
|
expect(wrapper.findAll('.splitpanes-pane').at(0).element.style.width).to.equal('50%')
|
||||||
wrapper.destroy()
|
wrapper.destroy()
|
||||||
@@ -112,7 +110,7 @@ describe('Splitpanes.vue', () => {
|
|||||||
root.style.height = '500px'
|
root.style.height = '500px'
|
||||||
root.appendChild(place)
|
root.appendChild(place)
|
||||||
document.body.appendChild(root)
|
document.body.appendChild(root)
|
||||||
|
|
||||||
// mount the component
|
// mount the component
|
||||||
const wrapper = shallowMount(Splitpanes, {
|
const wrapper = shallowMount(Splitpanes, {
|
||||||
attachTo: place,
|
attachTo: place,
|
||||||
@@ -126,13 +124,13 @@ describe('Splitpanes.vue', () => {
|
|||||||
horizontal: true
|
horizontal: true
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
await wrapper.find('.splitpanes-splitter').trigger('mousedown')
|
await wrapper.find('.splitpanes-splitter').trigger('mousedown')
|
||||||
document.dispatchEvent(new MouseEvent("mousemove", {
|
document.dispatchEvent(new MouseEvent('mousemove', {
|
||||||
clientX: 10,
|
clientX: 10,
|
||||||
clientY: 250
|
clientY: 250
|
||||||
}))
|
}))
|
||||||
document.dispatchEvent(new MouseEvent("mouseup"))
|
document.dispatchEvent(new MouseEvent('mouseup'))
|
||||||
await wrapper.vm.$nextTick()
|
await wrapper.vm.$nextTick()
|
||||||
expect(wrapper.findAll('.splitpanes-pane').at(0).element.style.height).to.equal('50%')
|
expect(wrapper.findAll('.splitpanes-pane').at(0).element.style.height).to.equal('50%')
|
||||||
wrapper.destroy()
|
wrapper.destroy()
|
||||||
|
|||||||
@@ -16,8 +16,8 @@ describe('splitter.js', () => {
|
|||||||
container.style.left = '20px'
|
container.style.left = '20px'
|
||||||
|
|
||||||
document.body.appendChild(container)
|
document.body.appendChild(container)
|
||||||
|
|
||||||
const event = new MouseEvent("mousemove", {
|
const event = new MouseEvent('mousemove', {
|
||||||
clientX: 70,
|
clientX: 70,
|
||||||
clientY: 80
|
clientY: 80
|
||||||
})
|
})
|
||||||
@@ -27,7 +27,7 @@ describe('splitter.js', () => {
|
|||||||
expect(mouseDrag.y).to.equal(70)
|
expect(mouseDrag.y).to.equal(70)
|
||||||
})
|
})
|
||||||
|
|
||||||
it("getCurrentDragPercentage - horisontal", () => {
|
it('getCurrentDragPercentage - horisontal', () => {
|
||||||
sinon.stub(splitter, 'getCurrentMouseDrag').returns({ x: 50, y: 70 })
|
sinon.stub(splitter, 'getCurrentMouseDrag').returns({ x: 50, y: 70 })
|
||||||
|
|
||||||
const event = {}
|
const event = {}
|
||||||
@@ -42,7 +42,7 @@ describe('splitter.js', () => {
|
|||||||
expect(dragPercentage).to.equal(50)
|
expect(dragPercentage).to.equal(50)
|
||||||
})
|
})
|
||||||
|
|
||||||
it("getCurrentDragPercentage - vertical", () => {
|
it('getCurrentDragPercentage - vertical', () => {
|
||||||
sinon.stub(splitter, 'getCurrentMouseDrag').returns({ x: 50, y: 70 })
|
sinon.stub(splitter, 'getCurrentMouseDrag').returns({ x: 50, y: 70 })
|
||||||
|
|
||||||
const event = {}
|
const event = {}
|
||||||
@@ -57,7 +57,7 @@ describe('splitter.js', () => {
|
|||||||
expect(dragPercentage).to.equal(25)
|
expect(dragPercentage).to.equal(25)
|
||||||
})
|
})
|
||||||
|
|
||||||
it("calculateOffset", () => {
|
it('calculateOffset', () => {
|
||||||
sinon.stub(splitter, 'getCurrentDragPercentage').returns(25)
|
sinon.stub(splitter, 'getCurrentDragPercentage').returns(25)
|
||||||
|
|
||||||
const event = {}
|
const event = {}
|
||||||
@@ -74,7 +74,7 @@ describe('splitter.js', () => {
|
|||||||
expect(offset).to.equal(25)
|
expect(offset).to.equal(25)
|
||||||
})
|
})
|
||||||
|
|
||||||
it("calculateOffset prevents dragging beyond paneBefore max", () => {
|
it('calculateOffset prevents dragging beyond paneBefore max', () => {
|
||||||
sinon.stub(splitter, 'getCurrentDragPercentage').returns(75)
|
sinon.stub(splitter, 'getCurrentDragPercentage').returns(75)
|
||||||
|
|
||||||
const event = {}
|
const event = {}
|
||||||
@@ -90,7 +90,7 @@ describe('splitter.js', () => {
|
|||||||
expect(offset).to.equal(70)
|
expect(offset).to.equal(70)
|
||||||
})
|
})
|
||||||
|
|
||||||
it("calculateOffset prevents dragging beyond paneAfter max", () => {
|
it('calculateOffset prevents dragging beyond paneAfter max', () => {
|
||||||
sinon.stub(splitter, 'getCurrentDragPercentage').returns(10)
|
sinon.stub(splitter, 'getCurrentDragPercentage').returns(10)
|
||||||
|
|
||||||
const event = {}
|
const event = {}
|
||||||
|
|||||||
Reference in New Issue
Block a user