mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
Unit tests for FigureQrCode
This commit is contained in:
parent
bd29624c79
commit
06523f38fa
@ -22,12 +22,62 @@ describe('FigureQrCode', () => {
|
||||
wrapper = Wrapper()
|
||||
})
|
||||
|
||||
it('renders the Div Element ".figure-qr-code"', () => {
|
||||
expect(wrapper.find('div.figure-qr-code').exists()).toBeTruthy()
|
||||
afterEach(() => {
|
||||
jest.clearAllMocks()
|
||||
})
|
||||
|
||||
it('renders the Div Element "q-r-canvas"', () => {
|
||||
expect(wrapper.find('q-r-canvas'))
|
||||
it('has options filled', () => {
|
||||
expect(wrapper.vm.options).toEqual({
|
||||
cellSize: 8,
|
||||
correctLevel: 'H',
|
||||
data: '',
|
||||
})
|
||||
})
|
||||
|
||||
it('renders the Div Element ".figure-qr-code"', () => {
|
||||
expect(wrapper.find('div.figure-qr-code').exists()).toBe(true)
|
||||
})
|
||||
|
||||
it('renders the Div Element "qrbox"', () => {
|
||||
expect(wrapper.find('div.qrbox').exists()).toBe(true)
|
||||
})
|
||||
|
||||
it('renders the Canvas Element "#qrcanvas"', () => {
|
||||
const canvas = wrapper.find('#qrcanvas')
|
||||
|
||||
// console.log(canvas.html())
|
||||
expect(canvas.exists()).toBe(true)
|
||||
|
||||
// Hier können Sie weitere Tests für das Canvas-Element durchführen
|
||||
// z.B. überprüfen Sie die Breite und Höhe des Canvas-Elements oder den Canvas-Kontext
|
||||
|
||||
const canvasEl = canvas.element
|
||||
const canvasWidth = canvasEl.width
|
||||
const canvasHeight = canvasEl.height
|
||||
|
||||
expect(canvasWidth).toBeGreaterThan(0)
|
||||
expect(canvasHeight).toBeGreaterThan(0)
|
||||
|
||||
const canvasContext = canvasEl.getContext('2d')
|
||||
expect(canvasContext).not.toBeNull()
|
||||
})
|
||||
|
||||
it('renders the A Element "#download"', () => {
|
||||
const downloadLink = wrapper.find('#download')
|
||||
expect(downloadLink.exists()).toBe(true)
|
||||
})
|
||||
|
||||
describe('Download QR-Code link', () => {
|
||||
beforeEach(() => {
|
||||
const downloadLink = wrapper.find('#download')
|
||||
downloadLink.trigger('click')
|
||||
// await wrapper.vm.$nextTick()
|
||||
})
|
||||
|
||||
it('click the A Element "#download" set an href', () => {
|
||||
// expect(toDataURLStub).toHaveBeenCalledWith('image/png')
|
||||
expect(wrapper.find('#download').attributes('href')).toEqual('')
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user