Skip to content
This repository has been archived by the owner on May 24, 2024. It is now read-only.

Commit

Permalink
[terra-form-select-combobox] Added no results found text in combobox (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
KV106606Viswanath authored Nov 6, 2023
1 parent dcedec7 commit 39eb9b2
Show file tree
Hide file tree
Showing 57 changed files with 16 additions and 2 deletions.
3 changes: 3 additions & 0 deletions packages/terra-form-select/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

## Unreleased

* Added
* Added No results found text in `terra-form-select-combobox`.

## 6.49.0 - (October 23, 2023)

* Changed
Expand Down
10 changes: 8 additions & 2 deletions packages/terra-form-select/src/combobox/Menu.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import ClearOption from '../shared/_ClearOption';
import MenuUtil from '../shared/_MenuUtil';
import SharedUtil from '../shared/_SharedUtil';
import styles from '../shared/_Menu.module.scss';
import NoResults from '../shared/_NoResults';

const cx = classNamesBind.bind(styles);

Expand Down Expand Up @@ -119,16 +120,21 @@ class Menu extends React.Component {
*/
static getDerivedStateFromProps(props, state) {
const {
clearOptionDisplay, searchValue,
clearOptionDisplay, searchValue, noResultContent,
} = props;

const hasNoResults = false;
let hasNoResults = false;
const hasMaxSelection = false;
let hasAddOption = false;

let children = MenuUtil.filter(props.children, props.searchValue, props.optionFilter);
children = MenuUtil.updateSelectionState(children, props);

if (!children.length) {
children.push(<NoResults noResultContent={noResultContent} value={searchValue} />);
hasNoResults = true;
}

if (Menu.shouldAllowFreeText(props, children)) {
children.push(<AddOption value={searchValue} />);
hasAddOption = true;
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions packages/terra-form-select/tests/wdio/select-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -536,6 +536,11 @@ Terra.describeViewports('Select', ['tiny'], () => {
Terra.validates.element('[combobox-spacebar]open-dropdown', { selector: '#root' });
});

it('should display no results on search', () => {
$('[data-terra-select] input').setValue('John');
Terra.validates.element('combobox no results displayed on search', { selector: '#root' });
});

after(() => {
// remove backspace that is added to the input. Bug logged here: https://github.com/cerner/terra-core/issues/2414
browser.keys('Backspace');
Expand Down

0 comments on commit 39eb9b2

Please sign in to comment.