feat: refs #7220 2 tet
This commit is contained in:
parent
f5218dc844
commit
694c5494ef
|
@ -1,8 +1,50 @@
|
|||
import VnAccountNumber from 'src/components/common/VnAccountNumber.vue';
|
||||
import { Quasar, QInput } from 'quasar';
|
||||
|
||||
describe.skip('<VnAccountNumber />', () => {
|
||||
it('TODO: boilerplate', () => {
|
||||
// see: https://on.cypress.io/mounting-vue
|
||||
cy.createWrapper(VnAccountNumber);
|
||||
describe('<VnAccountNumber />', () => {
|
||||
// VNAccountNumber.spec.js
|
||||
|
||||
const mountComponent = (props = {}) => {
|
||||
cy.createWeapper(VnAccountNumber, {
|
||||
global: {
|
||||
plugins: [Quasar],
|
||||
components: { QInput },
|
||||
},
|
||||
props,
|
||||
});
|
||||
};
|
||||
|
||||
it('renderiza correctamente el componente', () => {
|
||||
mountComponent();
|
||||
cy.get('.q-input').should('exist');
|
||||
});
|
||||
|
||||
it('muestra el valor inicial proporcionado en modelValue', () => {
|
||||
const initialValue = '12345';
|
||||
mountComponent({ modelValue: initialValue });
|
||||
cy.get('.q-field__native').should('have.value', initialValue);
|
||||
});
|
||||
|
||||
it('actualiza modelValue al ingresar texto', () => {
|
||||
const onUpdateModelValue = cy.stub();
|
||||
mountComponent({ 'onUpdate:modelValue': onUpdateModelValue });
|
||||
cy.get('.q-field__native').type('67890');
|
||||
cy.wrap(onUpdateModelValue).should('have.been.called');
|
||||
});
|
||||
|
||||
it('convierte el número de cuenta corto al formato estándar', () => {
|
||||
const shortAccount = '123.';
|
||||
const expectedAccount = '123' + '0'.repeat(11 - 3);
|
||||
mountComponent({ modelValue: shortAccount });
|
||||
cy.get('.q-field__native').should('have.value', expectedAccount);
|
||||
});
|
||||
|
||||
it('actualiza internalValue al cambiar modelValue', () => {
|
||||
const newValue = '98765';
|
||||
mountComponent({ modelValue: '' });
|
||||
cy.then(() => {
|
||||
Cypress.vueWrapper.setProps({ modelValue: newValue });
|
||||
});
|
||||
cy.get('.q-field__native').should('have.value', newValue);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -1,8 +1,78 @@
|
|||
import VnBreadcrumbs from 'src/components/common/VnBreadcrumbs.vue';
|
||||
import { createRouter, createMemoryHistory } from 'vue-router';
|
||||
describe('<VnBreadcrumbs />', () => {
|
||||
const routes = [
|
||||
{
|
||||
path: '/',
|
||||
name: 'Home',
|
||||
meta: { title: 'Home' },
|
||||
},
|
||||
{
|
||||
path: '/dashboard',
|
||||
name: 'Dashboard',
|
||||
meta: { title: 'Dashboard' },
|
||||
children: [
|
||||
{
|
||||
path: 'settings',
|
||||
name: 'Settings',
|
||||
meta: { title: 'Settings' },
|
||||
},
|
||||
],
|
||||
},
|
||||
];
|
||||
|
||||
describe.skip('<VnBreadcrumbs />', () => {
|
||||
it('TODO: boilerplate', () => {
|
||||
// see: https://on.cypress.io/mounting-vue
|
||||
cy.createWrapper(VnBreadcrumbs);
|
||||
const mountComponent = (initialRoute = '/') => {
|
||||
const router = createRouter({
|
||||
history: createMemoryHistory(),
|
||||
routes,
|
||||
});
|
||||
|
||||
router.push(initialRoute);
|
||||
return router.isReady().then(() => {
|
||||
cy.createWrapper(VnBreadcrumbs, {
|
||||
global: {
|
||||
plugins: [router],
|
||||
},
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
it('renderiza correctamente el componente', () => {
|
||||
mountComponent();
|
||||
cy.get('.breadcrumbs').should('exist');
|
||||
});
|
||||
|
||||
it('muestra correctamente el breadcrumb en la ruta raíz', () => {
|
||||
mountComponent('/');
|
||||
cy.get('.breadcrumbs').contains('Home').should('exist');
|
||||
});
|
||||
|
||||
it('muestra correctamente los breadcrumbs en una ruta anidada', () => {
|
||||
mountComponent('/dashboard/settings');
|
||||
cy.get('.breadcrumbs').contains('Dashboard').should('exist');
|
||||
cy.get('.breadcrumbs').contains('Settings').should('exist');
|
||||
});
|
||||
|
||||
it('no muestra breadcrumbs si la ruta no tiene meta', () => {
|
||||
const routesWithoutMeta = [
|
||||
{
|
||||
path: '/nometa',
|
||||
name: 'NoMeta',
|
||||
},
|
||||
];
|
||||
const router = createRouter({
|
||||
history: createMemoryHistory(),
|
||||
routes: routesWithoutMeta,
|
||||
});
|
||||
|
||||
router.push('/nometa');
|
||||
router.isReady().then(() => {
|
||||
mount(VnBreadcrumbs, {
|
||||
global: {
|
||||
plugins: [router, Quasar],
|
||||
},
|
||||
});
|
||||
cy.get('.breadcrumbs').should('not.exist');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue