Minor fix for #8843 - the binding input drawer was using the format helper. rather than helpers. when generating JS helpers.

This commit is contained in:
mike12345567 2022-12-06 18:21:54 +00:00
parent a3773c57a1
commit d3029d33ae
2 changed files with 13 additions and 1 deletions

View File

@ -24,7 +24,7 @@ export function addJSBinding(value, caretPos, binding, { helper } = {}) {
if (!helper) {
binding = `$("${binding}")`
} else {
binding = `helper.${binding}()`
binding = `helpers.${binding}()`
}
if (caretPos.start) {
value =

View File

@ -129,3 +129,15 @@ describe("Test the JavaScript helper", () => {
expect(output).toBe("Error while executing JS")
})
})
describe("check JS helpers", () => {
it("should error if using the format helper. not helpers.", () => {
const output = processJS(`return helper.toInt(4.3)`)
expect(output).toBe("Error while executing JS")
})
it("should be able to use toInt", () => {
const output = processJS(`return helpers.toInt(4.3)`)
expect(output).toBe(4)
})
})