本文整理汇总了TypeScript中@bokehjs/models/formatters/func_tick_formatter.FuncTickFormatter类的典型用法代码示例。如果您正苦于以下问题:TypeScript FuncTickFormatter类的具体用法?TypeScript FuncTickFormatter怎么用?TypeScript FuncTickFormatter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了FuncTickFormatter类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: it
it("should support imports using require", () => {
const formatter = new FuncTickFormatter({
code: "let {max} = require('../../core/util/array'); return max([1, 2, 3])",
use_strict: true,
})
const labels = formatter.doFormat([0, 0, 0], {loc: 0})
expect(labels).to.be.deep.equal([3,3,3])
})
示例2: describe
describe("FuncTickFormatter._make_func method", () => {
const formatter = new FuncTickFormatter({code: "return 10", use_strict: true})
it("should return a Function", () => {
expect(formatter._make_func()).to.be.an.instanceof(Function)
})
it("should have code property as function body", () => {
const func = new Function("tick", "index", "ticks", "require", "exports", "'use strict';\nreturn 10")
expect(formatter._make_func().toString()).to.be.equal(func.toString())
})
it("should have values as function args", () => {
const rng = new Range1d()
formatter.args = {foo: rng.ref()}
const func = new Function("tick", "index", "ticks", "foo", "require", "exports", "'use strict';\nreturn 10")
expect(formatter._make_func().toString()).to.be.equal(func.toString())
})
})