File tree Expand file tree Collapse file tree
packages/components/src/internal/components/search Expand file tree Collapse file tree Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1+ import React from 'react' ;
2+ import { render } from '@testing-library/react' ;
3+
4+ import { FindAndSearchDropdown } from './FindAndSearchDropdown' ;
5+
6+ describe ( 'FindAndSearchDropdown' , ( ) => {
7+ test ( 'search but no find' , ( ) => {
8+ render ( < FindAndSearchDropdown title = "Test title" onSearch = { jest . fn } /> ) ;
9+ expect ( document . querySelector ( '.dropdown-toggle' ) ) . toHaveTextContent ( 'Test title' ) ;
10+ const items = document . querySelectorAll ( '.lk-menu-item' ) ;
11+ expect ( items ) . toHaveLength ( 2 ) ;
12+ expect ( items [ 0 ] ) . toHaveTextContent ( 'Sample Finder' ) ;
13+ expect ( items [ 1 ] ) . toHaveTextContent ( 'Search' ) ;
14+ expect ( document . querySelector ( '.modal' ) ) . not . toBeInTheDocument ( ) ;
15+ } ) ;
16+
17+ test ( 'find but no search' , ( ) => {
18+ render ( < FindAndSearchDropdown title = "Test title" findNounPlural = "tests" onFindByIds = { jest . fn } /> ) ;
19+ const items = document . querySelectorAll ( '.lk-menu-item' ) ;
20+ expect ( items ) . toHaveLength ( 3 ) ;
21+ expect ( items [ 0 ] ) . toHaveTextContent ( 'Find Tests by Barcode' ) ;
22+ expect ( items [ 1 ] ) . toHaveTextContent ( 'Find Tests by ID' ) ;
23+ expect ( items [ 2 ] ) . toHaveTextContent ( 'Sample Finder' ) ;
24+ } ) ;
25+ } ) ;
You can’t perform that action at this time.
0 commit comments