981babd691
Co-authored-by: Dominik Pschenitschni <mail@celement.de> Reviewed-on: https://kolaente.dev/vikunja/frontend/pulls/1017 Reviewed-by: konrad <k@knt.li> Co-authored-by: dpschen <dpschen@noreply.kolaente.de> Co-committed-by: dpschen <dpschen@noreply.kolaente.de>
23 lines
360 B
TypeScript
23 lines
360 B
TypeScript
import {Directive} from 'vue'
|
|
|
|
declare global {
|
|
interface Window {
|
|
Cypress: object;
|
|
}
|
|
}
|
|
|
|
const cypressDirective: Directive = {
|
|
mounted(el, {value}) {
|
|
if (
|
|
(window.Cypress || import.meta.env.DEV) &&
|
|
value
|
|
) {
|
|
el.setAttribute('data-cy', value)
|
|
}
|
|
},
|
|
beforeUnmount(el) {
|
|
el.removeAttribute('data-cy')
|
|
},
|
|
}
|
|
|
|
export default cypressDirective
|