langflow/src/frontend/tests/core/unit
Lucas Oliveira 95ceb52fa3
feat: add new Tab input (#7032)
* Added TabMixin

* Added Tab component on inputs

* Added Tab component to initializations

* Added tests for tab input

* Added Tab Component type

* Added options and active tab to input field type

* Added tab component on frontend

* Instantiate tab component

* Update package lock

* Refactor input classes and imports for consistency

- Reordered imports to maintain consistency across files.
- Simplified class definitions by removing unnecessary line breaks.
- Updated the `__all__` list in `__init__.py` files to include `TableInput` consistently.
- Adjusted test cases for cleaner syntax without altering functionality.

* Add constants for tab options limits in input mixin

- Introduced `MAX_TAB_OPTIONS` and `MAX_TAB_OPTION_LENGTH` constants for better maintainability.
- Updated validation logic in `TabMixin` to use these constants for clearer and more flexible error messages.

* Refactor tab input validation tests for improved clarity

- Replaced individual test cases for invalid tab inputs with a parameterized test function.
- Enhanced test coverage by including cases for too many options, exceeding character limits, and non-string values.
- Improved documentation within the test function for better understanding of validation scenarios.

* Enhance tab input validation tests with parameterization

- Refactored `test_tab_input_valid` to use `pytest.mark.parametrize` for improved test coverage and clarity.
- Included multiple scenarios for valid tab inputs, such as standard, fewer options, and empty options.
- Updated assertions to reflect the expected outcomes based on parameterized inputs.

* Enhance TabInput validation to ensure value is a string and one of the specified options

- Updated the `validate_value` method to enforce that the input value is a string.
- Added a check to validate that the value is among the allowed options, raising a ValueError with a descriptive message if not.
- Improved error handling for better user feedback on invalid inputs.

* Fix optional chaining in error handling within CodeAreaModal

- Updated the error check in the `delayedFunction` to use optional chaining for safer access to the error detail.
- This change ensures that the code handles cases where `detail` may be undefined, improving robustness.

* Add 'TAB' field type to schema and update direct types list

- Included 'TAB' as a valid field type in the schema conversion dictionary.
- Updated the DIRECT_TYPES list to include 'tab', ensuring consistency across type definitions.
- These changes enhance the flexibility of the input handling for tab components.

* Add unit test

* Re-added noqa

* fix: unit tests

* [autofix.ci] apply automated fixes

---------

Co-authored-by: Gabriel Luiz Freitas Almeida <gabriel@langflow.org>
Co-authored-by: italojohnny <italojohnnydosanjos@gmail.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2025-03-17 14:10:48 +00:00
..
chatInputOutput.spec.ts feat: Quality of Life improvements for Astra Component (#6953) 2025-03-14 22:34:14 +00:00
codeAreaModalComponent.spec.ts test: Add utility functions to streamline test setup and improve maintainability (#5168) 2024-12-09 20:30:56 +00:00
dropdownComponent.spec.ts test: Add utility functions to streamline test setup and improve maintainability (#5168) 2024-12-09 20:30:56 +00:00
fileUploadComponent.spec.ts refactor(components): Rename Parse Data component to Data to Message (#5547) 2025-01-22 12:22:53 +00:00
floatComponent.spec.ts Refactor: Remove unused imports across multiple frontend components (#6232) 2025-02-18 19:51:38 +00:00
inputComponent.spec.ts test: Add utility functions to streamline test setup and improve maintainability (#5168) 2024-12-09 20:30:56 +00:00
inputListComponent.spec.ts refactor: Enhance InputList Component UI/UX (#5726) 2025-01-20 13:25:55 +00:00
intComponent.spec.ts refactor: update ReactFlow to v12 (#5317) 2024-12-18 19:40:13 +00:00
keyPairListComponent.spec.ts refactor: update ReactFlow to v12 (#5317) 2024-12-18 19:40:13 +00:00
linkComponent.spec.ts test: Add utility functions to streamline test setup and improve maintainability (#5168) 2024-12-09 20:30:56 +00:00
nestedComponent.spec.ts feat(component): API Request Component Overhaul (#5007) 2025-01-20 16:23:59 +00:00
promptModalComponent.spec.ts test: Add utility functions to streamline test setup and improve maintainability (#5168) 2024-12-09 20:30:56 +00:00
sliderComponent.spec.ts feat: Enhance FlowMenu name editing experience (#5729) 2025-01-20 19:41:49 +00:00
tabComponent.spec.ts feat: add new Tab input (#7032) 2025-03-17 14:10:48 +00:00
tableInputComponent.spec.ts fix: handle null and boolean correctly on table parameter (#6722) 2025-02-24 21:33:34 +00:00
textAreaModalComponent.spec.ts test: Add utility functions to streamline test setup and improve maintainability (#5168) 2024-12-09 20:30:56 +00:00
toggleComponent.spec.ts test: Add utility functions to streamline test setup and improve maintainability (#5168) 2024-12-09 20:30:56 +00:00
webhookComponent.spec.ts feat: Enhance Webhook component (#6313) 2025-03-10 13:10:55 +00:00