Socket
Socket
Sign inDemoInstall

dustjs-linkedin

Package Overview
Dependencies
Maintainers
2
Versions
55
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dustjs-linkedin - npm Package Compare versions

Comparing version 1.2.3 to 1.2.4

dist/dust-core-1.2.4.js

2

dist/dust-core-1.2.3.js

@@ -588,2 +588,3 @@ //

var BS = /\\/g,
FS = /\//g,
CR = /\r/g,

@@ -602,2 +603,3 @@ LS = /\u2028/g,

.replace(BS, '\\\\')
.replace(FS, '\\/')
.replace(DQ, '\\"')

@@ -604,0 +606,0 @@ .replace(SQ, "\\'")

@@ -580,2 +580,3 @@ var dust = {};

var BS = /\\/g,
FS = /\//g,
CR = /\r/g,

@@ -594,2 +595,3 @@ LS = /\u2028/g,

.replace(BS, '\\\\')
.replace(FS, '\\/')
.replace(DQ, '\\"')

@@ -596,0 +598,0 @@ .replace(SQ, "\\'")

2

package.json
{
"name": "dustjs-linkedin",
"version": "1.2.3",
"version": "1.2.4",
"author": "Aleksander Williams",

@@ -5,0 +5,0 @@ "description": "Asynchronous templates for the browser and node.js ( LinkedIn fork )",

var coreTests = [
{
name: "base cases",
name: "core tests",
tests: [
{
name: "Try me",
name: "streaming render",
source: "{#stream}{#delay}{.}{/delay}{/stream}",

@@ -24,3 +24,3 @@ context: (function(){

expected: '',
message: "should test the stream tag"
message: "should test the stream rendering"
},

@@ -32,13 +32,13 @@ {

expected: "Hello World!",
message: "should test basic"
message: "should test basic text rendering"
},
{
name: "should test one basic reference",
name: "reference",
source: "{?one}{one}{/one}",
context: {"one": 0 },
expected: "0",
message: "should test one basic reference"
message: "should test a basic reference"
},
{
name: "implicit",
name: "implicit array",
source: "{#names}{.}{~n}{/names}",

@@ -50,3 +50,3 @@ context: { names: ["Moe", "Larry", "Curly"] },

{
name: "rename_key",
name: "inline param from outer scope",
source: "{#person foo=root}{foo}: {name}, {age}{/person}",

@@ -58,3 +58,3 @@ context: { root: "Subject", person: { name: "Larry", age: 45 } },

{
name: "force_local",
name: "force local",
source: "{#person}{.root}: {name}, {age}{/person}",

@@ -66,3 +66,3 @@ context: { root: "Subject", person: { name: "Larry", age: 45 } },

{
name: "escaped",
name: "filter un-escape",
source: "{safe|s}{~n}{unsafe}",

@@ -74,3 +74,3 @@ context: { safe: "<script>alert('Hello!')</script>", unsafe: "<script>alert('Goodbye!')</script>" },

{
name: "escape_pragma",
name: "escape pragma",
source: "{%esc:s}\n {unsafe}{~n}\n {%esc:h}\n {unsafe}\n {/esc}\n{/esc}",

@@ -82,3 +82,3 @@ context: { unsafe: "<script>alert('Goodbye!')</script>" },

{
name: "use . for creating a block and use it to set params",
name: "use . for creating a block and set params",
source: "{#. test=\"you\"}{name} {test}{/.}",

@@ -90,3 +90,3 @@ context: { name: "me"},

{
name: "sync_key",
name: "functions in context",
source: "Hello {type} World!",

@@ -99,6 +99,6 @@ context: {

expected: "Hello Sync World!",
message: "should test sync key"
message: "should functions in context"
},
{
name: "async_key",
name: "async functions in context",
source: "Hello {type} World!",

@@ -115,6 +115,6 @@ context: {

expected: "Hello Async World!",
message: "should test async key"
message: "should test functions in context"
},
{
name: "sync_chunk",
name: "sync chunk write test",
source: "Hello {type} World!",

@@ -127,3 +127,3 @@ context: {

expected: "Hello Chunky World!",
message: "should test sync chunk"
message: "should test sync chunk write"
},

@@ -228,30 +228,4 @@ {

},
{
name: "partials",
tests: [
{
name: "partial",
source: "Hello {name}! You have {count} new messages.",
context: { name: "Mick", count: 30 },
expected: "Hello Mick! You have 30 new messages.",
message: "should test a basic replace"
},
{
name: "partial_with_blocks",
source: "{+header}default header {/header}Hello {name}! You have {count} new messages.",
context: { name: "Mick", count: 30 },
expected: "default header Hello Mick! You have 30 new messages.",
message: "should test a partial with blocks"
},
{
name: "partial_with_blocks_and_no_defaults",
source: "{+header/}Hello {name}! You have {count} new messages.",
context: { name: "Mick", count: 30 },
expected: "Hello Mick! You have 30 new messages.",
message: "should test a partial with blocks and no defaults"
}
]
},
{
name: "corner cases",
name: "truth/falsy tests",
tests: [

@@ -273,3 +247,3 @@ {

{
name: "emptyString context is treated as empty",
name: "empty string context is treated as empty",
source: "{emptyString}",

@@ -281,3 +255,3 @@ context: { "emptyString": "" },

{
name: "emptyString, single quoted in context is treated as empty",
name: "empty string, single quoted in context is treated as empty",
source: "{emptyString}",

@@ -347,142 +321,5 @@ context: { "emptyString": '' },

{
name: "error Message",
name: "scalar data tests",
tests: [
{
name: "Dust syntax error",
source: "RRR {##}",
context: { name: "Mick", count: 30 },
error: 'Expected buffer, comment, partial, reference, section or special but "{" found. At line : 1, column : 5',
message: "should test that the error message shows line and column."
},
{
name: "Dust syntax error. Error in Section",
source: ["{#s}",
"{#&2}",
"{/s}"].join("\n"),
context: {},
error: 'Expected end tag for s but it was not found. At line : 2, column : 1',
message: "should test the errors message for section with error."
},
{
name: "Dust syntax error. Error in Section with buffer",
source: ["{#s}",
"this is the",
"buffer",
"{#&2}",
"a second",
"buffer",
"{/s}"].join("\n"),
context: {},
error: 'Expected end tag for s but it was not found. At line : 4, column : 1',
message: "should test the errors message for section with a buffer and error inside."
},
{
name: "Dust syntax error. Error in Section without end tag",
source: ["{#s}",
"this is the",
"buffer",
"a second",
"buffer"].join("\n"),
context: {},
error: 'Expected end tag for s but it was not found. At line : 5, column : 7',
message: "should test the errors message for section without end tag shows."
},
{
name: "Dust syntax error. Error in Partial with buffer",
source: ["{+header}",
"this is a Partial",
"with Error",
"eeee{@#@$fdf}",
"default header ",
"{/header}"].join("\n"),
context: {},
error: 'Expected end tag for header but it was not found. At line : 4, column : 5',
message: "should test the errors message for partials with a buffer inside."
},
{
name: "Dust syntax error. Error in Partial without end tag",
source: ["{+header}",
"this is the",
"buffer",
"a second",
"buffer"].join("\n"),
context: {},
error: 'Expected end tag for header but it was not found. At line : 5, column : 7',
message: "should test the errors message for partial without end tag."
},
{
name: "Dust syntax error. Error in Scalar",
source:["{#scalar}",
"true",
" {#@#fger}",
"{:else}",
"false",
"{/scalar}"].join("\n"),
context: {},
error: 'Expected end tag for scalar but it was not found. At line : 3, column : 2',
message: "should test the errors message for Scalar."
},
{
name: "Dust syntax error. Error in Scalar's else",
source:["{#scalar}",
"true",
"{:else}",
"false",
" {#@#fger}",
"{/scalar}"].join("\n"),
context: {},
error: 'Expected end tag for scalar but it was not found. At line : 5, column : 2',
message: "should test the errors message for Scalar."
},
{
name: "Dust syntax error. Error in Conditional",
source:["{?tags}",
"<ul>{~n}",
"{#tags}{~s}",
"<li>{#@$}</li>{~n}",
"{/tags}",
"</ul>",
"{:else}",
"No Tags!",
"{/tags}"].join("\n"),
context: {},
error: 'Expected end tag for tags but it was not found. At line : 4, column : 5',
message: "should test the errors message for Conditionals."
},
{
name: "Dust syntax error. Error in Conditional's else",
source:["{?tags}",
"<ul>{~n}",
"{#tags}{~s}",
"<li>{.}</li>{~n}",
"{/tags}",
"</ul>",
"{:else}",
"{#@$}",
"No Tags!",
"{/tags}"].join("\n"),
context: {},
error: 'Expected end tag for tags but it was not found. At line : 8, column : 1',
message: "should test the errors message for Conditional's else."
},
{
name: "Dust syntax error. Error in Conditional without end tag",
source:["{?tags}",
"<ul>{~n}",
"{#tags}{~s}",
"<li>{.}</li>{~n}",
"{/tags}",
"</ul>",
"{:else}",
"No Tags!"].join("\n"),
context: {},
error: 'Expected end tag for tags but it was not found. At line : 8, column : 9',
message: "should test the errors message for Conditional without end tag."
}
]
},
{
name: "scalar",
tests: [
{
name: "scalar null in a # section",

@@ -562,3 +399,3 @@ source: "{#scalar}true{:else}false{/scalar}",

{
name: "empty cases",
name: "empty data tests",
tests: [

@@ -608,3 +445,3 @@ {

{
name: "String 0 value in context is treated as non empty",
name: "string 0 value in context is treated as non empty",
source: "{zero}",

@@ -616,3 +453,3 @@ context: {"zero": "0" },

{
name: "empty_array",
name: "empty array",
source: "{#names}{title} {name}{~n}{/names}",

@@ -626,3 +463,3 @@ context: { title: "Sir", names: [] },

{
name: "array",
name: "array/index-access tests",
tests: [

@@ -637,3 +474,3 @@ {

{
name: "Accessing array element by index when element value is a primitive",
name: "accessing array element by index when element value is a primitive",
source: '{do.re[0]}',

@@ -645,3 +482,3 @@ context: { "do": { "re" : ["hello!","bye!"] } },

{
name: "Accessing array by index when element value is a object",
name: "accessing array by index when element value is a object",
source: '{do.re[0].mi}',

@@ -653,3 +490,3 @@ context: { "do": { "re" : [{"mi" : "hello!"},"bye!"] } },

{
name: "Accessing array by index when element is a nested object",
name: "accessing array by index when element is a nested object",
source: '{do.re[0].mi[1].fa}',

@@ -661,3 +498,3 @@ context: { "do": { "re" : [{"mi" : ["one", {"fa" : "hello!"}]},"bye!"] } },

{
name: "Accessing array by index when element is list of primitives",
name: "accessing array by index when element is list of primitives",
source: '{do[0]}',

@@ -669,3 +506,3 @@ context: { "do": ["lala", "lele"] },

{
name: "Accessing array inside a loop using the current context",
name: "accessing array inside a loop using the current context",
source: '{#list3}{.[0].biz}{/list3}',

@@ -698,4 +535,4 @@ context: { "list3": [[ { "biz" : "123" } ], [ { "biz" : "345" } ]]},

{
name: "array reference $len in iteration on simple type",
source: "{#names}Size=({$len}).{title} {.}{~n}{/names}",
name: "array reference $len in iteration on simple type",
source: "{#names}Size=({$len}).{title} {.}{~n}{/names}",
context: { title: "Sir", names: [ "Moe", "Larry", "Curly" ] },

@@ -706,4 +543,4 @@ expected: "Size=(3).Sir Moe\nSize=(3).Sir Larry\nSize=(3).Sir Curly\n",

{
name: "array reference $idx/$len on empty array case",
source: "{#names}Idx={$idx} Size=({$len}).{title} {.}{~n}{/names}",
name: "array reference $idx/$len on empty array case",
source: "{#names}Idx={$idx} Size=({$len}).{title} {.}{~n}{/names}",
context: { title: "Sir", names: [ ] },

@@ -714,4 +551,4 @@ expected: "",

{
name: "array reference $idx/$len on single element case (scalar case)",
source: "{#name}Idx={$idx} Size={$len} {.}{/name}",
name: "array reference $idx/$len on single element case (scalar case)",
source: "{#name}Idx={$idx} Size={$len} {.}{/name}",
context: { name: "Just one name" },

@@ -722,4 +559,4 @@ expected: "Idx= Size= Just one name",

{
name: "array reference $idx/$len {#.} section case",
source: "{#names}{#.}{$idx}{.} {/.}{/names}",
name: "array reference $idx/$len {#.} section case",
source: "{#names}{#.}{$idx}{.} {/.}{/names}",
context: { names: ["Moe", "Larry", "Curly"] },

@@ -730,4 +567,4 @@ expected: "0Moe 1Larry 2Curly ",

{
name: "array reference $idx/$len not changed in nested object",
source: "{#results}{#info}{$idx}{name}-{$len} {/info}{/results}",
name: "array reference $idx/$len not changed in nested object",
source: "{#results}{#info}{$idx}{name}-{$len} {/info}{/results}",
context: { results: [ {info: {name: "Steven"}  },  {info: {name: "Richard"} } ]  },

@@ -738,4 +575,4 @@ expected: "0Steven-2 1Richard-2 ",

{
name: "array reference $idx/$len nested loops",
source: "{#A}A loop:{$idx}-{$len},{#B}B loop:{$idx}-{$len}C[0]={.C[0]} {/B}A loop trailing: {$idx}-{$len}{/A}",
name: "array reference $idx/$len nested loops",
source: "{#A}A loop:{$idx}-{$len},{#B}B loop:{$idx}-{$len}C[0]={.C[0]} {/B}A loop trailing: {$idx}-{$len}{/A}",
context: {"A": [ {"B": [ {"C": ["Ca1", "C2"]}, {"C": ["Ca2", "Ca22"]} ] }, {"B": [ {"C": ["Cb1", "C2"]}, {"C": ["Cb2", "Ca2"]} ] } ] },

@@ -784,3 +621,3 @@ expected: "A loop:0-2,B loop:0-2C[0]=Ca1 B loop:1-2C[0]=Ca2 A loop trailing: 0-2A loop:1-2,B loop:0-2C[0]=Cb1 B loop:1-2C[0]=Cb2 A loop trailing: 1-2",

{
name: "object paths",
name: "object tests",
tests: [

@@ -804,3 +641,3 @@ {

{
name: "conditional",
name: "conditional tests",
tests: [

@@ -839,3 +676,3 @@ {

{
name: "empty_else_block",
name: "empty else block",
source: "{#foo}full foo{:else}empty foo{/foo}",

@@ -849,3 +686,3 @@ context: { foo: []},

{
name: "filtrers",
name: "filter tests",
tests: [

@@ -868,3 +705,3 @@ {

{
name: "Invalid filter",
name: "invalid filter",
source: "{obj|nullcheck|invalid}",

@@ -876,2 +713,16 @@ context: { obj: "test" },

{
name: "escapeJs filter without DQ",
source: "{obj|j|s}",
context: { obj: "<script>\\testBS\\ \rtestCR\r \u2028testLS\u2028 \u2029testPS\u2029 \ntestNL\n \ftestLF\f 'testSQ' \ttestTB\t /testFS/</script>" },
expected: "<script>\\\\testBS\\\\ \\rtestCR\\r \\u2028testLS\\u2028 \\u2029testPS\\u2029 \\ntestNL\\n \\ftestLF\\f \\'testSQ\\' \\ttestTB\\t \\/testFS\\/<\\/script>",
message: "should escapeJs a string when using the j filter"
},
{
name: "escapeJs filter with only DQ",
source: "{obj|j|s}",
context: { obj: '"testDQ"' },
expected: '\\"testDQ\\"',
message: "should escapeJs a string with double quotes when using the j filter"
},
{
name: "JSON.stringify filter",

@@ -892,4 +743,30 @@ source: "{obj|js|s}",

},
{
name: "partial definitions",
tests: [
{
name: "partial",
source: "Hello {name}! You have {count} new messages.",
context: { name: "Mick", count: 30 },
expected: "Hello Mick! You have 30 new messages.",
message: "should test a basic replace in a template"
},
{
name: "partial_with_blocks",
source: "{+header}default header {/header}Hello {name}! You have {count} new messages.",
context: { name: "Mick", count: 30 },
expected: "default header Hello Mick! You have 30 new messages.",
message: "should test a block with defaults"
},
{
name: "partial_with_blocks_and_no_defaults",
source: "{+header/}Hello {name}! You have {count} new messages.",
context: { name: "Mick", count: 30 },
expected: "Hello Mick! You have 30 new messages.",
message: "should test a blocks with no defaults"
}
]
},
{
name: "partials",
name: "partial/params tests",
tests : [

@@ -997,94 +874,5 @@ {

{
name: "whitespaces",
name: "inline params tests",
tests: [
{
name: "ignore extra whitespaces between opening brace plus any of (#,?,@,^,+,%) and the tag identifier",
source: '{# helper foo="bar" boo="boo" } {/helper}',
context: { "helper": function(chunk, context, bodies, params) { return chunk.write(params.boo + " " + params.foo); } },
expected: "boo bar",
message: "should ignore extra whitespaces between opening brace plus any of (#,?,@,^,+,%) and the tag identifier"
},
{
name: "error: whitespaces between the opening brace and any of (#,?,@,^,+,%) is not allowed",
source: '{ # helper foo="bar" boo="boo" } {/helper}',
context: { "helper": function(chunk, context, bodies, params) { return chunk.write(params.boo + " " + params.foo); } },
error: 'Expected buffer, comment, partial, reference, section or special but "{" found. At line : 1, column : 1',
message: "should show an error for whitespces between the opening brace and any of (#,?,@,^,+,%)"
},
{
name: "whitespaces between the closing brace plus slash and the tag identifier is supported",
source: '{# helper foo="bar" boo="boo"} {/ helper }',
context: { "helper": function(chunk, context, bodies, params) { return chunk.write(params.boo + " " + params.foo); } },
expected: "boo bar",
message: "should ignore extra whitespaces between the closing brace plus slash and the tag identifier"
},
{
name: "error: whitespaces between the openning curly brace and forward slash in the closing tags not supported",
source: '{# helper foo="bar" boo="boo"} { / helper }',
context: { "helper": function(chunk, context, bodies, params) { return chunk.write(params.boo + " " + params.foo); } },
error: 'Expected end tag for helper but it was not found. At line : 1, column : 32',
message: "should show an error because whitespaces between the '{' and the forward slash are not allowed in the closing tags"
},
{
name: "whitespaces before the self closing tags is allowed",
source: '{#helper foo="bar" boo="boo" /}',
context: { "helper": function(chunk, context, bodies, params) { return chunk.write(params.boo + " " + params.foo); } },
expected: "boo bar",
message: "should ignore extra whitespaces before the self closing tags"
},
{
name: "error: whitespaces between the forward slash and the closing brace in self closing tags",
source: '{#helper foo="bar" boo="boo" / }',
context: { "helper": function(chunk, context, bodies, params) { return chunk.write(params.boo + " " + params.foo); } },
error: 'Expected buffer, comment, partial, reference, section or special but "{" found. At line : 1, column : 1',
message: "should show an error for whitespaces etween the forward slash and the closing brace in self closing tags"
},
{
name: "extra whitespaces between inline params supported",
source: '{#helper foo="bar" boo="boo"/}',
context: { "helper": function(chunk, context, bodies, params) { return chunk.write(params.boo + " " + params.foo); } },
expected: "boo bar",
message: "should ignore extra whitespaces between inline params"
},
{
name: "error : whitespaces between the '{' plus '>' and partial identifier is not supported",
source: '{ > partial/} {> "hello_world"/} {> "{ref}"/}',
context: { "name": "Jim", "count": 42, "ref": "hello_world" },
error: 'Expected buffer, comment, partial, reference, section or special but "{" found. At line : 1, column : 1',
message: "should show an error for whitespaces between the '{' plus '>' and partial identifier"
},
{
name: "whitespaces before the forward slash and the closing brace in partials supported",
source: '{>partial /} {>"hello_world" /} {>"{ref}" /}',
context: { "name": "Jim", "count": 42, "ref": "hello_world" },
expected: "Hello Jim! You have 42 new messages. Hello World! Hello World!",
message: "should ignore extra whitespacesbefore the forward slash and the closing brace in partials"
},
{
name: "ignore whitespaces also means ignoring eol",
source: ['{#authors ',
'name="theAuthors"',
'lastname="authorlastname" ',
'maxtext=300}',
'{>"otherTemplate"/}',
'{/authors}'].join("\n"),
context: {},
expected: "",
message: "should ignore eol"
},
{
name: "ignore carriage return or tab in inline param values",
source: ['{#helper name="Dialog" config="{',
'\'name\' : \'index\' }',
' "} {/helper}'].join("\n"),
context: {},
expected: "",
message: "should ignore carriage return or tab in inline param values"
}
]
},
{
name: "params",
tests: [
{
name: "params",

@@ -1117,3 +905,3 @@ source: "{#helper foo=\"bar\"/}",

{
name: "dynamics keys",
name: "inline partial/block tests",
tests: [

@@ -1175,3 +963,3 @@ {

{
name: "functions",
name: "lambda tests",
tests: [

@@ -1231,5 +1019,89 @@ {

{
name: "dash in keys",
name: "core-grammar tests",
tests: [
{
name: "ignore extra whitespaces between opening brace plus any of (#,?,@,^,+,%) and the tag identifier",
source: '{# helper foo="bar" boo="boo" } {/helper}',
context: { "helper": function(chunk, context, bodies, params) { return chunk.write(params.boo + " " + params.foo); } },
expected: "boo bar",
message: "should ignore extra whitespaces between opening brace plus any of (#,?,@,^,+,%) and the tag identifier"
},
{
name: "error: whitespaces between the opening brace and any of (#,?,@,^,+,%) is not allowed",
source: '{ # helper foo="bar" boo="boo" } {/helper}',
context: { "helper": function(chunk, context, bodies, params) { return chunk.write(params.boo + " " + params.foo); } },
error: 'Expected buffer, comment, partial, reference, section or special but "{" found. At line : 1, column : 1',
message: "should show an error for whitespces between the opening brace and any of (#,?,@,^,+,%)"
},
{
name: "whitespaces between the closing brace plus slash and the tag identifier is supported",
source: '{# helper foo="bar" boo="boo"} {/ helper }',
context: { "helper": function(chunk, context, bodies, params) { return chunk.write(params.boo + " " + params.foo); } },
expected: "boo bar",
message: "should ignore extra whitespaces between the closing brace plus slash and the tag identifier"
},
{
name: "error: whitespaces between the openning curly brace and forward slash in the closing tags not supported",
source: '{# helper foo="bar" boo="boo"} { / helper }',
context: { "helper": function(chunk, context, bodies, params) { return chunk.write(params.boo + " " + params.foo); } },
error: 'Expected end tag for helper but it was not found. At line : 1, column : 32',
message: "should show an error because whitespaces between the '{' and the forward slash are not allowed in the closing tags"
},
{
name: "whitespaces before the self closing tags is allowed",
source: '{#helper foo="bar" boo="boo" /}',
context: { "helper": function(chunk, context, bodies, params) { return chunk.write(params.boo + " " + params.foo); } },
expected: "boo bar",
message: "should ignore extra whitespaces before the self closing tags"
},
{
name: "error: whitespaces between the forward slash and the closing brace in self closing tags",
source: '{#helper foo="bar" boo="boo" / }',
context: { "helper": function(chunk, context, bodies, params) { return chunk.write(params.boo + " " + params.foo); } },
error: 'Expected buffer, comment, partial, reference, section or special but "{" found. At line : 1, column : 1',
message: "should show an error for whitespaces etween the forward slash and the closing brace in self closing tags"
},
{
name: "extra whitespaces between inline params supported",
source: '{#helper foo="bar" boo="boo"/}',
context: { "helper": function(chunk, context, bodies, params) { return chunk.write(params.boo + " " + params.foo); } },
expected: "boo bar",
message: "should ignore extra whitespaces between inline params"
},
{
name: "error : whitespaces between the '{' plus '>' and partial identifier is not supported",
source: '{ > partial/} {> "hello_world"/} {> "{ref}"/}',
context: { "name": "Jim", "count": 42, "ref": "hello_world" },
error: 'Expected buffer, comment, partial, reference, section or special but "{" found. At line : 1, column : 1',
message: "should show an error for whitespaces between the '{' plus '>' and partial identifier"
},
{
name: "whitespaces before the forward slash and the closing brace in partials supported",
source: '{>partial /} {>"hello_world" /} {>"{ref}" /}',
context: { "name": "Jim", "count": 42, "ref": "hello_world" },
expected: "Hello Jim! You have 42 new messages. Hello World! Hello World!",
message: "should ignore extra whitespacesbefore the forward slash and the closing brace in partials"
},
{
name: "ignore whitespaces also means ignoring eol",
source: ['{#authors ',
'name="theAuthors"',
'lastname="authorlastname" ',
'maxtext=300}',
'{>"otherTemplate"/}',
'{/authors}'].join("\n"),
context: {},
expected: "",
message: "should ignore eol"
},
{
name: "ignore carriage return or tab in inline param values",
source: ['{#helper name="Dialog" config="{',
'\'name\' : \'index\' }',
' "} {/helper}'].join("\n"),
context: {},
expected: "",
message: "should ignore carriage return or tab in inline param values"
},
{
name: "support dash in key/reference",

@@ -1294,5 +1166,142 @@ source: 'Hello {first-name}, {last-name}! You have {count} new messages.',

{
name: "Buffer",
name: "syntax error tests",
tests: [
{
name: "Dust syntax error",
source: "RRR {##}",
context: { name: "Mick", count: 30 },
error: 'Expected buffer, comment, partial, reference, section or special but "{" found. At line : 1, column : 5',
message: "should test that the error message shows line and column."
},
{
name: "Dust syntax error. Error in Section",
source: ["{#s}",
"{#&2}",
"{/s}"].join("\n"),
context: {},
error: 'Expected end tag for s but it was not found. At line : 2, column : 1',
message: "should test the errors message for section with error."
},
{
name: "Dust syntax error. Error in Section with buffer",
source: ["{#s}",
"this is the",
"buffer",
"{#&2}",
"a second",
"buffer",
"{/s}"].join("\n"),
context: {},
error: 'Expected end tag for s but it was not found. At line : 4, column : 1',
message: "should test the errors message for section with a buffer and error inside."
},
{
name: "Dust syntax error. Error in Section without end tag",
source: ["{#s}",
"this is the",
"buffer",
"a second",
"buffer"].join("\n"),
context: {},
error: 'Expected end tag for s but it was not found. At line : 5, column : 7',
message: "should test the errors message for section without end tag shows."
},
{
name: "Dust syntax error. Error in Partial with buffer",
source: ["{+header}",
"this is a Partial",
"with Error",
"eeee{@#@$fdf}",
"default header ",
"{/header}"].join("\n"),
context: {},
error: 'Expected end tag for header but it was not found. At line : 4, column : 5',
message: "should test the errors message for partials with a buffer inside."
},
{
name: "Dust syntax error. Error in Partial without end tag",
source: ["{+header}",
"this is the",
"buffer",
"a second",
"buffer"].join("\n"),
context: {},
error: 'Expected end tag for header but it was not found. At line : 5, column : 7',
message: "should test the errors message for partial without end tag."
},
{
name: "Dust syntax error. Error in Scalar",
source:["{#scalar}",
"true",
" {#@#fger}",
"{:else}",
"false",
"{/scalar}"].join("\n"),
context: {},
error: 'Expected end tag for scalar but it was not found. At line : 3, column : 2',
message: "should test the errors message for Scalar."
},
{
name: "Dust syntax error. Error in Scalar's else",
source:["{#scalar}",
"true",
"{:else}",
"false",
" {#@#fger}",
"{/scalar}"].join("\n"),
context: {},
error: 'Expected end tag for scalar but it was not found. At line : 5, column : 2',
message: "should test the errors message for Scalar."
},
{
name: "Dust syntax error. Error in Conditional",
source:["{?tags}",
"<ul>{~n}",
"{#tags}{~s}",
"<li>{#@$}</li>{~n}",
"{/tags}",
"</ul>",
"{:else}",
"No Tags!",
"{/tags}"].join("\n"),
context: {},
error: 'Expected end tag for tags but it was not found. At line : 4, column : 5',
message: "should test the errors message for Conditionals."
},
{
name: "Dust syntax error. Error in Conditional's else",
source:["{?tags}",
"<ul>{~n}",
"{#tags}{~s}",
"<li>{.}</li>{~n}",
"{/tags}",
"</ul>",
"{:else}",
"{#@$}",
"No Tags!",
"{/tags}"].join("\n"),
context: {},
error: 'Expected end tag for tags but it was not found. At line : 8, column : 1',
message: "should test the errors message for Conditional's else."
},
{
name: "Dust syntax error. Error in Conditional without end tag",
source:["{?tags}",
"<ul>{~n}",
"{#tags}{~s}",
"<li>{.}</li>{~n}",
"{/tags}",
"</ul>",
"{:else}",
"No Tags!"].join("\n"),
context: {},
error: 'Expected end tag for tags but it was not found. At line : 8, column : 9',
message: "should test the errors message for Conditional without end tag."
}
]
},
{
name: "buffer test",
tests: [
{
name: "buffer ",

@@ -1302,3 +1311,3 @@ source: "{&partial/}",

expected: "{&partial/}",
message: "This content {&partial/} should be parsed as buffer"
message: "given content should be parsed as buffer"
}

@@ -1308,6 +1317,6 @@ ]

{
name:"Helpers",
name:"invalid helper test",
tests: [
{
name: "nonexistant helper",
name: "non-existing helper",
source: "some text {@notfound}foo{/notfound} some text",

@@ -1314,0 +1323,0 @@ context: {},

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc