Conversation
- Implement 'required' prop in ColorPicker component. - Display CdsRequiredIndicator when 'required' is true. - Add label and required indicator to popover mode for consistency. - Update documentation and components metadata. - Add unit test for the required indicator. - Bump version to 3.154.9. Co-authored-by: lucasn4s <17988272+lucasn4s@users.noreply.github.com>
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
Greptile SummaryEste PR adiciona a prop
Confidence Score: 3/5
|
| Filename | Overview |
|---|---|
| src/components/ColorPicker.vue | Adiciona a prop required e o CdsRequiredIndicator em ambos os modos (inline e popover). A adição da label no modo popover é uma mudança comportamental que pode afetar implementações existentes. |
| src/tests/ColorPicker.spec.ts | Adiciona teste para verificar a renderização do CdsRequiredIndicator, mas cobre apenas o modo popover. O modo inline não é testado para o novo comportamento. |
| src/tests/snapshots/ColorPicker.spec.ts.snap | Snapshot atualizado corretamente para refletir a adição do comentário <!--v-if--> do CdsRequiredIndicator no modo inline. |
| docs/components/forms/color-picker.md | Documentação atualizada corretamente: prop required adicionada ao playground de ambos os modos (inline e popover), e label incluída nos args do modo popover. |
| docs/.docgen/components-metadata.json | Metadados do componente atualizados corretamente com a nova prop required (tipo boolean, padrão false). |
| package.json | Versão incrementada de 3.154.8 para 3.154.9 (patch bump). |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[CdsColorPicker] --> B{inline?}
B -- true --> C[Renderiza label div\ncom CdsRequiredIndicator]
B -- false --> D[Renderiza label div\ncom CdsRequiredIndicator\n⚠️ NOVO COMPORTAMENTO]
C --> E{required?}
D --> E
E -- true --> F[Exibe asterisco\nCdsRequiredIndicator]
E -- false --> G[Oculta asterisco\nv-if=false]
C --> H[Renderiza swatches\nem modo inline]
D --> I[Renderiza CdsPopover\ncom swatches]
Last reviewed commit: 7d318fc
| test('renders the required indicator when the required prop is true', async () => { | ||
| const wrapper = mount(ColorPicker, { | ||
| props: { | ||
| modelValue: '#000000', | ||
| required: true, | ||
| }, | ||
| }); | ||
|
|
||
| const requiredIndicator = wrapper.findComponent({ name: 'CdsRequiredIndicator' }); | ||
| expect(requiredIndicator.exists()).toBe(true); | ||
| }); |
There was a problem hiding this comment.
Teste cobre apenas o modo popover
O novo teste verifica a renderização do CdsRequiredIndicator somente no modo popover (sem inline: true). Como o CdsRequiredIndicator é renderizado em dois blocos distintos do template (modo inline e modo popover), seria importante adicionar um teste que cubra o modo inline também, garantindo que o indicador aparece corretamente em ambos os contextos.
| test('renders the required indicator when the required prop is true', async () => { | |
| const wrapper = mount(ColorPicker, { | |
| props: { | |
| modelValue: '#000000', | |
| required: true, | |
| }, | |
| }); | |
| const requiredIndicator = wrapper.findComponent({ name: 'CdsRequiredIndicator' }); | |
| expect(requiredIndicator.exists()).toBe(true); | |
| }); | |
| test('renders the required indicator when the required prop is true', async () => { | |
| const wrapper = mount(ColorPicker, { | |
| props: { | |
| modelValue: '#000000', | |
| required: true, | |
| }, | |
| }); | |
| const requiredIndicator = wrapper.findComponent({ name: 'CdsRequiredIndicator' }); | |
| expect(requiredIndicator.exists()).toBe(true); | |
| }); | |
| test('renders the required indicator in inline mode when the required prop is true', async () => { | |
| const wrapper = mount(ColorPicker, { | |
| props: { | |
| modelValue: '#000000', | |
| inline: true, | |
| required: true, | |
| swatch: [], | |
| }, | |
| }); | |
| const requiredIndicator = wrapper.findComponent({ name: 'CdsRequiredIndicator' }); | |
| expect(requiredIndicator.exists()).toBe(true); | |
| }); |
There was a problem hiding this comment.
O teste foi ajustado para incluir inline: true, garantindo que o indicador de obrigatório seja renderizado corretamente no modo inline. Além disso, adicionei um novo caso de teste para verificar que o indicador NÃO é renderizado no modo popover, conforme o comportamento acordado.
- Implement 'required' prop in ColorPicker component. - Display CdsRequiredIndicator when 'required' is true (inline mode only). - Update documentation and components metadata. - Add unit test for the required indicator. - Remove unnecessary label from popover mode based on PR feedback. - Bump version to 3.154.9. Co-authored-by: lucasn4s <17988272+lucasn4s@users.noreply.github.com>
- Implement 'required' prop in ColorPicker component. - Display CdsRequiredIndicator when 'required' is true (inline mode only). - Update documentation and components metadata. - Add unit tests for the required indicator (positive and negative cases). - Bump version to 3.154.9. Co-authored-by: lucasn4s <17988272+lucasn4s@users.noreply.github.com>
This PR adds the
requiredprop to theColorPickercomponent.Key changes:
ColorPicker.vueto accept therequiredprop and render theCdsRequiredIndicatorasterisk.src/utils/components-metadata.jsonanddocs/components/forms/color-picker.mdto document and demonstrate the new prop in the playground.src/tests/ColorPicker.spec.tsto verify the rendering of the indicator.3.154.9.Fixes #1066
PR created automatically by Jules for task 17980275884316675972 started by @lucasn4s