mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 01:38:56 -04:00
[Fleet] Fix tag creation (#138603)
This commit is contained in:
parent
b0cd6f7079
commit
cee2689116
2 changed files with 22 additions and 1 deletions
|
@ -108,6 +108,27 @@ describe('TagsAddRemove', () => {
|
|||
);
|
||||
});
|
||||
|
||||
it('should show allow to add new tag when agent do not have any tags', () => {
|
||||
allTags = [];
|
||||
selectedTags = [];
|
||||
const result = renderComponent('agent1');
|
||||
const searchInput = result.getByTestId('addRemoveTags');
|
||||
|
||||
fireEvent.input(searchInput, {
|
||||
target: { value: 'tag' },
|
||||
});
|
||||
|
||||
fireEvent.click(result.getByTestId('createTagBtn'));
|
||||
|
||||
expect(mockUpdateTags).toHaveBeenCalledWith(
|
||||
'agent1',
|
||||
['tag'],
|
||||
expect.anything(),
|
||||
'Tag created',
|
||||
'Tag creation failed'
|
||||
);
|
||||
});
|
||||
|
||||
it('should add new tag when not found in search and button clicked', () => {
|
||||
const result = renderComponent('agent1');
|
||||
const searchInput = result.getByRole('combobox');
|
||||
|
|
|
@ -212,7 +212,7 @@ export const TagsAddRemove: React.FC<Props> = ({
|
|||
</Fragment>
|
||||
)}
|
||||
</EuiSelectable>
|
||||
{!isExactMatch && labels.length && searchValue !== '' ? createTagButton : null}
|
||||
{(!isExactMatch || labels.length === 0) && searchValue !== '' ? createTagButton : null}
|
||||
</EuiWrappingPopover>
|
||||
</>
|
||||
);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue