diff --git a/ui/src/Components/Grid/AlertGrid/AlertGroup/GroupFooter/__snapshots__/index.test.js.snap b/ui/src/Components/Grid/AlertGrid/AlertGroup/GroupFooter/__snapshots__/index.test.js.snap index c96e4818a..1b65c5415 100644 --- a/ui/src/Components/Grid/AlertGrid/AlertGroup/GroupFooter/__snapshots__/index.test.js.snap +++ b/ui/src/Components/Grid/AlertGrid/AlertGroup/GroupFooter/__snapshots__/index.test.js.snap @@ -288,61 +288,57 @@ exports[` mathes snapshot when silence is rendered 1`] = `
-
-
-
-
-
-
- - - - -
-
- - - - - Mocked Silence - - - … - - - - - me@example.com - - - Expired - - - -
-
-
+
+
+
+ + + + +
+
+ + + + + Mocked Silence + + + … + + +
+
+
+
+ + — me@example.com + + + Expired + +
{ +const SilenceComment = ({ + silence, + collapsed, + collapseToggle, + afterUpdate +}) => { const commentBody = ( {silence.comment} @@ -26,25 +33,35 @@ const SilenceComment = ({ silence, collapsed, afterUpdate }) => { ); return ( -
-
- + +
+
+ +
+
{comment}
-
- {comment} - - - {silence.createdBy} - +
+
+ + — {silence.createdBy} + {collapsed ? : null} - +
+
+ +
-
+
); }; SilenceComment.propTypes = { silence: APISilence.isRequired, - collapsed: PropTypes.bool.isRequired + collapsed: PropTypes.bool.isRequired, + collapseToggle: PropTypes.func.isRequired }; export { SilenceComment }; diff --git a/ui/src/Components/ManagedSilence/SilenceComment.test.js b/ui/src/Components/ManagedSilence/SilenceComment.test.js index 6cf31d977..0a0192da7 100644 --- a/ui/src/Components/ManagedSilence/SilenceComment.test.js +++ b/ui/src/Components/ManagedSilence/SilenceComment.test.js @@ -18,8 +18,16 @@ afterEach(() => { fetch.resetMocks(); }); +const CollapseMock = jest.fn(); + const MountedSilenceComment = collapsed => { - return mount(); + return mount( + + ); }; describe("", () => { @@ -46,4 +54,11 @@ describe("", () => { const tree = MountedSilenceComment(false); expect(tree.find("a[href='http://localhost/1234']")).toHaveLength(1); }); + + it("collapseToggle is called when collapse icon is clicked", () => { + const tree = MountedSilenceComment(true); + const collapse = tree.find("svg.fa-chevron-up"); + collapse.simulate("click"); + expect(CollapseMock).toHaveBeenCalled(); + }); }); diff --git a/ui/src/Components/ManagedSilence/__snapshots__/SilenceComment.test.js.snap b/ui/src/Components/ManagedSilence/__snapshots__/SilenceComment.test.js.snap index 754ad97fc..527b619a0 100644 --- a/ui/src/Components/ManagedSilence/__snapshots__/SilenceComment.test.js.snap +++ b/ui/src/Components/ManagedSilence/__snapshots__/SilenceComment.test.js.snap @@ -32,17 +32,35 @@ exports[` Matches snapshot when collapsed 1`] = ` … - - - me@example.com - - - Expired - - +
+
+
+
+ + — me@example.com + + Expired + + +
+
+ + + +
" @@ -80,12 +98,30 @@ exports[` Matches snapshot when expanded 1`] = ` … - - - me@example.com - +
+
+
+
+ + — me@example.com
+
+ + + + +
" `; diff --git a/ui/src/Components/ManagedSilence/__snapshots__/index.test.js.snap b/ui/src/Components/ManagedSilence/__snapshots__/index.test.js.snap index 589bed245..4f93d7109 100644 --- a/ui/src/Components/ManagedSilence/__snapshots__/index.test.js.snap +++ b/ui/src/Components/ManagedSilence/__snapshots__/index.test.js.snap @@ -3,71 +3,67 @@ exports[` matches snapshot when collapsed 1`] = ` "
-
-
-
-
-
-
- - - - -
-
- - - - - Mocked Silence - - - … - - - - - me@example.com - - - Expires - -
-
-
-
-
-
+
+
+
+ + + + +
+
+ + + + + Mocked Silence + + + … + + +
+
+
+
+ + — me@example.com + + + Expires + +
+
-
+
matches snapshot when collapsed 1`] = ` exports[` matches snapshot with expaned details 1`] = ` "
-
-
-
-
-
-
- - - - -
-
- - - - - Mocked Silence - - - … - - - - - me@example.com - - -
-
-
+
+
+
+ + + + +
+
+ + + + + Mocked Silence + + + … + + +
+
+
+
+ + — me@example.com +
-
-
-
-
- -
-
-
- -
-
+
+
{this.collapse.value ? null : ( diff --git a/ui/src/Components/ManagedSilence/index.scss b/ui/src/Components/ManagedSilence/index.scss index abc275c3e..8f44f7679 100644 --- a/ui/src/Components/ManagedSilence/index.scss +++ b/ui/src/Components/ManagedSilence/index.scss @@ -12,3 +12,7 @@ border-left-color: $gray-700; } } + +.components-managed-silence-cite { + font-size: 85%; +}