mirror of
https://github.com/lana-k/sqliteviz.git
synced 2025-12-07 02:28:54 +08:00
format
This commit is contained in:
@@ -12,9 +12,9 @@ describe('DataView.vue', () => {
|
||||
})
|
||||
|
||||
it('emits update on mode changing', async () => {
|
||||
const wrapper = mount(DataView, {
|
||||
const wrapper = mount(DataView, {
|
||||
global: {
|
||||
stubs: { 'chart': true }
|
||||
stubs: { chart: true }
|
||||
}
|
||||
})
|
||||
|
||||
@@ -26,24 +26,32 @@ describe('DataView.vue', () => {
|
||||
})
|
||||
|
||||
it('method getOptionsForSave calls the same method of the current view component', async () => {
|
||||
const wrapper = mount(DataView, {
|
||||
const wrapper = mount(DataView, {
|
||||
global: {
|
||||
mocks: { $store }
|
||||
}
|
||||
})
|
||||
|
||||
const chart = wrapper.findComponent({ name: 'Chart' }).vm
|
||||
sinon.stub(chart, 'getOptionsForSave').returns({ here_are: 'chart_settings' })
|
||||
sinon
|
||||
.stub(chart, 'getOptionsForSave')
|
||||
.returns({ here_are: 'chart_settings' })
|
||||
|
||||
expect(wrapper.vm.getOptionsForSave()).to.eql({ here_are: 'chart_settings' })
|
||||
expect(wrapper.vm.getOptionsForSave()).to.eql({
|
||||
here_are: 'chart_settings'
|
||||
})
|
||||
|
||||
const pivotBtn = wrapper.findComponent({ ref: 'pivotBtn' })
|
||||
await pivotBtn.trigger('click')
|
||||
|
||||
const pivot = wrapper.findComponent({ name: 'pivot' }).vm
|
||||
sinon.stub(pivot, 'getOptionsForSave').returns({ here_are: 'pivot_settings' })
|
||||
sinon
|
||||
.stub(pivot, 'getOptionsForSave')
|
||||
.returns({ here_are: 'pivot_settings' })
|
||||
|
||||
expect(wrapper.vm.getOptionsForSave()).to.eql({ here_are: 'pivot_settings' })
|
||||
expect(wrapper.vm.getOptionsForSave()).to.eql({
|
||||
here_are: 'pivot_settings'
|
||||
})
|
||||
wrapper.unmount()
|
||||
})
|
||||
|
||||
@@ -117,7 +125,7 @@ describe('DataView.vue', () => {
|
||||
sinon.spy(window, 'alert')
|
||||
const wrapper = mount(DataView, {
|
||||
global: {
|
||||
stubs: { 'chart': true }
|
||||
stubs: { chart: true }
|
||||
}
|
||||
})
|
||||
|
||||
@@ -127,8 +135,8 @@ describe('DataView.vue', () => {
|
||||
expect(
|
||||
window.alert.calledOnceWith(
|
||||
"Your browser doesn't support copying images into the clipboard. " +
|
||||
'If you use Firefox you can enable it ' +
|
||||
'by setting dom.events.asyncClipboard.clipboardItem to true.'
|
||||
'If you use Firefox you can enable it ' +
|
||||
'by setting dom.events.asyncClipboard.clipboardItem to true.'
|
||||
)
|
||||
).to.equal(true)
|
||||
|
||||
@@ -146,9 +154,11 @@ describe('DataView.vue', () => {
|
||||
mocks: { $store }
|
||||
}
|
||||
})
|
||||
sinon.stub(wrapper.vm.$refs.viewComponent, 'prepareCopy').callsFake(async () => {
|
||||
await clock.tick(5000)
|
||||
})
|
||||
sinon
|
||||
.stub(wrapper.vm.$refs.viewComponent, 'prepareCopy')
|
||||
.callsFake(async () => {
|
||||
await clock.tick(5000)
|
||||
})
|
||||
|
||||
// Click copy to clipboard
|
||||
const copyBtn = wrapper.findComponent({ ref: 'copyToClipboardBtn' })
|
||||
@@ -156,11 +166,14 @@ describe('DataView.vue', () => {
|
||||
|
||||
// The dialog is shown...
|
||||
expect(wrapper.find('.dialog.vfm').exists()).to.equal(true)
|
||||
expect(wrapper.find('.dialog.vfm .dialog-header').text())
|
||||
.to.contain('Copy to clipboard')
|
||||
expect(wrapper.find('.dialog.vfm .dialog-header').text()).to.contain(
|
||||
'Copy to clipboard'
|
||||
)
|
||||
|
||||
// ... with Rendering message...
|
||||
expect(wrapper.find('.dialog-body').text()).to.equal('Rendering the visualisation...')
|
||||
expect(wrapper.find('.dialog-body').text()).to.equal(
|
||||
'Rendering the visualisation...'
|
||||
)
|
||||
|
||||
// Switch to microtasks (let prepareCopy run)
|
||||
await clock.tick(0)
|
||||
@@ -177,7 +190,9 @@ describe('DataView.vue', () => {
|
||||
expect(wrapper.find('.dialog-body').text()).to.equal('Image is ready')
|
||||
|
||||
// Click copy
|
||||
await wrapper.find('.dialog-buttons-container button.primary').trigger('click')
|
||||
await wrapper
|
||||
.find('.dialog-buttons-container button.primary')
|
||||
.trigger('click')
|
||||
|
||||
// The dialog is not shown...
|
||||
await clock.tick(100)
|
||||
@@ -196,9 +211,11 @@ describe('DataView.vue', () => {
|
||||
}
|
||||
})
|
||||
sinon.spy(wrapper.vm, 'copyToClipboard')
|
||||
sinon.stub(wrapper.vm.$refs.viewComponent, 'prepareCopy').callsFake(async () => {
|
||||
await clock.tick(500)
|
||||
})
|
||||
sinon
|
||||
.stub(wrapper.vm.$refs.viewComponent, 'prepareCopy')
|
||||
.callsFake(async () => {
|
||||
await clock.tick(500)
|
||||
})
|
||||
|
||||
// Click copy to clipboard
|
||||
const copyBtn = wrapper.findComponent({ ref: 'copyToClipboardBtn' })
|
||||
@@ -229,9 +246,11 @@ describe('DataView.vue', () => {
|
||||
}
|
||||
})
|
||||
sinon.spy(wrapper.vm, 'copyToClipboard')
|
||||
sinon.stub(wrapper.vm.$refs.viewComponent, 'prepareCopy').callsFake(async () => {
|
||||
await clock.tick(5000)
|
||||
})
|
||||
sinon
|
||||
.stub(wrapper.vm.$refs.viewComponent, 'prepareCopy')
|
||||
.callsFake(async () => {
|
||||
await clock.tick(5000)
|
||||
})
|
||||
|
||||
// Click copy to clipboard
|
||||
const copyBtn = wrapper.findComponent({ ref: 'copyToClipboardBtn' })
|
||||
@@ -245,7 +264,9 @@ describe('DataView.vue', () => {
|
||||
await nextTick()
|
||||
|
||||
// Click cancel
|
||||
await wrapper.find('.dialog-buttons-container button.secondary').trigger('click')
|
||||
await wrapper
|
||||
.find('.dialog-buttons-container button.secondary')
|
||||
.trigger('click')
|
||||
|
||||
// The dialog is not shown...
|
||||
await clock.tick(100)
|
||||
|
||||
@@ -39,7 +39,7 @@ describe('Pivot.vue', () => {
|
||||
}
|
||||
},
|
||||
global: {
|
||||
stubs: { 'chart': true }
|
||||
stubs: { chart: true }
|
||||
}
|
||||
})
|
||||
const colLabels = wrapper.findAll('.pivot-output thead th.pvtColLabel')
|
||||
@@ -77,7 +77,7 @@ describe('Pivot.vue', () => {
|
||||
}
|
||||
},
|
||||
global: {
|
||||
stubs: { 'chart': true }
|
||||
stubs: { chart: true }
|
||||
}
|
||||
})
|
||||
|
||||
@@ -144,7 +144,11 @@ describe('Pivot.vue', () => {
|
||||
rendererName: 'Table',
|
||||
vals: []
|
||||
})
|
||||
sinon.stub(wrapper.findComponent({ref: "customChart"}).vm, 'getOptionsForSave')
|
||||
sinon
|
||||
.stub(
|
||||
wrapper.findComponent({ ref: 'customChart' }).vm,
|
||||
'getOptionsForSave'
|
||||
)
|
||||
.returns({ here_are: 'custom chart settings' })
|
||||
|
||||
let optionsForSave = wrapper.vm.getOptionsForSave()
|
||||
@@ -208,7 +212,8 @@ describe('Pivot.vue', () => {
|
||||
|
||||
expect(await wrapper.vm.prepareCopy()).to.be.instanceof(HTMLCanvasElement)
|
||||
|
||||
sinon.stub(wrapper.findComponent({ref: "customChart"}).vm, 'prepareCopy')
|
||||
sinon
|
||||
.stub(wrapper.findComponent({ ref: 'customChart' }).vm, 'prepareCopy')
|
||||
.returns(URL.createObjectURL(new Blob()))
|
||||
|
||||
await wrapper.findComponent({ name: 'pivotUi' }).setValue({
|
||||
@@ -271,7 +276,7 @@ describe('Pivot.vue', () => {
|
||||
}
|
||||
})
|
||||
|
||||
const chartComponent = wrapper.findComponent({ref: "customChart"}).vm
|
||||
const chartComponent = wrapper.findComponent({ ref: 'customChart' }).vm
|
||||
sinon.stub(chartComponent, 'saveAsSvg')
|
||||
|
||||
await wrapper.vm.saveAsSvg()
|
||||
@@ -309,7 +314,7 @@ describe('Pivot.vue', () => {
|
||||
}
|
||||
})
|
||||
|
||||
const chartComponent = wrapper.findComponent({ref: "customChart"}).vm
|
||||
const chartComponent = wrapper.findComponent({ ref: 'customChart' }).vm
|
||||
sinon.stub(chartComponent, 'saveAsHtml')
|
||||
|
||||
await wrapper.vm.saveAsHtml()
|
||||
@@ -347,7 +352,7 @@ describe('Pivot.vue', () => {
|
||||
}
|
||||
})
|
||||
|
||||
const chartComponent = wrapper.findComponent({ref: "customChart"}).vm
|
||||
const chartComponent = wrapper.findComponent({ ref: 'customChart' }).vm
|
||||
sinon.stub(chartComponent, 'saveAsPng')
|
||||
|
||||
await wrapper.vm.saveAsPng()
|
||||
@@ -376,7 +381,7 @@ describe('Pivot.vue', () => {
|
||||
},
|
||||
attachTo: container,
|
||||
global: {
|
||||
stubs: { 'chart': true }
|
||||
stubs: { chart: true }
|
||||
}
|
||||
})
|
||||
|
||||
@@ -407,7 +412,7 @@ describe('Pivot.vue', () => {
|
||||
},
|
||||
attachTo: container,
|
||||
global: {
|
||||
stubs: { 'chart': true }
|
||||
stubs: { chart: true }
|
||||
}
|
||||
})
|
||||
|
||||
@@ -440,14 +445,16 @@ describe('Pivot.vue', () => {
|
||||
},
|
||||
attachTo: container,
|
||||
global: {
|
||||
stubs: { 'chart': true }
|
||||
stubs: { chart: true }
|
||||
}
|
||||
})
|
||||
|
||||
await wrapper.vm.saveAsHtml()
|
||||
expect(pivotHelper.getPivotHtml.calledOnce).to.equal(true)
|
||||
const html = pivotHelper.getPivotHtml.returnValues[0]
|
||||
expect(fIo.exportToFile.calledOnceWith(html, 'pivot.html', 'text/html')).to.equal(true)
|
||||
expect(
|
||||
fIo.exportToFile.calledOnceWith(html, 'pivot.html', 'text/html')
|
||||
).to.equal(true)
|
||||
})
|
||||
|
||||
it('saveAsPng - standart chart', async () => {
|
||||
@@ -473,7 +480,7 @@ describe('Pivot.vue', () => {
|
||||
},
|
||||
attachTo: container,
|
||||
global: {
|
||||
stubs: { 'chart': true }
|
||||
stubs: { chart: true }
|
||||
}
|
||||
})
|
||||
|
||||
@@ -481,12 +488,18 @@ describe('Pivot.vue', () => {
|
||||
expect(chartHelper.getImageDataUrl.calledOnce).to.equal(true)
|
||||
await chartHelper.getImageDataUrl.returnValues[0]
|
||||
expect(wrapper.emitted().loadingImageCompleted.length).to.equal(1)
|
||||
expect(fIo.downloadFromUrl.calledOnceWith('standat chart data url', 'pivot')).to.equal(true)
|
||||
expect(
|
||||
fIo.downloadFromUrl.calledOnceWith('standat chart data url', 'pivot')
|
||||
).to.equal(true)
|
||||
})
|
||||
|
||||
it('saveAsPng - table', async () => {
|
||||
sinon.stub(pivotHelper, 'getPivotCanvas').returns(document.createElement('canvas'))
|
||||
sinon.stub(HTMLCanvasElement.prototype, 'toDataURL').returns('canvas data url')
|
||||
sinon
|
||||
.stub(pivotHelper, 'getPivotCanvas')
|
||||
.returns(document.createElement('canvas'))
|
||||
sinon
|
||||
.stub(HTMLCanvasElement.prototype, 'toDataURL')
|
||||
.returns('canvas data url')
|
||||
sinon.stub(fIo, 'downloadFromUrl')
|
||||
|
||||
const wrapper = mount(Pivot, {
|
||||
@@ -508,7 +521,7 @@ describe('Pivot.vue', () => {
|
||||
},
|
||||
attachTo: container,
|
||||
global: {
|
||||
stubs: { 'chart': true }
|
||||
stubs: { chart: true }
|
||||
}
|
||||
})
|
||||
|
||||
@@ -516,6 +529,8 @@ describe('Pivot.vue', () => {
|
||||
expect(HTMLCanvasElement.prototype.toDataURL.calledOnce).to.equal(true)
|
||||
await HTMLCanvasElement.prototype.toDataURL.returnValues[0]
|
||||
expect(wrapper.emitted().loadingImageCompleted.length).to.equal(1)
|
||||
expect(fIo.downloadFromUrl.calledOnceWith('canvas data url', 'pivot')).to.equal(true)
|
||||
expect(
|
||||
fIo.downloadFromUrl.calledOnceWith('canvas data url', 'pivot')
|
||||
).to.equal(true)
|
||||
})
|
||||
})
|
||||
|
||||
@@ -4,10 +4,10 @@ import PivotSortBtn from '@/views/Main/Workspace/Tabs/Tab/DataView/Pivot/PivotUi
|
||||
|
||||
describe('PivotSortBtn.vue', () => {
|
||||
it('switches order', async () => {
|
||||
const wrapper = shallowMount(PivotSortBtn, {
|
||||
const wrapper = shallowMount(PivotSortBtn, {
|
||||
props: {
|
||||
modelValue: 'key_a_to_z',
|
||||
'onUpdate:modelValue': (e) => wrapper.setProps({ modelValue: e })
|
||||
'onUpdate:modelValue': e => wrapper.setProps({ modelValue: e })
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
@@ -7,16 +7,17 @@ describe('PivotUi.vue', () => {
|
||||
const wrapper = mount(PivotUi, {
|
||||
props: {
|
||||
keyNames: ['foo', 'bar'],
|
||||
'onUpdate:modelValue': (e) => wrapper.setProps({ modelValue: e })
|
||||
'onUpdate:modelValue': e => wrapper.setProps({ modelValue: e })
|
||||
}
|
||||
})
|
||||
|
||||
// choose columns
|
||||
await wrapper.findAll('.sqliteviz-select.cols .multiselect__element > span')[0]
|
||||
await wrapper
|
||||
.findAll('.sqliteviz-select.cols .multiselect__element > span')[0]
|
||||
.trigger('click')
|
||||
|
||||
expect(wrapper.emitted().update.length).to.equal(1)
|
||||
|
||||
|
||||
let value = wrapper.props('modelValue')
|
||||
expect(value.rows).to.eql([])
|
||||
expect(value.cols).to.eql(['foo'])
|
||||
@@ -28,7 +29,8 @@ describe('PivotUi.vue', () => {
|
||||
expect(value.vals).to.eql([])
|
||||
|
||||
// choose rows
|
||||
await wrapper.findAll('.sqliteviz-select.rows .multiselect__element > span')[0]
|
||||
await wrapper
|
||||
.findAll('.sqliteviz-select.rows .multiselect__element > span')[0]
|
||||
.trigger('click')
|
||||
|
||||
expect(wrapper.emitted().update.length).to.equal(2)
|
||||
@@ -71,7 +73,8 @@ describe('PivotUi.vue', () => {
|
||||
expect(value.vals).to.eql([])
|
||||
|
||||
// change aggregator
|
||||
await wrapper.findAll('.sqliteviz-select.aggregator .multiselect__element > span')[12]
|
||||
await wrapper
|
||||
.findAll('.sqliteviz-select.aggregator .multiselect__element > span')[12]
|
||||
.trigger('click')
|
||||
|
||||
expect(wrapper.emitted().update.length).to.equal(5)
|
||||
@@ -120,7 +123,8 @@ describe('PivotUi.vue', () => {
|
||||
expect(value.vals).to.eql(['foo', 'bar'])
|
||||
|
||||
// change renderer
|
||||
await wrapper.findAll('.sqliteviz-select.renderer .multiselect__element > span')[13]
|
||||
await wrapper
|
||||
.findAll('.sqliteviz-select.renderer .multiselect__element > span')[13]
|
||||
.trigger('click')
|
||||
|
||||
expect(wrapper.emitted().update.length).to.equal(8)
|
||||
@@ -134,7 +138,8 @@ describe('PivotUi.vue', () => {
|
||||
expect(value.vals).to.eql(['foo', 'bar'])
|
||||
|
||||
// change aggregator again
|
||||
await wrapper.findAll('.sqliteviz-select.aggregator .multiselect__element > span')[3]
|
||||
await wrapper
|
||||
.findAll('.sqliteviz-select.aggregator .multiselect__element > span')[3]
|
||||
.trigger('click')
|
||||
|
||||
expect(wrapper.emitted().update.length).to.equal(9)
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
import { expect } from 'chai'
|
||||
import { _getDataSources, getPivotCanvas, getPivotHtml }
|
||||
from '@/views/Main/Workspace/Tabs/Tab/DataView/Pivot/pivotHelper'
|
||||
import {
|
||||
_getDataSources,
|
||||
getPivotCanvas,
|
||||
getPivotHtml
|
||||
} from '@/views/Main/Workspace/Tabs/Tab/DataView/Pivot/pivotHelper'
|
||||
|
||||
describe('pivotHelper.js', () => {
|
||||
it('_getDataSources returns data sources', () => {
|
||||
@@ -22,10 +25,10 @@ describe('pivotHelper.js', () => {
|
||||
const pivotData = {
|
||||
rowAttrs: ['y'],
|
||||
colAttrs: ['x', 'z'],
|
||||
getRowKeys () {
|
||||
getRowKeys() {
|
||||
return [[3], [6], [9]]
|
||||
},
|
||||
getColKeys () {
|
||||
getColKeys() {
|
||||
return [
|
||||
[5, 2],
|
||||
[5, 3],
|
||||
@@ -33,9 +36,9 @@ describe('pivotHelper.js', () => {
|
||||
[10, 6]
|
||||
]
|
||||
},
|
||||
getAggregator (row, col) {
|
||||
getAggregator(row, col) {
|
||||
return {
|
||||
value () {
|
||||
value() {
|
||||
return +row + +col[1]
|
||||
}
|
||||
}
|
||||
@@ -61,7 +64,9 @@ describe('pivotHelper.js', () => {
|
||||
child.classList.add('pvtTable')
|
||||
pivotOutput.append(child)
|
||||
|
||||
expect(await getPivotCanvas(pivotOutput)).to.be.instanceof(HTMLCanvasElement)
|
||||
expect(await getPivotCanvas(pivotOutput)).to.be.instanceof(
|
||||
HTMLCanvasElement
|
||||
)
|
||||
})
|
||||
|
||||
it('getPivotHtml returns html with styles', async () => {
|
||||
|
||||
@@ -25,8 +25,9 @@ describe('Record.vue', () => {
|
||||
expect(rows[1].findAll('th')[0].text()).to.equals('name')
|
||||
expect(rows[1].findAll('td')[0].text()).to.equals('bar')
|
||||
|
||||
const selectedCell = wrapper
|
||||
.find('.sqliteviz-table tbody td[aria-selected="true"]')
|
||||
const selectedCell = wrapper.find(
|
||||
'.sqliteviz-table tbody td[aria-selected="true"]'
|
||||
)
|
||||
expect(selectedCell.text()).to.equals('bar')
|
||||
})
|
||||
|
||||
@@ -49,8 +50,9 @@ describe('Record.vue', () => {
|
||||
expect(rows).to.have.lengthOf(2)
|
||||
expect(rows[0].findAll('td')[0].text()).to.equals('1')
|
||||
expect(rows[1].findAll('td')[0].text()).to.equals('foo')
|
||||
let selectedCell = wrapper
|
||||
.find('.sqliteviz-table tbody td[aria-selected="true"]')
|
||||
let selectedCell = wrapper.find(
|
||||
'.sqliteviz-table tbody td[aria-selected="true"]'
|
||||
)
|
||||
expect(selectedCell.text()).to.equals('1')
|
||||
|
||||
await wrapper.find('.next').trigger('click')
|
||||
@@ -58,8 +60,9 @@ describe('Record.vue', () => {
|
||||
rows = wrapper.findAll('tbody tr')
|
||||
expect(rows[0].findAll('td')[0].text()).to.equals('2')
|
||||
expect(rows[1].findAll('td')[0].text()).to.equals('bar')
|
||||
selectedCell = wrapper
|
||||
.find('.sqliteviz-table tbody td[aria-selected="true"]')
|
||||
selectedCell = wrapper.find(
|
||||
'.sqliteviz-table tbody td[aria-selected="true"]'
|
||||
)
|
||||
expect(selectedCell.text()).to.equals('2')
|
||||
|
||||
await wrapper.find('.prev').trigger('click')
|
||||
@@ -67,8 +70,9 @@ describe('Record.vue', () => {
|
||||
rows = wrapper.findAll('tbody tr')
|
||||
expect(rows[0].findAll('td')[0].text()).to.equals('1')
|
||||
expect(rows[1].findAll('td')[0].text()).to.equals('foo')
|
||||
selectedCell = wrapper
|
||||
.find('.sqliteviz-table tbody td[aria-selected="true"]')
|
||||
selectedCell = wrapper.find(
|
||||
'.sqliteviz-table tbody td[aria-selected="true"]'
|
||||
)
|
||||
expect(selectedCell.text()).to.equals('1')
|
||||
|
||||
await wrapper.find('.last').trigger('click')
|
||||
@@ -76,8 +80,9 @@ describe('Record.vue', () => {
|
||||
rows = wrapper.findAll('tbody tr')
|
||||
expect(rows[0].findAll('td')[0].text()).to.equals('3')
|
||||
expect(rows[1].findAll('td')[0].text()).to.equals('baz')
|
||||
selectedCell = wrapper
|
||||
.find('.sqliteviz-table tbody td[aria-selected="true"]')
|
||||
selectedCell = wrapper.find(
|
||||
'.sqliteviz-table tbody td[aria-selected="true"]'
|
||||
)
|
||||
expect(selectedCell.text()).to.equals('3')
|
||||
|
||||
await wrapper.find('.first').trigger('click')
|
||||
@@ -85,8 +90,9 @@ describe('Record.vue', () => {
|
||||
rows = wrapper.findAll('tbody tr')
|
||||
expect(rows[0].findAll('td')[0].text()).to.equals('1')
|
||||
expect(rows[1].findAll('td')[0].text()).to.equals('foo')
|
||||
selectedCell = wrapper
|
||||
.find('.sqliteviz-table tbody td[aria-selected="true"]')
|
||||
selectedCell = wrapper.find(
|
||||
'.sqliteviz-table tbody td[aria-selected="true"]'
|
||||
)
|
||||
expect(selectedCell.text()).to.equals('1')
|
||||
})
|
||||
|
||||
@@ -105,12 +111,14 @@ describe('Record.vue', () => {
|
||||
}
|
||||
})
|
||||
|
||||
const selectedCell = wrapper
|
||||
.find('.sqliteviz-table tbody td[aria-selected="true"]')
|
||||
const selectedCell = wrapper.find(
|
||||
'.sqliteviz-table tbody td[aria-selected="true"]'
|
||||
)
|
||||
await selectedCell.trigger('click')
|
||||
|
||||
const selectedCellAfterClick = wrapper
|
||||
.find('.sqliteviz-table tbody td[aria-selected="true"]')
|
||||
const selectedCellAfterClick = wrapper.find(
|
||||
'.sqliteviz-table tbody td[aria-selected="true"]'
|
||||
)
|
||||
expect(selectedCellAfterClick.exists()).to.equals(false)
|
||||
})
|
||||
})
|
||||
|
||||
@@ -39,8 +39,8 @@ describe('RunResult.vue', () => {
|
||||
expect(
|
||||
window.alert.calledOnceWith(
|
||||
"Your browser doesn't support copying into the clipboard. " +
|
||||
'If you use Firefox you can enable it ' +
|
||||
'by setting dom.events.asyncClipboard.clipboardItem to true.'
|
||||
'If you use Firefox you can enable it ' +
|
||||
'by setting dom.events.asyncClipboard.clipboardItem to true.'
|
||||
)
|
||||
).to.equal(true)
|
||||
|
||||
@@ -79,8 +79,9 @@ describe('RunResult.vue', () => {
|
||||
|
||||
// The dialog is shown...
|
||||
expect(wrapper.find('.dialog.vfm').exists()).to.equal(true)
|
||||
expect(wrapper.find('.dialog.vfm .dialog-header').text())
|
||||
.to.contain('Copy to clipboard')
|
||||
expect(wrapper.find('.dialog.vfm .dialog-header').text()).to.contain(
|
||||
'Copy to clipboard'
|
||||
)
|
||||
|
||||
// ... with Building message...
|
||||
expect(wrapper.find('.dialog-body').text()).to.equal('Building CSV...')
|
||||
@@ -96,7 +97,9 @@ describe('RunResult.vue', () => {
|
||||
expect(wrapper.find('.dialog-body').text()).to.equal('CSV is ready')
|
||||
|
||||
// Click copy
|
||||
await wrapper.find('.dialog-buttons-container button.primary').trigger('click')
|
||||
await wrapper
|
||||
.find('.dialog-buttons-container button.primary')
|
||||
.trigger('click')
|
||||
await window.navigator.clipboard.writeText.returnValues[0]
|
||||
|
||||
// The dialog is not shown...
|
||||
@@ -180,7 +183,9 @@ describe('RunResult.vue', () => {
|
||||
await nextTick()
|
||||
|
||||
// Click cancel
|
||||
await wrapper.find('.dialog-buttons-container button.secondary').trigger('click')
|
||||
await wrapper
|
||||
.find('.dialog-buttons-container button.secondary')
|
||||
.trigger('click')
|
||||
// The dialog is not shown...
|
||||
await clock.tick(100)
|
||||
expect(wrapper.find('.dialog.vfm').exists()).to.equal(false)
|
||||
@@ -246,8 +251,9 @@ describe('RunResult.vue', () => {
|
||||
|
||||
// Click on 'bar' cell again
|
||||
await rows[1].findAll('td')[1].trigger('click')
|
||||
expect(wrapper.find('.value-viewer-container .table-preview').text())
|
||||
.to.equals('No cell selected to view')
|
||||
expect(
|
||||
wrapper.find('.value-viewer-container .table-preview').text()
|
||||
).to.equals('No cell selected to view')
|
||||
wrapper.unmount()
|
||||
})
|
||||
|
||||
@@ -318,8 +324,9 @@ describe('RunResult.vue', () => {
|
||||
|
||||
// Click on 'foo' cell again
|
||||
await rows[1].find('td').trigger('click')
|
||||
expect(wrapper.find('.value-viewer-container .table-preview').text())
|
||||
.to.equals('No cell selected to view')
|
||||
expect(
|
||||
wrapper.find('.value-viewer-container .table-preview').text()
|
||||
).to.equals('No cell selected to view')
|
||||
wrapper.unmount()
|
||||
})
|
||||
|
||||
@@ -357,8 +364,9 @@ describe('RunResult.vue', () => {
|
||||
|
||||
// 'name-1' is selected
|
||||
expect(wrapper.find('.value-body').text()).to.equals('name-1')
|
||||
let selectedCell = wrapper
|
||||
.find('.sqliteviz-table tbody td[aria-selected="true"]')
|
||||
let selectedCell = wrapper.find(
|
||||
'.sqliteviz-table tbody td[aria-selected="true"]'
|
||||
)
|
||||
expect(selectedCell.text()).to.equals('name-1')
|
||||
|
||||
// Go to last record
|
||||
@@ -375,8 +383,9 @@ describe('RunResult.vue', () => {
|
||||
|
||||
// '29' is selected
|
||||
expect(wrapper.find('.value-body').text()).to.equals('29')
|
||||
selectedCell = wrapper
|
||||
.find('.sqliteviz-table tbody td[aria-selected="true"]')
|
||||
selectedCell = wrapper.find(
|
||||
'.sqliteviz-table tbody td[aria-selected="true"]'
|
||||
)
|
||||
expect(selectedCell.text()).to.equals('29')
|
||||
wrapper.unmount()
|
||||
})
|
||||
|
||||
@@ -25,7 +25,7 @@ describe('ValueViewer.vue', () => {
|
||||
}
|
||||
})
|
||||
await wrapper.find('button.json').trigger('click')
|
||||
expect(wrapper.find('.value-body').text()).to.equals('Can\'t parse JSON.')
|
||||
expect(wrapper.find('.value-body').text()).to.equals("Can't parse JSON.")
|
||||
})
|
||||
|
||||
it('copy to clipboard', async () => {
|
||||
@@ -38,7 +38,8 @@ describe('ValueViewer.vue', () => {
|
||||
|
||||
await wrapper.find('button.copy').trigger('click')
|
||||
|
||||
expect(window.navigator.clipboard.writeText.calledOnceWith('foo'))
|
||||
.to.equal(true)
|
||||
expect(window.navigator.clipboard.writeText.calledOnceWith('foo')).to.equal(
|
||||
true
|
||||
)
|
||||
})
|
||||
})
|
||||
|
||||
@@ -18,8 +18,12 @@ describe('SqlEditor.vue', () => {
|
||||
plugins: [store]
|
||||
}
|
||||
})
|
||||
await wrapper.findComponent({ ref: 'cm' }).setValue('SELECT * FROM foo', 'value')
|
||||
expect(wrapper.emitted()['update:modelValue'][0]).to.eql(['SELECT * FROM foo'])
|
||||
await wrapper
|
||||
.findComponent({ ref: 'cm' })
|
||||
.setValue('SELECT * FROM foo', 'value')
|
||||
expect(wrapper.emitted()['update:modelValue'][0]).to.eql([
|
||||
'SELECT * FROM foo'
|
||||
])
|
||||
})
|
||||
|
||||
it('Run is disabled if there is no db or no query or is getting result set', async () => {
|
||||
@@ -28,11 +32,13 @@ describe('SqlEditor.vue', () => {
|
||||
}
|
||||
const store = createStore({ state })
|
||||
|
||||
const wrapper = mount(SqlEditor, {
|
||||
const wrapper = mount(SqlEditor, {
|
||||
global: { plugins: [store] },
|
||||
props: { isGettingResults: false }
|
||||
})
|
||||
await wrapper.findComponent({ ref: 'cm' }).setValue('SELECT * FROM foo', 'value')
|
||||
await wrapper
|
||||
.findComponent({ ref: 'cm' })
|
||||
.setValue('SELECT * FROM foo', 'value')
|
||||
const runButton = wrapper.findComponent({ ref: 'runBtn' })
|
||||
|
||||
expect(runButton.props('disabled')).to.equal(true)
|
||||
@@ -44,7 +50,9 @@ describe('SqlEditor.vue', () => {
|
||||
await wrapper.findComponent({ ref: 'cm' }).setValue('', 'value')
|
||||
expect(runButton.props('disabled')).to.equal(true)
|
||||
|
||||
await wrapper.findComponent({ ref: 'cm' }).setValue('SELECT * FROM foo', 'value')
|
||||
await wrapper
|
||||
.findComponent({ ref: 'cm' })
|
||||
.setValue('SELECT * FROM foo', 'value')
|
||||
expect(runButton.props('disabled')).to.equal(false)
|
||||
|
||||
await wrapper.setProps({ isGettingResults: true })
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
import { expect } from 'chai'
|
||||
import sinon from 'sinon'
|
||||
import state from '@/store/state'
|
||||
import showHint, { getHints } from '@/views/Main/Workspace/Tabs/Tab/SqlEditor/hint'
|
||||
import showHint, {
|
||||
getHints
|
||||
} from '@/views/Main/Workspace/Tabs/Tab/SqlEditor/hint'
|
||||
import CM from 'codemirror'
|
||||
|
||||
describe('hint.js', () => {
|
||||
@@ -22,9 +24,7 @@ describe('hint.js', () => {
|
||||
},
|
||||
{
|
||||
name: 'bar',
|
||||
columns: [
|
||||
{ name: 'barId', type: 'INTEGER' }
|
||||
]
|
||||
columns: [{ name: 'barId', type: 'INTEGER' }]
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -33,7 +33,7 @@ describe('hint.js', () => {
|
||||
// mock showHint and editor
|
||||
sinon.stub(CM, 'showHint')
|
||||
const editor = {
|
||||
getTokenAt () {
|
||||
getTokenAt() {
|
||||
return {
|
||||
string: 'SELECT',
|
||||
type: 'keyword'
|
||||
@@ -70,7 +70,7 @@ describe('hint.js', () => {
|
||||
// mock showHint and editor
|
||||
sinon.stub(CM, 'showHint')
|
||||
const editor = {
|
||||
getTokenAt () {
|
||||
getTokenAt() {
|
||||
return {
|
||||
string: 'SELECT',
|
||||
type: 'keyword'
|
||||
@@ -87,7 +87,7 @@ describe('hint.js', () => {
|
||||
// mock showHint and editor
|
||||
sinon.stub(CM, 'showHint')
|
||||
const editor = {
|
||||
getTokenAt () {
|
||||
getTokenAt() {
|
||||
return {
|
||||
string: 'foo',
|
||||
type: 'string'
|
||||
@@ -104,7 +104,7 @@ describe('hint.js', () => {
|
||||
// mock showHint and editor
|
||||
sinon.stub(CM, 'showHint')
|
||||
const editor = {
|
||||
getTokenAt () {
|
||||
getTokenAt() {
|
||||
return {
|
||||
string: ' ',
|
||||
type: null
|
||||
@@ -121,7 +121,7 @@ describe('hint.js', () => {
|
||||
// mock showHint and editor
|
||||
sinon.stub(CM, 'showHint')
|
||||
const editor = {
|
||||
getTokenAt () {
|
||||
getTokenAt() {
|
||||
return {
|
||||
string: ';',
|
||||
type: 'punctuation'
|
||||
@@ -134,30 +134,27 @@ describe('hint.js', () => {
|
||||
expect(CM.showHint.called).to.equal(false)
|
||||
})
|
||||
|
||||
it(
|
||||
'getHints returns [ ] if there is only one option and token is completed with this option',
|
||||
() => {
|
||||
// mock CM.hint.sql and editor
|
||||
sinon.stub(CM.hint, 'sql').returns({
|
||||
list: [{ text: 'SELECT' }],
|
||||
from: null, // from/to doesn't metter because getRange is mocked
|
||||
to: null
|
||||
})
|
||||
it('getHints returns [ ] if there is only one option and token is completed with this option', () => {
|
||||
// mock CM.hint.sql and editor
|
||||
sinon.stub(CM.hint, 'sql').returns({
|
||||
list: [{ text: 'SELECT' }],
|
||||
from: null, // from/to doesn't metter because getRange is mocked
|
||||
to: null
|
||||
})
|
||||
|
||||
const editor = {
|
||||
getRange () {
|
||||
return 'select'
|
||||
}
|
||||
const editor = {
|
||||
getRange() {
|
||||
return 'select'
|
||||
}
|
||||
|
||||
const hints = getHints(editor, {})
|
||||
expect(hints.list).to.eql([])
|
||||
}
|
||||
)
|
||||
|
||||
const hints = getHints(editor, {})
|
||||
expect(hints.list).to.eql([])
|
||||
})
|
||||
|
||||
it(
|
||||
'getHints returns [ ] if there is only one string option and token ' +
|
||||
'is completed with this option',
|
||||
'is completed with this option',
|
||||
() => {
|
||||
// mock CM.hint.sql and editor
|
||||
sinon.stub(CM.hint, 'sql').returns({
|
||||
@@ -166,7 +163,7 @@ describe('hint.js', () => {
|
||||
to: null
|
||||
})
|
||||
const editor = {
|
||||
getRange () {
|
||||
getRange() {
|
||||
return 'house.name'
|
||||
}
|
||||
}
|
||||
@@ -178,13 +175,10 @@ describe('hint.js', () => {
|
||||
|
||||
it('getHints returns hints as is when there are more than one option', () => {
|
||||
// mock CM.hint.sql and editor
|
||||
const list = [
|
||||
{ text: 'SELECT' },
|
||||
{ text: 'ST' }
|
||||
]
|
||||
const list = [{ text: 'SELECT' }, { text: 'ST' }]
|
||||
sinon.stub(CM.hint, 'sql').returns({ list, from: null, to: null })
|
||||
const editor = {
|
||||
getRange () {
|
||||
getRange() {
|
||||
return 'se'
|
||||
}
|
||||
}
|
||||
@@ -195,22 +189,19 @@ describe('hint.js', () => {
|
||||
sinon.restore()
|
||||
})
|
||||
|
||||
it(
|
||||
'getHints returns hints as is when there only one option but the token is not completed',
|
||||
() => {
|
||||
// mock CM.hint.sql and editor
|
||||
const list = [{ text: 'SELECT' }]
|
||||
sinon.stub(CM.hint, 'sql').returns({ list, from: null, to: null })
|
||||
const editor = {
|
||||
getRange () {
|
||||
return 'sele'
|
||||
}
|
||||
it('getHints returns hints as is when there only one option but the token is not completed', () => {
|
||||
// mock CM.hint.sql and editor
|
||||
const list = [{ text: 'SELECT' }]
|
||||
sinon.stub(CM.hint, 'sql').returns({ list, from: null, to: null })
|
||||
const editor = {
|
||||
getRange() {
|
||||
return 'sele'
|
||||
}
|
||||
|
||||
const hints = getHints(editor, {})
|
||||
expect(hints.list).to.eql(list)
|
||||
}
|
||||
)
|
||||
|
||||
const hints = getHints(editor, {})
|
||||
expect(hints.list).to.eql(list)
|
||||
})
|
||||
|
||||
it('tables is empty object when schema is null', () => {
|
||||
// mock store state
|
||||
@@ -219,7 +210,7 @@ describe('hint.js', () => {
|
||||
// mock showHint and editor
|
||||
sinon.stub(CM, 'showHint')
|
||||
const editor = {
|
||||
getTokenAt () {
|
||||
getTokenAt() {
|
||||
return {
|
||||
string: 'SELECT',
|
||||
type: 'keyword'
|
||||
|
||||
@@ -31,7 +31,7 @@ describe('Tab.vue', () => {
|
||||
const wrapper = mount(Tab, {
|
||||
attachTo: place,
|
||||
global: {
|
||||
stubs: { 'chart': true, 'icon-button': true },
|
||||
stubs: { chart: true, 'icon-button': true },
|
||||
plugins: [store]
|
||||
},
|
||||
props: {
|
||||
@@ -56,10 +56,15 @@ describe('Tab.vue', () => {
|
||||
})
|
||||
await nextTick()
|
||||
expect(wrapper.find('.tab-content-container').isVisible()).to.equal(true)
|
||||
expect(wrapper.find('.bottomPane .run-result-panel').exists()).to.equal(true)
|
||||
expect(wrapper.find('.run-result-panel .result-before').isVisible()).to.equal(true)
|
||||
expect(wrapper.find('.above .sql-editor-panel .codemirror-container').text())
|
||||
.to.contain('SELECT * FROM foo')
|
||||
expect(wrapper.find('.bottomPane .run-result-panel').exists()).to.equal(
|
||||
true
|
||||
)
|
||||
expect(
|
||||
wrapper.find('.run-result-panel .result-before').isVisible()
|
||||
).to.equal(true)
|
||||
expect(
|
||||
wrapper.find('.above .sql-editor-panel .codemirror-container').text()
|
||||
).to.contain('SELECT * FROM foo')
|
||||
})
|
||||
|
||||
it("Doesn't render tab when it's not active", async () => {
|
||||
@@ -74,7 +79,7 @@ describe('Tab.vue', () => {
|
||||
const wrapper = mount(Tab, {
|
||||
attachTo: place,
|
||||
global: {
|
||||
stubs: { 'chart': true },
|
||||
stubs: { chart: true },
|
||||
plugins: [store]
|
||||
},
|
||||
props: {
|
||||
@@ -114,7 +119,7 @@ describe('Tab.vue', () => {
|
||||
const wrapper = mount(Tab, {
|
||||
attachTo: place,
|
||||
global: {
|
||||
stubs: { 'chart': true },
|
||||
stubs: { chart: true },
|
||||
plugins: [store]
|
||||
},
|
||||
props: {
|
||||
@@ -174,7 +179,7 @@ describe('Tab.vue', () => {
|
||||
const wrapper = mount(Tab, {
|
||||
attachTo: place,
|
||||
global: {
|
||||
stubs: { 'chart': true },
|
||||
stubs: { chart: true },
|
||||
plugins: [store]
|
||||
},
|
||||
props: {
|
||||
@@ -219,7 +224,7 @@ describe('Tab.vue', () => {
|
||||
const wrapper = mount(Tab, {
|
||||
attachTo: place,
|
||||
global: {
|
||||
stubs: { 'chart': true },
|
||||
stubs: { chart: true },
|
||||
plugins: [store]
|
||||
},
|
||||
props: {
|
||||
@@ -263,7 +268,7 @@ describe('Tab.vue', () => {
|
||||
const wrapper = mount(Tab, {
|
||||
attachTo: place,
|
||||
global: {
|
||||
stubs: { 'chart': true, 'icon-button': true },
|
||||
stubs: { chart: true, 'icon-button': true },
|
||||
plugins: [store]
|
||||
},
|
||||
props: {
|
||||
@@ -274,7 +279,9 @@ describe('Tab.vue', () => {
|
||||
|
||||
store.state.tabs[0].isGettingResults = true
|
||||
await nextTick()
|
||||
expect(wrapper.find('.run-result-panel .result-in-progress').exists()).to.equal(true)
|
||||
expect(
|
||||
wrapper.find('.run-result-panel .result-in-progress').exists()
|
||||
).to.equal(true)
|
||||
})
|
||||
|
||||
it('Shows error when executing query ends with error', async () => {
|
||||
@@ -310,7 +317,7 @@ describe('Tab.vue', () => {
|
||||
const wrapper = mount(Tab, {
|
||||
attachTo: place,
|
||||
global: {
|
||||
stubs: { 'chart': true, 'icon-button': true, },
|
||||
stubs: { chart: true, 'icon-button': true },
|
||||
plugins: [store]
|
||||
},
|
||||
props: {
|
||||
@@ -323,10 +330,16 @@ describe('Tab.vue', () => {
|
||||
message: 'There is no table foo'
|
||||
}
|
||||
await nextTick()
|
||||
expect(wrapper.find('.run-result-panel .result-before').isVisible()).to.equal(false)
|
||||
expect(wrapper.find('.run-result-panel .result-in-progress').exists()).to.equal(false)
|
||||
expect(
|
||||
wrapper.find('.run-result-panel .result-before').isVisible()
|
||||
).to.equal(false)
|
||||
expect(
|
||||
wrapper.find('.run-result-panel .result-in-progress').exists()
|
||||
).to.equal(false)
|
||||
expect(wrapper.findComponent({ name: 'logs' }).isVisible()).to.equal(true)
|
||||
expect(wrapper.findComponent({ name: 'logs' }).text()).to.include('There is no table foo')
|
||||
expect(wrapper.findComponent({ name: 'logs' }).text()).to.include(
|
||||
'There is no table foo'
|
||||
)
|
||||
})
|
||||
|
||||
it('Passes result to sql-table component', async () => {
|
||||
@@ -368,7 +381,7 @@ describe('Tab.vue', () => {
|
||||
const wrapper = mount(Tab, {
|
||||
attachTo: place,
|
||||
global: {
|
||||
stubs: { 'chart': true },
|
||||
stubs: { chart: true },
|
||||
plugins: [store]
|
||||
},
|
||||
props: {
|
||||
@@ -378,10 +391,16 @@ describe('Tab.vue', () => {
|
||||
await nextTick()
|
||||
store.state.tabs[0].result = result
|
||||
await nextTick()
|
||||
expect(wrapper.find('.run-result-panel .result-before').isVisible()).to.equal(false)
|
||||
expect(wrapper.find('.run-result-panel .result-in-progress').exists()).to.equal(false)
|
||||
expect(
|
||||
wrapper.find('.run-result-panel .result-before').isVisible()
|
||||
).to.equal(false)
|
||||
expect(
|
||||
wrapper.find('.run-result-panel .result-in-progress').exists()
|
||||
).to.equal(false)
|
||||
expect(wrapper.findComponent({ name: 'logs' }).exists()).to.equal(false)
|
||||
expect(wrapper.findComponent({ name: 'SqlTable' }).vm.dataSet).to.eql(result)
|
||||
expect(wrapper.findComponent({ name: 'SqlTable' }).vm.dataSet).to.eql(
|
||||
result
|
||||
)
|
||||
})
|
||||
|
||||
it('Switches views', async () => {
|
||||
@@ -414,7 +433,7 @@ describe('Tab.vue', () => {
|
||||
const wrapper = mount(Tab, {
|
||||
attachTo: place,
|
||||
global: {
|
||||
stubs: { 'chart': true },
|
||||
stubs: { chart: true },
|
||||
plugins: [store]
|
||||
},
|
||||
props: {
|
||||
@@ -422,33 +441,43 @@ describe('Tab.vue', () => {
|
||||
}
|
||||
})
|
||||
|
||||
let tableBtn = wrapper.find('.above .side-tool-bar')
|
||||
let tableBtn = wrapper
|
||||
.find('.above .side-tool-bar')
|
||||
.findComponent({ ref: 'tableBtn' })
|
||||
await tableBtn.vm.$emit('click')
|
||||
|
||||
expect(wrapper.find('.bottomPane .sql-editor-panel').exists()).to.equal(true)
|
||||
expect(wrapper.find('.bottomPane .sql-editor-panel').exists()).to.equal(
|
||||
true
|
||||
)
|
||||
expect(wrapper.find('.above .run-result-panel').exists()).to.equal(true)
|
||||
|
||||
const dataViewBtn = wrapper.find('.above .side-tool-bar')
|
||||
const dataViewBtn = wrapper
|
||||
.find('.above .side-tool-bar')
|
||||
.findComponent({ ref: 'dataViewBtn' })
|
||||
await dataViewBtn.vm.$emit('click')
|
||||
|
||||
expect(wrapper.find('.bottomPane .sql-editor-panel').exists()).to.equal(true)
|
||||
expect(wrapper.find('.bottomPane .sql-editor-panel').exists()).to.equal(
|
||||
true
|
||||
)
|
||||
expect(wrapper.find('.above .data-view-panel').exists()).to.equal(true)
|
||||
|
||||
const sqlEditorBtn = wrapper.find('.above .side-tool-bar')
|
||||
const sqlEditorBtn = wrapper
|
||||
.find('.above .side-tool-bar')
|
||||
.findComponent({ ref: 'sqlEditorBtn' })
|
||||
await sqlEditorBtn.vm.$emit('click')
|
||||
|
||||
expect(wrapper.find('.above .sql-editor-panel').exists()).to.equal(true)
|
||||
expect(wrapper.find('.bottomPane .data-view-panel').exists()).to.equal(true)
|
||||
|
||||
tableBtn = wrapper.find('.bottomPane .side-tool-bar')
|
||||
tableBtn = wrapper
|
||||
.find('.bottomPane .side-tool-bar')
|
||||
.findComponent({ ref: 'tableBtn' })
|
||||
await tableBtn.vm.$emit('click')
|
||||
|
||||
expect(wrapper.find('.above .sql-editor-panel').exists()).to.equal(true)
|
||||
expect(wrapper.find('.bottomPane .run-result-panel').exists()).to.equal(true)
|
||||
expect(wrapper.find('.bottomPane .run-result-panel').exists()).to.equal(
|
||||
true
|
||||
)
|
||||
})
|
||||
|
||||
it('Maximize top panel if maximized panel is above', async () => {
|
||||
@@ -480,7 +509,7 @@ describe('Tab.vue', () => {
|
||||
const wrapper = mount(Tab, {
|
||||
attachTo: place,
|
||||
global: {
|
||||
stubs: { 'chart': true },
|
||||
stubs: { chart: true },
|
||||
plugins: [store]
|
||||
},
|
||||
props: {
|
||||
@@ -489,8 +518,9 @@ describe('Tab.vue', () => {
|
||||
})
|
||||
await nextTick()
|
||||
|
||||
expect(wrapper.find('.above').element.parentElement.style.height)
|
||||
.to.equal('100%')
|
||||
expect(wrapper.find('.above').element.parentElement.style.height).to.equal(
|
||||
'100%'
|
||||
)
|
||||
})
|
||||
|
||||
it('Maximize bottom panel if maximized panel is below', async () => {
|
||||
@@ -522,7 +552,7 @@ describe('Tab.vue', () => {
|
||||
const wrapper = mount(Tab, {
|
||||
attachTo: place,
|
||||
global: {
|
||||
stubs: { 'chart': true },
|
||||
stubs: { chart: true },
|
||||
plugins: [store]
|
||||
},
|
||||
props: {
|
||||
@@ -530,8 +560,9 @@ describe('Tab.vue', () => {
|
||||
}
|
||||
})
|
||||
await nextTick()
|
||||
expect(wrapper.find('.bottomPane').element.parentElement.style.height)
|
||||
.to.equal('100%')
|
||||
expect(
|
||||
wrapper.find('.bottomPane').element.parentElement.style.height
|
||||
).to.equal('100%')
|
||||
})
|
||||
|
||||
it('Panel size is 50 if nothing to maximize', async () => {
|
||||
@@ -562,7 +593,7 @@ describe('Tab.vue', () => {
|
||||
const wrapper = mount(Tab, {
|
||||
attachTo: place,
|
||||
global: {
|
||||
stubs: { 'chart': true },
|
||||
stubs: { chart: true },
|
||||
plugins: [store]
|
||||
},
|
||||
props: {
|
||||
@@ -571,9 +602,11 @@ describe('Tab.vue', () => {
|
||||
})
|
||||
|
||||
await nextTick()
|
||||
expect(wrapper.find('.above').element.parentElement.style.height)
|
||||
.to.equal('50%')
|
||||
expect(wrapper.find('.bottomPane').element.parentElement.style.height)
|
||||
.to.equal('50%')
|
||||
expect(wrapper.find('.above').element.parentElement.style.height).to.equal(
|
||||
'50%'
|
||||
)
|
||||
expect(
|
||||
wrapper.find('.bottomPane').element.parentElement.style.height
|
||||
).to.equal('50%')
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user