本文整理汇总了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)
})
开发者ID:joeyAghion,项目名称:positron,代码行数:31,代码来源:sectionActions.test.ts
注:本文中的client/actions/edit/sectionActions.onInsertBlockquote函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论