Skip to content

Commit d4781c9

Browse files
authored
Merge pull request #1064 from Sysvale/hotfix/progress-bar-alignment-11071333345092221231
Fix ProgressBar alignment and spacing in aside mode
2 parents 5fd54d8 + 897fa9a commit d4781c9

5 files changed

Lines changed: 39 additions & 7 deletions

File tree

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@sysvale/cuida",
3-
"version": "3.154.7",
3+
"version": "3.154.8",
44
"description": "A design system built by Sysvale, using storybook and Vue components",
55
"repository": {
66
"type": "git",

src/components/ProgressBar.vue

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
11
<template>
22
<div
33
class="progress-bar"
4-
:class="textLeft ? 'progress-bar__left' : ''"
4+
:class="[
5+
textLeft && !textAside ? 'progress-bar__left' : '',
6+
textAside ? 'progress-bar--aside' : '',
7+
]"
58
>
69
<span
710
v-if="showText"
811
class="progress-bar__text"
12+
:class="textAside ? 'progress-bar__text--aside' : ''"
913
>
1014
<!-- @slot Slot padrão da progressBar. Pode ser utilizado para sobrescrever o valor de progresso. -->
1115
<slot>
@@ -132,6 +136,10 @@ watch(() => props.value, () => {
132136
display: flex;
133137
flex-direction: v-bind(textDirection);
134138
139+
&--aside {
140+
gap: 4px;
141+
}
142+
135143
&__content {
136144
background-color: tokens.$n-40;
137145
border-radius: tokens.$border-radius-extra-large;
@@ -150,7 +158,7 @@ watch(() => props.value, () => {
150158
151159
&__text--aside {
152160
font-weight: tokens.$font-weight-semibold;
153-
margin: tokens.ml(3);
161+
margin: 0 !important;
154162
}
155163
156164
&__text {

src/tests/DateInput.spec.js

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,18 @@
1-
import { describe, test, expect, beforeEach, vi } from 'vitest';
1+
import { describe, test, expect, beforeEach, afterEach, vi } from 'vitest';
22
import { mount } from '@vue/test-utils';
33
import DateInput from '../components/DateInput.vue'; // Ajuste o caminho conforme necessário
44
import CdsBaseInput from '../components/BaseInput.vue';
5-
import { DateTime } from 'luxon';
5+
import { DateTime, Settings } from 'luxon';
66

77
describe('DateInput', () => {
88
let wrapper;
99

1010
beforeEach(() => {
11+
vi.useFakeTimers();
12+
const mockDate = new Date(2026, 1, 1);
13+
vi.setSystemTime(mockDate);
14+
Settings.now = () => mockDate.getTime();
15+
1116
wrapper = mount(DateInput, {
1217
props: {
1318
label: 'Selecione uma data',
@@ -17,6 +22,11 @@ describe('DateInput', () => {
1722
});
1823
});
1924

25+
afterEach(() => {
26+
vi.useRealTimers();
27+
Settings.now = () => Date.now();
28+
});
29+
2030
test('renders correctly', () => {
2131
expect(wrapper.html()).toMatchSnapshot();
2232
});

src/tests/ProgressBar.spec.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,4 +47,18 @@ describe('ProgressBar', () => {
4747

4848
expect(wrapper.html()).toMatchSnapshot();
4949
});
50+
51+
test('applies aside classes when textAside is true', async () => {
52+
const wrapper = mount(ProgressBar, {
53+
props: {
54+
value: 0.5,
55+
showText: true,
56+
textAside: true,
57+
},
58+
});
59+
60+
const textElement = wrapper.find('.progress-bar__text');
61+
expect(textElement.classes()).toContain('progress-bar__text--aside');
62+
expect(wrapper.classes()).toContain('progress-bar--aside');
63+
});
5064
});

0 commit comments

Comments
 (0)