skillbox/client/cypress/components/InputWithLabel.cy.ts

22 lines
654 B
TypeScript

import InputWithLabel from '@/components/ui/InputWithLabel.vue';
describe('InputWithLabel', () => {
it('renders', () => {
const inputSpy = cy.spy().as('inputSpy');
cy.mount(InputWithLabel, {
props: {
value: '',
label: 'Label',
placeholder: 'Placeholder',
onInput: inputSpy,
},
});
cy.getByDataCy('input-with-label-input')
.should('have.attr', 'placeholder', 'Placeholder')
.type('Hello')
.should('have.value', 'Hello');
cy.getByDataCy('input-with-label-label').should('contain.text', 'Label');
cy.get('@inputSpy').should('have.been.calledWith', 'Hello');
});
});