本文整理匯總了TypeScript中@nteract/actions.moveCell函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript moveCell函數的具體用法?TypeScript moveCell怎麽用?TypeScript moveCell使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了moveCell函數的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: test
test("should move a cell above another when asked", () => {
const originalState = reducers(
initialDocument.set("notebook", fixtureCommutable),
actions.createCellBelow({
id: fixtureCommutable.get("cellOrder").first(),
cellType: "markdown",
source: "# Woo\n*Yay*"
})
);
const cellOrder = originalState.getIn(["notebook", "cellOrder"]);
const state = reducers(
originalState,
actions.moveCell({
id: cellOrder.get(0),
destinationId: cellOrder.get(1),
above: false
})
);
expect(state.getIn(["notebook", "cellOrder"]).toJS()).toEqual([
cellOrder.get(1),
cellOrder.get(0),
cellOrder.get(2)
]);
const state2 = reducers(
originalState,
actions.moveCell({
id: cellOrder.get(0),
destinationId: cellOrder.get(1),
above: true
})
);
expect(state2.getIn(["notebook", "cellOrder"]).toJS()).toEqual([
cellOrder.get(0),
cellOrder.get(1),
cellOrder.get(2)
]);
});