-
Notifications
You must be signed in to change notification settings - Fork 8.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
Showing
8 changed files
with
248 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 47 additions & 0 deletions
47
...security_solution/public/detections/pages/detection_engine/rules/all/tag_display.test.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
import React from 'react'; | ||
import { mount, ReactWrapper } from 'enzyme'; | ||
|
||
import { TagsDisplay } from './tag_display'; | ||
import { TestProviders } from '../../../../../common/mock'; | ||
import { waitFor } from '@testing-library/react'; | ||
|
||
const mockTags = ['Elastic', 'Endpoint', 'Data Protection', 'ML', 'Continuous Monitoring']; | ||
|
||
describe('When tag display loads', () => { | ||
let wrapper: ReactWrapper; | ||
beforeEach(() => { | ||
wrapper = mount( | ||
<TestProviders> | ||
<TagsDisplay tags={mockTags} /> | ||
</TestProviders> | ||
); | ||
}); | ||
it('visibly renders 3 initial tags', () => { | ||
for (let i = 0; i < 3; i++) { | ||
expect(wrapper.exists(`[data-test-subj="rules-table-column-tags-${i}"]`)).toBeTruthy(); | ||
} | ||
}); | ||
describe("when the 'see all' button is clicked", () => { | ||
beforeEach(() => { | ||
const seeAllButton = wrapper.find('[data-test-subj="tags-display-popover-button"] button'); | ||
seeAllButton.simulate('click'); | ||
}); | ||
it('renders all the tags in the popover', async () => { | ||
await waitFor(() => { | ||
wrapper.update(); | ||
expect(wrapper.exists('[data-test-subj="tags-display-popover"]')).toBeTruthy(); | ||
for (let i = 0; i < mockTags.length; i++) { | ||
expect( | ||
wrapper.exists(`[data-test-subj="rules-table-column-popover-tags-${i}"]`) | ||
).toBeTruthy(); | ||
} | ||
}); | ||
}); | ||
}); | ||
}); |
Oops, something went wrong.