diff --git a/src/core/client/stream/containers/ReplyCommentFormContainer.spec.tsx b/src/core/client/stream/containers/ReplyCommentFormContainer.spec.tsx index ed6c42b7c..3b3c30096 100644 --- a/src/core/client/stream/containers/ReplyCommentFormContainer.spec.tsx +++ b/src/core/client/stream/containers/ReplyCommentFormContainer.spec.tsx @@ -22,8 +22,7 @@ function getContextKey(commentID: string) { it("renders correctly", async () => { const props: PropTypesOf = { - // tslint:disable-next-line:no-empty - createComment: (() => {}) as any, + createComment: noop as any, asset: { id: "asset-id", }, @@ -42,8 +41,7 @@ it("renders correctly", async () => { it("renders with initialValues", async () => { const props: PropTypesOf = { - // tslint:disable-next-line:no-empty - createComment: (() => {}) as any, + createComment: noop as any, asset: { id: "asset-id", }, @@ -67,8 +65,7 @@ it("renders with initialValues", async () => { it("save values", async () => { const props: PropTypesOf = { - // tslint:disable-next-line:no-empty - createComment: (() => {}) as any, + createComment: noop as any, asset: { id: "asset-id", }, @@ -104,7 +101,6 @@ it("creates a comment", async () => { const onCloseStub = sinon.stub(); const props: PropTypesOf = { - // tslint:disable-next-line:no-empty createComment: createCommentStub, asset: { id: "asset-id", @@ -143,8 +139,7 @@ it("creates a comment", async () => { it("closes on cancel", async () => { const onCloseStub = sinon.stub(); const props: PropTypesOf = { - // tslint:disable-next-line:no-empty - createComment: (() => {}) as any, + createComment: noop as any, asset: { id: "asset-id", }, @@ -174,3 +169,28 @@ it("closes on cancel", async () => { await props.pymSessionStorage.getItem(getContextKey(props.comment.id)) ).toBeNull(); }); + +it("autofocuses", async () => { + const focusStub = sinon.stub(); + const rte = { focus: focusStub }; + const props: PropTypesOf = { + createComment: noop as any, + asset: { + id: "asset-id", + }, + comment: { + id: "comment-id", + }, + pymSessionStorage: createFakePymStorage(), + autofocus: true, + }; + + const wrapper = shallow(); + await timeout(); + wrapper.update(); + wrapper + .findWhere(n => n.prop("rteRef")) + .props() + .rteRef(rte); + expect(focusStub.calledOnce).toBe(true); +});