Skip to content

Commit ece8e8a

Browse files
committed
FindAndSearchDropdown.test.tsx - Convert from spec file
1 parent b3cac13 commit ece8e8a

2 files changed

Lines changed: 25 additions & 50 deletions

File tree

packages/components/src/internal/components/search/FindAndSearchDropdown.spec.tsx

Lines changed: 0 additions & 50 deletions
This file was deleted.
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
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+
});

0 commit comments

Comments
 (0)