本文整理匯總了TypeScript中models/tools/toolbar_base.ToolbarBase類的典型用法代碼示例。如果您正苦於以下問題:TypeScript ToolbarBase類的具體用法?TypeScript ToolbarBase怎麽用?TypeScript ToolbarBase使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了ToolbarBase類的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: describe
describe("_active_change method", () => {
let pan_1: PanTool
let pan_2: PanTool
let toolbar_base: ToolbarBase
beforeEach(() => {
// by default these tools are inactive
pan_1 = new PanTool()
pan_2 = new PanTool()
toolbar_base = new ToolbarBase()
toolbar_base.gestures.pan.tools = [new PanTool(), new PanTool()]
})
it("should correctly activate tool with currently active tool", () => {
pan_1.active = true
toolbar_base._active_change(pan_1)
expect(pan_1.active).to.be.true
expect(pan_2.active).to.be.false
expect(toolbar_base.gestures.pan.active).to.be.equal(pan_1)
})
it("should correctly deactivate tool", () => {
// activate the tool as setup
pan_1.active = true
toolbar_base._active_change(pan_1)
// now deactivate the tool
pan_1.active = false
toolbar_base._active_change(pan_1)
expect(pan_1.active).to.be.false
expect(pan_2.active).to.be.false
expect(toolbar_base.gestures.pan.active).to.be.null
})
it("should correctly active tool and deactive currently active one", () => {
// activate the tool as setup
pan_1.active = true
toolbar_base._active_change(pan_1)
// now activate the other tool
pan_2.active = true
toolbar_base._active_change(pan_2)
expect(pan_1.active).to.be.false
expect(pan_2.active).to.be.true
expect(toolbar_base.gestures.pan.active).to.be.equal(pan_2)
})
})
示例2: it
it("should correctly deactivate tool", () => {
// activate the tool as setup
pan_1.active = true
toolbar_base._active_change(pan_1)
// now deactivate the tool
pan_1.active = false
toolbar_base._active_change(pan_1)
expect(pan_1.active).to.be.false
expect(pan_2.active).to.be.false
expect(toolbar_base.gestures.pan.active).to.be.null
})