Merge branch 'dev' into 8243-arreglarSkeletonSummary
gitea/salix-front/pipeline/pr-dev This commit looks good
Details
gitea/salix-front/pipeline/pr-dev This commit looks good
Details
This commit is contained in:
commit
e0bf2db42e
|
@ -0,0 +1,63 @@
|
||||||
|
import { vi, describe, expect, it, beforeAll, afterEach } from 'vitest';
|
||||||
|
import { createWrapper } from 'app/test/vitest/helper';
|
||||||
|
import VnInputTime from 'components/common/VnInputTime.vue';
|
||||||
|
|
||||||
|
describe('VnInputTime', () => {
|
||||||
|
let wrapper;
|
||||||
|
let vm;
|
||||||
|
|
||||||
|
beforeAll(() => {
|
||||||
|
wrapper = createWrapper(VnInputTime, {
|
||||||
|
props: {
|
||||||
|
isOutlined: true,
|
||||||
|
timeOnly: false,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
vm = wrapper.vm;
|
||||||
|
wrapper = wrapper.wrapper;
|
||||||
|
});
|
||||||
|
|
||||||
|
afterEach(() => {
|
||||||
|
vi.clearAllMocks();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should return the correct data if isOutlined is true', () => {
|
||||||
|
expect(vm.isOutlined).toBe(true);
|
||||||
|
expect(vm.styleAttrs).toEqual({ dense: true, outlined: true, rounded: true });
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should return the formatted data', () => {
|
||||||
|
expect(vm.dateToTime('2022-01-01T03:23:43')).toBe('03:23');
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('formattedTime', () => {
|
||||||
|
it('should return the formatted time for a valid ISO date', () => {
|
||||||
|
vm.model = '2025-01-02T15:45:00';
|
||||||
|
expect(vm.formattedTime).toBe('15:45');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should handle null model value gracefully', () => {
|
||||||
|
vm.model = null;
|
||||||
|
expect(vm.formattedTime).toBe(null);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should handle time-only input correctly', async () => {
|
||||||
|
await wrapper.setProps({ timeOnly: true });
|
||||||
|
vm.formattedTime = '14:30';
|
||||||
|
expect(vm.model).toBe('14:30');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should pad short time values correctly', async () => {
|
||||||
|
await wrapper.setProps({ timeOnly: true });
|
||||||
|
vm.formattedTime = '9';
|
||||||
|
expect(vm.model).toBe('09:00');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should not update the model if the value is unchanged', () => {
|
||||||
|
vm.model = '14:30';
|
||||||
|
const previousModel = vm.model;
|
||||||
|
vm.formattedTime = '14:30';
|
||||||
|
expect(vm.model).toBe(previousModel);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
|
@ -11,6 +11,7 @@ import VnInput from 'src/components/common/VnInput.vue';
|
||||||
import VnSelect from 'src/components/common/VnSelect.vue';
|
import VnSelect from 'src/components/common/VnSelect.vue';
|
||||||
import VnSelectDialog from 'src/components/common/VnSelectDialog.vue';
|
import VnSelectDialog from 'src/components/common/VnSelectDialog.vue';
|
||||||
import CustomerNewCustomsAgent from 'src/pages/Customer/components/CustomerNewCustomsAgent.vue';
|
import CustomerNewCustomsAgent from 'src/pages/Customer/components/CustomerNewCustomsAgent.vue';
|
||||||
|
import VnInputNumber from 'src/components/common/VnInputNumber.vue';
|
||||||
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
|
@ -150,6 +151,22 @@ function onAgentCreated({ id, fiscalName }, data) {
|
||||||
</template>
|
</template>
|
||||||
</VnSelectDialog>
|
</VnSelectDialog>
|
||||||
</VnRow>
|
</VnRow>
|
||||||
|
<VnRow>
|
||||||
|
<VnInputNumber
|
||||||
|
:label="t('Longitude')"
|
||||||
|
clearable
|
||||||
|
v-model="data.longitude"
|
||||||
|
:decimal-places="7"
|
||||||
|
:positive="false"
|
||||||
|
/>
|
||||||
|
<VnInputNumber
|
||||||
|
:label="t('Latitude')"
|
||||||
|
clearable
|
||||||
|
v-model="data.latitude"
|
||||||
|
:decimal-places="7"
|
||||||
|
:positive="false"
|
||||||
|
/>
|
||||||
|
</VnRow>
|
||||||
</template>
|
</template>
|
||||||
</FormModel>
|
</FormModel>
|
||||||
</template>
|
</template>
|
||||||
|
@ -175,4 +192,6 @@ es:
|
||||||
Mobile: Movíl
|
Mobile: Movíl
|
||||||
Incoterms: Incoterms
|
Incoterms: Incoterms
|
||||||
Customs agent: Agente de aduanas
|
Customs agent: Agente de aduanas
|
||||||
|
Longitude: Longitud
|
||||||
|
Latitude: Latitud
|
||||||
</i18n>
|
</i18n>
|
||||||
|
|
Loading…
Reference in New Issue