本文整理汇总了TypeScript中client/actions/edit/sectionActions.onInsertBlockquote函数的典型用法代码示例。如果您正苦于以下问题:TypeScript onInsertBlockquote函数的具体用法?TypeScript onInsertBlockquote怎么用?TypeScript onInsertBlockquote使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了onInsertBlockquote函数的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: it
it("Can handle blockquotes with before and after sections", () => {
getState = jest.fn(() => ({
edit: { article, sectionIndex: 0 },
}))
onInsertBlockquote(blockquoteHtml, beforeHtml, afterHtml)(
dispatch,
getState
)
dispatch.mock.calls[0][0](dispatch, getState)
const afterSection = dispatch.mock.calls[1][0]
expect(afterSection.type).toBe("NEW_SECTION")
expect(afterSection.payload.sectionIndex).toBe(1)
expect(afterSection.payload.section.type).toBe("text")
expect(afterSection.payload.section.body).toBe(afterHtml)
const beforeSection = dispatch.mock.calls[2][0]
expect(beforeSection.type).toBe("NEW_SECTION")
expect(beforeSection.payload.sectionIndex).toBe(0)
expect(beforeSection.payload.section.type).toBe("text")
expect(beforeSection.payload.section.body).toBe(beforeHtml)
sectionOnSet = dispatch.mock.calls[3][0]
expect(sectionOnSet.type).toBe("SET_SECTION")
expect(sectionOnSet.payload.sectionIndex).toBe(null)
const changeSection = dispatch.mock.calls[4][0]
expect(changeSection.type).toBe("CHANGE_SECTION")
expect(changeSection.payload.key).toBe("body")
expect(changeSection.payload.value).toBe(blockquoteHtml)
})