|
149 | 149 | test.done();
|
150 | 150 | },
|
151 | 151 |
|
152 |
| - }; |
| 152 | + 'pattern hunter finds and extends templates with verbose partials' : function(test){ |
| 153 | + |
| 154 | + //setup current pattern from what we would have during execution |
| 155 | + var currentPattern = { |
| 156 | + "fileName": "01-sticky-comment", |
| 157 | + "subdir": "02-organisms/02-comments", |
| 158 | + "name": "02-organisms-02-comments-01-sticky-comment", |
| 159 | + "data": null, |
| 160 | + "jsonFileData": {}, |
| 161 | + "patternName": "sticky-comment", |
| 162 | + "patternLink": "02-organisms-02-comments-01-sticky-comment/02-organisms-02-comments-01-sticky-comment.html", |
| 163 | + "patternGroup": "organisms", |
| 164 | + "patternSubGroup": "comments", |
| 165 | + "flatPatternPath": "02-organisms-02-comments", |
| 166 | + "key": "organisms-sticky-comment", |
| 167 | + "template": "{{> 01-molecules/06-components/02-single-comment(description: 'A life is like a garden. Perfect moments can be had, but not preserved, except in memory.') }}", |
| 168 | + "patternPartial": "", |
| 169 | + "lineage": [ |
| 170 | + ], |
| 171 | + "lineageIndex": [ |
| 172 | + ], |
| 173 | + "lineageR": [ |
| 174 | + ], |
| 175 | + "lineageRIndex": [ |
| 176 | + ], |
| 177 | + "patternState": "", |
| 178 | + "extendedTemplate": "{{> 01-molecules/06-components/02-single-comment(description: 'A life is like a garden. Perfect moments can be had, but not preserved, except in memory.') }}" |
| 179 | + }; |
| 180 | + var patternlab = { |
| 181 | + patterns: [ |
| 182 | + { |
| 183 | + "fileName": "02-single-comment", |
| 184 | + "subdir": "01-molecules/06-components", |
| 185 | + "name": "01-molecules-06-components-02-single-comment", |
| 186 | + "data": null, |
| 187 | + "jsonFileData": {}, |
| 188 | + "patternName": "single-comment", |
| 189 | + "patternLink": "01-molecules-06-components-02-single-comment/01-molecules-06-components-02-single-comment.html", |
| 190 | + "patternGroup": "molecules", |
| 191 | + "patternSubGroup": "components", |
| 192 | + "flatPatternPath": "01-molecules-06-components", |
| 193 | + "key": "molecules-single-comment", |
| 194 | + "template": "<p>{{description}}</p>", |
| 195 | + "patternPartial": "", |
| 196 | + "lineage": [ |
| 197 | + ], |
| 198 | + "lineageIndex": [ |
| 199 | + ], |
| 200 | + "lineageR": [ |
| 201 | + ], |
| 202 | + "lineageRIndex": [ |
| 203 | + ], |
| 204 | + "patternState": "", |
| 205 | + "extendedTemplate": "<p>{{description}}</p>" |
| 206 | + } |
| 207 | + ], |
| 208 | + config: { |
| 209 | + debug: false |
| 210 | + }, |
| 211 | + data: { |
| 212 | + description: 'Not a quote from a smart man' |
| 213 | + } |
| 214 | + }; |
| 215 | + |
| 216 | + var parameter_hunter = new ph(); |
| 217 | + |
| 218 | + parameter_hunter.find_parameters(currentPattern, patternlab); |
| 219 | + test.equals(currentPattern.extendedTemplate, '<p>A life is like a garden. Perfect moments can be had, but not preserved, except in memory.</p>'); |
| 220 | + |
| 221 | + test.done(); |
| 222 | + }, |
| 223 | + |
| 224 | + 'pattern hunter finds and extends templates with fully-pathed partials' : function(test){ |
| 225 | + |
| 226 | + //setup current pattern from what we would have during execution |
| 227 | + var currentPattern = { |
| 228 | + "fileName": "01-sticky-comment", |
| 229 | + "subdir": "02-organisms/02-comments", |
| 230 | + "name": "02-organisms-02-comments-01-sticky-comment", |
| 231 | + "data": null, |
| 232 | + "jsonFileData": {}, |
| 233 | + "patternName": "sticky-comment", |
| 234 | + "patternLink": "02-organisms-02-comments-01-sticky-comment/02-organisms-02-comments-01-sticky-comment.html", |
| 235 | + "patternGroup": "organisms", |
| 236 | + "patternSubGroup": "comments", |
| 237 | + "flatPatternPath": "02-organisms-02-comments", |
| 238 | + "key": "organisms-sticky-comment", |
| 239 | + "template": "{{> 01-molecules/06-components/02-single-comment.mustache(description: 'A life is like a garden. Perfect moments can be had, but not preserved, except in memory.') }}", |
| 240 | + "patternPartial": "", |
| 241 | + "lineage": [ |
| 242 | + ], |
| 243 | + "lineageIndex": [ |
| 244 | + ], |
| 245 | + "lineageR": [ |
| 246 | + ], |
| 247 | + "lineageRIndex": [ |
| 248 | + ], |
| 249 | + "patternState": "", |
| 250 | + "extendedTemplate": "{{> 01-molecules/06-components/02-single-comment.mustache(description: 'A life is like a garden. Perfect moments can be had, but not preserved, except in memory.') }}" |
| 251 | + }; |
| 252 | + var patternlab = { |
| 253 | + patterns: [ |
| 254 | + { |
| 255 | + "fileName": "02-single-comment", |
| 256 | + "subdir": "01-molecules/06-components", |
| 257 | + "name": "01-molecules-06-components-02-single-comment", |
| 258 | + "data": null, |
| 259 | + "jsonFileData": {}, |
| 260 | + "patternName": "single-comment", |
| 261 | + "patternLink": "01-molecules-06-components-02-single-comment/01-molecules-06-components-02-single-comment.html", |
| 262 | + "patternGroup": "molecules", |
| 263 | + "patternSubGroup": "components", |
| 264 | + "flatPatternPath": "01-molecules-06-components", |
| 265 | + "key": "molecules-single-comment", |
| 266 | + "template": "<p>{{description}}</p>", |
| 267 | + "patternPartial": "", |
| 268 | + "lineage": [ |
| 269 | + ], |
| 270 | + "lineageIndex": [ |
| 271 | + ], |
| 272 | + "lineageR": [ |
| 273 | + ], |
| 274 | + "lineageRIndex": [ |
| 275 | + ], |
| 276 | + "patternState": "", |
| 277 | + "extendedTemplate": "<p>{{description}}</p>" |
| 278 | + } |
| 279 | + ], |
| 280 | + config: { |
| 281 | + debug: false |
| 282 | + }, |
| 283 | + data: { |
| 284 | + description: 'Not a quote from a smart man' |
| 285 | + } |
| 286 | + }; |
| 287 | + |
| 288 | + var parameter_hunter = new ph(); |
| 289 | + |
| 290 | + parameter_hunter.find_parameters(currentPattern, patternlab); |
| 291 | + test.equals(currentPattern.extendedTemplate, '<p>A life is like a garden. Perfect moments can be had, but not preserved, except in memory.</p>'); |
| 292 | + |
| 293 | + test.done(); |
| 294 | + } |
| 295 | + |
| 296 | + }; |
153 | 297 |
|
154 | 298 | }());
|
0 commit comments