2023-10-26 10:44:28 +13:00
|
|
|
import { installQuasarPlugin } from '@quasar/quasar-app-extension-testing-unit-vitest'
|
2023-08-29 10:05:58 +12:00
|
|
|
import { mount } from '@vue/test-utils'
|
|
|
|
import { describe, expect, it } from 'vitest'
|
|
|
|
import GlobalWindowButtons from './GlobalWindowButtons.vue'
|
|
|
|
|
2023-10-26 10:44:28 +13:00
|
|
|
installQuasarPlugin()
|
2023-08-29 10:05:58 +12:00
|
|
|
|
2023-09-09 09:54:44 +12:00
|
|
|
describe('Component - "GlobalWindowButtons"', () => {
|
|
|
|
/**
|
|
|
|
* Object of string data selectors for the component
|
|
|
|
*/
|
|
|
|
const selectorList = {
|
|
|
|
buttonMinimize: 'globalWindowButtons-button-minimize',
|
|
|
|
buttonResize: 'globalWindowButtons-button-resize',
|
|
|
|
buttonClose: 'globalWindowButtons-button-close'
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Test if the component has three specific HTML element buttons properly mounted in it:
|
|
|
|
* - Minimize button
|
|
|
|
* - Resize button
|
|
|
|
* - Close button
|
|
|
|
*/
|
|
|
|
it('Wrapper should contain three buttons', () => {
|
2023-08-29 10:05:58 +12:00
|
|
|
const wrapper = mount(GlobalWindowButtons)
|
2023-09-09 09:54:44 +12:00
|
|
|
|
|
|
|
const buttonList = []
|
|
|
|
|
|
|
|
buttonList.push(wrapper.get(`[data-test="${selectorList.buttonMinimize}"]`))
|
|
|
|
buttonList.push(wrapper.get(`[data-test="${selectorList.buttonResize}"]`))
|
|
|
|
buttonList.push(wrapper.get(`[data-test="${selectorList.buttonClose}"]`))
|
|
|
|
|
|
|
|
expect(buttonList).toHaveLength(3)
|
2023-08-29 10:05:58 +12:00
|
|
|
})
|
|
|
|
|
2023-09-09 09:54:44 +12:00
|
|
|
/**
|
|
|
|
* Test if the component has a specific HTML element button properly mounted in it.
|
|
|
|
* - Minimize button
|
|
|
|
*/
|
|
|
|
it('Wrapper should contain "minimize" button', () => {
|
2023-08-29 10:05:58 +12:00
|
|
|
const wrapper = mount(GlobalWindowButtons)
|
2023-09-09 09:54:44 +12:00
|
|
|
|
|
|
|
expect(wrapper.get(`[data-test="${selectorList.buttonMinimize}"]`))
|
2023-08-29 10:05:58 +12:00
|
|
|
})
|
|
|
|
|
2023-09-09 09:54:44 +12:00
|
|
|
/**
|
|
|
|
* Test if the component has a specific HTML element button properly mounted in it.
|
|
|
|
* - Resize button
|
|
|
|
*/
|
|
|
|
it('Wrapper should contain "resize" button', () => {
|
2023-08-29 10:05:58 +12:00
|
|
|
const wrapper = mount(GlobalWindowButtons)
|
2023-09-09 09:54:44 +12:00
|
|
|
|
|
|
|
expect(wrapper.get(`[data-test="${selectorList.buttonResize}"]`))
|
2023-08-29 10:05:58 +12:00
|
|
|
})
|
|
|
|
|
2023-09-09 09:54:44 +12:00
|
|
|
/**
|
|
|
|
* Test if the component has a specific HTML element button properly mounted in it.
|
|
|
|
* - Close button
|
|
|
|
*/
|
|
|
|
it('Wrapper should contain "close" button', () => {
|
2023-08-29 10:05:58 +12:00
|
|
|
const wrapper = mount(GlobalWindowButtons)
|
2023-09-09 09:54:44 +12:00
|
|
|
|
|
|
|
expect(wrapper.get(`[data-test="${selectorList.buttonClose}"]`))
|
2023-08-29 10:05:58 +12:00
|
|
|
})
|
|
|
|
})
|