@@ -77,7 +77,7 @@ var coreTests = [
77
77
message : "should test basic text rendering"
78
78
} ,
79
79
{
80
- name : "confusing \" \n \' \u0000 \ u2028 \u2029 template name\\" ,
80
+ name : "confusing \" \n \' \u2028 \u2029 template name\\" ,
81
81
source : "Hello World!" ,
82
82
context : { } ,
83
83
expected : "Hello World!" ,
@@ -1051,78 +1051,50 @@ var coreTests = [
1051
1051
"age" : "8 hours" ,
1052
1052
"people" : [
1053
1053
{ "name" : "Alice" } ,
1054
- { "name" : "Bob" , "age" : 42 } ,
1054
+ { "name" : "Bob" , "age" : 42 }
1055
1055
]
1056
1056
} ,
1057
1057
expected : "Alice is not telling us their age.Bob is 42 years old." ,
1058
1058
message : "should test the leading dot behavior in local mode"
1059
1059
} ,
1060
- {
1061
- name : "check nested ref in global does not work in local mode" ,
1062
- source : "{glob.globChild}" ,
1063
- context : { } ,
1064
- expected : "" ,
1065
- message : "Should not find glob.globChild which is in context.global"
1066
- } ,
1067
- {
1068
- name : "Verify leading dot path not affected in global mode" ,
1069
- source : "{#people}{.name} is {?.age}{.age} years old.{:else}not telling us their age.{/age}{/people}" ,
1070
- options : { pathScope : "global" } ,
1071
- context : {
1072
- "name" : "List of people" ,
1073
- "age" : "8 hours" ,
1074
- "people" : [
1075
- { "name" : "Alice" } ,
1076
- { "name" : "Bob" , "age" : 42 } ,
1077
- ]
1078
- } ,
1079
- expected : "Alice is not telling us their age.Bob is 42 years old." ,
1080
- message : "should test the leading dot behavior preserved"
1081
- } ,
1082
1060
{
1083
1061
name : "Standard dotted path with falsey value. Issue 317" ,
1084
1062
source : "{foo.bar}" ,
1085
- options : { pathScope : "global" } ,
1086
1063
context : { foo : { bar : 0 } } ,
1087
1064
expected : "0" ,
1088
1065
message : "should work when value at end of path is falsey"
1089
1066
} ,
1090
1067
{
1091
1068
name : "dotted path resolution up context" ,
1092
1069
source : "{#data.A.list}Aname{data.A.name}{/data.A.list}" ,
1093
- options : { pathScope : "global" } ,
1094
1070
context : { "data" :{ "A" :{ "name" :"Al" , "list" :[ { "name" : "Joe" } , { "name" : "Mary" } ] , "B" :{ "name" :"Bob" , "Blist" :[ "BB1" , "BB2" ] } } } } ,
1095
1071
expected : "AnameAlAnameAl" ,
1096
1072
message : "should test usage of dotted path resolution up context"
1097
1073
} ,
1098
1074
{
1099
1075
name : "dotted path resolution up context 2" ,
1100
1076
source : "{#data.A.B.Blist}Aname{data.A.name}{/data.A.B.Blist}" ,
1101
- options : { pathScope : "global" } ,
1102
1077
context : { "data" :{ "A" :{ "name" :"Al" , "list" :[ { "name" : "Joe" } , { "name" : "Mary" } ] , "B" :{ "name" :"Bob" , "Blist" :[ "BB1" , "BB2" ] } } } } ,
1103
1078
expected : "AnameAlAnameAl" ,
1104
1079
message : "should test usage of dotted path resolution up context"
1105
1080
} ,
1106
1081
{
1107
1082
name : "dotted path resolution without explicit context" ,
1108
1083
source : "{#data.A}Aname{name}{data.C.name}{/data.A}" ,
1109
- options : { pathScope : "global" } ,
1110
1084
context : { "data" :{ "A" :{ "name" :"Al" , "list" :[ { "name" : "Joe" } , { "name" : "Mary" } ] , "B" :{ "name" :"Bob" , "Blist" :[ "BB1" , "BB2" ] } } , C :{ name :"cname" } } } ,
1111
1085
expected : "AnameAlcname" ,
1112
1086
message : "should test usage of dotted path resolution up context"
1113
1087
} ,
1114
1088
{
1115
1089
name : "same as previous test but with explicit context" ,
1116
1090
source : "{#data.A:B}Aname{name}{data.C.name}{/data.A}" ,
1117
- options : { pathScope : "global" } ,
1118
1091
context : { "data" :{ "A" :{ "name" :"Al" , "list" :[ { "name" : "Joe" } , { "name" : "Mary" } ] , "B" :{ "name" :"Bob" , "Blist" :[ "BB1" , "BB2" ] } } , C :{ name :"cname" } } } ,
1119
1092
expected : "AnameAl" ,
1120
1093
message : "should test explicit context blocks looking further up stack"
1121
1094
} ,
1122
1095
{
1123
1096
name : "explicit context but gets value from global" ,
1124
1097
source : "{#data.A:B}Aname{name}{glob.globChild}{/data.A}" ,
1125
- options : { pathScope : "global" } ,
1126
1098
base : { glob : { globChild : "testGlobal" } } ,
1127
1099
context : { "data" :{ "A" :{ "name" :"Al" , "list" :[ { "name" : "Joe" } , { "name" : "Mary" } ] , "B" :{ "name" :"Bob" , "Blist" :[ "BB1" , "BB2" ] } } , C :{ name :"cname" } } } ,
1128
1100
expected : "AnameAltestGlobal" ,
@@ -1131,15 +1103,13 @@ var coreTests = [
1131
1103
{
1132
1104
name : "nested dotted path resolution" ,
1133
1105
source : "{#data.A.list}{#data.A.B.Blist}{.}Aname{data.A.name}{/data.A.B.Blist}{/data.A.list}" ,
1134
- options : { pathScope : "global" } ,
1135
1106
context : { "data" :{ "A" :{ "name" :"Al" , "list" :[ { "name" : "Joe" } , { "name" : "Mary" } ] , "B" :{ "name" :"Bob" , "Blist" :[ "BB1" ] } } } } ,
1136
1107
expected : "BB1AnameAlBB1AnameAl" ,
1137
1108
message : "should test nested usage of dotted path resolution"
1138
1109
} ,
1139
1110
{
1140
1111
name : "check nested ref in global works in global mode" ,
1141
1112
source : "{glob.globChild}" ,
1142
- options : { pathScope : "global" } ,
1143
1113
base : { glob : { globChild : "testGlobal" } } ,
1144
1114
context : { } ,
1145
1115
expected : "testGlobal" ,
@@ -1148,15 +1118,13 @@ var coreTests = [
1148
1118
{
1149
1119
name : "dotted path resolution up context with partial match in current context" ,
1150
1120
source : "{#data}{#A}{C.name}{/A}{/data}" ,
1151
- options : { pathScope : "global" } ,
1152
1121
context : { "data" :{ "A" :{ "name" :"Al" , "B" : "Ben" , "C" : { namex : "Charlie" } } , C : { name : "Charlie Sr." } } } ,
1153
1122
expected : "" ,
1154
1123
message : "should test usage of dotted path resolution up context"
1155
1124
} ,
1156
1125
{
1157
1126
name : "check nested ref not found in global if partial match" ,
1158
1127
source : "{#data}{#A}{C.name}{/A}{/data}" ,
1159
- options : { pathScope : "global" } ,
1160
1128
base : { C : { name : "Big Charlie" } } ,
1161
1129
context : { "data" :{ "A" :{ "name" :"Al" , "B" : "Ben" , "C" : { namex : "Charlie" } } , C : { namey : "Charlie Sr." } } } ,
1162
1130
expected : "" ,
@@ -1165,7 +1133,6 @@ var coreTests = [
1165
1133
{
1166
1134
name : "method invocation" ,
1167
1135
source : "Hello {person.fullName}" ,
1168
- options : { pathScope : "global" } ,
1169
1136
context : {
1170
1137
person : {
1171
1138
firstName : "Peter" ,
@@ -1181,23 +1148,20 @@ var coreTests = [
1181
1148
{
1182
1149
name : "check null values in section iteration don't break path resolution" ,
1183
1150
source : "{#nulls}{names[0].name}{/nulls}" ,
1184
- options : { pathScope : "global" } ,
1185
1151
context : { "nulls" : [ 1 , null , null , 2 ] , "names" : [ { "name" : "Moe" } , { "name" : "Curly" } ] } ,
1186
1152
expected : "MoeMoeMoeMoe" ,
1187
1153
message : "Should resolve path correctly"
1188
1154
} ,
1189
1155
{
1190
1156
name : "check falsey value in section iteration don't break path resolution" ,
1191
1157
source : "{#list}{a.b}{/list}" ,
1192
- options : { pathScope : "global" } ,
1193
1158
context : { "list" : [ '' , 2 , '' ] , "a" : { "b" : "B" } } ,
1194
1159
expected : "BBB" ,
1195
1160
message : "Should resolve path correctly"
1196
1161
} ,
1197
1162
{
1198
1163
name : "check true value in section iteration are also OK" ,
1199
1164
source : "{#list}{a.b}{/list}" ,
1200
- options : { pathScope : "global" } ,
1201
1165
context : { "list" : [ true , 2 , true ] , "a" : { "b" : "B" } } ,
1202
1166
expected : "BBB" ,
1203
1167
message : "Should resolve path correctly"
0 commit comments