Merge pull request #12809 from Budibase/fix/uuid-hbs-to-js
Fix converting UUID from HBS to js
This commit is contained in:
commit
edb6d95edd
|
@ -112,7 +112,7 @@ module.exports.convertHBSBlock = (block, blockNumber) => {
|
||||||
const list = getHelperList()
|
const list = getHelperList()
|
||||||
for (let layer of layers) {
|
for (let layer of layers) {
|
||||||
const parts = splitBySpace(layer)
|
const parts = splitBySpace(layer)
|
||||||
if (value || parts.length > 1) {
|
if (value || parts.length > 1 || list[parts[0]]) {
|
||||||
// first of layer should always be the helper
|
// first of layer should always be the helper
|
||||||
const helper = parts.splice(0, 1)
|
const helper = parts.splice(0, 1)
|
||||||
if (list[helper]) {
|
if (list[helper]) {
|
||||||
|
|
|
@ -127,4 +127,12 @@ describe("Test that the string processing works correctly", () => {
|
||||||
"return `average: ${var1} add: ${var2}`;",
|
"return `average: ${var1} add: ${var2}`;",
|
||||||
])
|
])
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it("should handle uuids", () => {
|
||||||
|
const response = convertToJS("This is: {{ uuid }}")
|
||||||
|
checkLines(response, [
|
||||||
|
"const var1 = helpers.uuid();",
|
||||||
|
"return `This is: ${var1}`;",
|
||||||
|
])
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in New Issue