Skip to content

feat(blend-percentage-visibility): hide percentage field for non-blend beans#1106

Merged
graphefruit merged 5 commits intographefruit:developfrom
silasg:feature/blend-percentage-visibility
Apr 3, 2026
Merged

feat(blend-percentage-visibility): hide percentage field for non-blend beans#1106
graphefruit merged 5 commits intographefruit:developfrom
silasg:feature/blend-percentage-visibility

Conversation

@silasg
Copy link
Copy Markdown
Contributor

@silasg silasg commented Mar 31, 2026

Summary

Hide the blend percentage field in bean information when the bean is not a blend. The percentage field now requires both conditions to be visible:

  1. settings.bean_manage_parameters.percentage is enabled
  2. Bean mix type is BLEND

Changes

  • Edit/Add template: Added && isBlend() to percentage @if guard
  • Detail template: Added && isBean(data) && data.beanMix.toString() === 'BLEND'' to percentage @if` guard
  • Test infrastructure: Established project-wide src/test-utils/, consolidated spec file locations into __tests__/ folders
  • Tests: Added first DOM-level component tests verifying percentage field visibility for BLEND vs non-BLEND beans

silasg added 3 commits March 31, 2026 07:20
…c locations

- Move generic mock factories from aiBeanImport/test-utils to src/test-utils
- Move generic bean helpers to src/test-utils/bean-test-helpers.ts
- Rename misnamed data factories: createMockBean -> createBean,
  createMockBeanParams -> createBeanParams, createMockSettings -> createSettings,
  createMockExamples -> createExamples
- Move 3 colocated specs into __tests__/ folders for consistency
- Keep AI-specific helpers in aiBeanImport/test-utils
- Update all affected imports
- Add template rendering tests for blend percentage visibility feature
- BeanSortInformationComponent: 4 tests (create + 3 visibility scenarios)
- BeanDetailSortInformationComponent: 5 tests (create + 3 visibility + GreenBean)
- Add createMockUISettingsStorage and createMockUIBeanHelper factories
- First DOM-level component tests in the project
- Add isBlend() condition to percentage @if guard in edit/add template
- Add isBean() + BLEND check to percentage @if guard in detail template
- Percentage field now only visible when bean mix is BLEND and setting enabled
@silasg
Copy link
Copy Markdown
Contributor Author

silasg commented Mar 31, 2026

Oh wait, I wanted to make this a PR in my own fork for final review before I open that PR. Stupid me! If it is ok for you @graphefruit I will leave it here open and let you know if I think it is ready for review by you.

…iew feedback

- Extract isBlend() on detail component encapsulating isBean() type guard + BLEND check
- Replace inline blend checks in detail template with isBlend()
- Remove redundant smoke tests from both component specs
- Revert Prettier-induced line break changes in ai-field-prompts.spec.ts
@silasg
Copy link
Copy Markdown
Contributor Author

silasg commented Mar 31, 2026

@graphefruit so far, I am done. Please have a look.

…beanFunctionPipe

Use pipe-based template evaluation instead of direct method calls to avoid
triggering evaluation on every change detection cycle (upstream review feedback).

- Add Bean.isBlend() method
- Add IS_BLEND to BEAN_FUNCTION_PIPE_ENUM and beanFunctionPipe
- Widen pipe input type to Bean | GreenBean with instanceof guard
- Replace all isBlend() template calls with pipe usage in both
  bean-sort-information and bean-detail-sort-information components
- Remove component-level isBlend() and isBean() methods
@silasg silasg requested a review from graphefruit April 3, 2026 07:57
@graphefruit
Copy link
Copy Markdown
Owner

Thanks for the changes. Merged

@graphefruit graphefruit merged commit df04df3 into graphefruit:develop Apr 3, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants