diff --git a/ui/src/Components/Grid/AlertGrid/AlertGroup/Annotation/index.test.js b/ui/src/Components/Grid/AlertGrid/AlertGroup/Annotation/index.test.js index ed1edbbad..31a3bfa67 100644 --- a/ui/src/Components/Grid/AlertGrid/AlertGroup/Annotation/index.test.js +++ b/ui/src/Components/Grid/AlertGrid/AlertGroup/Annotation/index.test.js @@ -59,6 +59,18 @@ const MountedNonLinkAnnotation = visible => { ); }; +const MountedNonLinkAnnotationContainingLink = visible => { + return mount( + + ); +}; + describe("", () => { it("matches snapshot when visible=true", () => { const tree = ShallowNonLinkAnnotation(true); @@ -80,6 +92,12 @@ describe("", () => { expect(tree.html()).not.toMatch(/some long text/); }); + it("links inside annotation are rendered as a.href", () => { + const tree = MountedNonLinkAnnotationContainingLink(true); + const link = tree.find("a[href='http://example.com']"); + expect(link.text()).toBe("http://example.com"); + }); + it("clicking on + icon hides the value", () => { const tree = MountedNonLinkAnnotation(true); expect(tree.html()).toMatch(/fa-search-minus/); @@ -89,6 +107,13 @@ describe("", () => { expect(tree.html()).not.toMatch(/some long text/); }); + it("clicking on a link inside annotation doesn't hide the value", () => { + const tree = MountedNonLinkAnnotationContainingLink(true); + expect(tree.html()).toMatch(/fa-search-minus/); + tree.find("a").simulate("click"); + expect(tree.html()).toMatch(/fa-search-minus/); + }); + it("clicking on - icon shows the value", () => { const tree = MountedNonLinkAnnotation(false); expect(tree.html()).toMatch(/fa-search-plus/);