|
3 | 3 | var tap = require('tap');
|
4 | 4 | var pa = require('../core/lib/pattern_assembler');
|
5 | 5 | var Pattern = require('../core/lib/object_factory').Pattern;
|
6 |
| -var CompileState = require('../core/lib/object_factory').CompileState; |
7 | 6 | var PatternGraph = require('../core/lib/pattern_graph').PatternGraph;
|
8 | 7 |
|
9 | 8 | var fs = require('fs-extra');
|
@@ -59,12 +58,14 @@ function patternlabClosure() {
|
59 | 58 | },
|
60 | 59 | data: {
|
61 | 60 | description: 'Not a quote from a smart man',
|
62 |
| - link: {} |
| 61 | + link: { |
| 62 | + "molecules-single-comment": "01-molecules-06-components-02-single-comment/01-molecules-06-components-02-single-comment.html" |
| 63 | + } |
63 | 64 | },
|
64 | 65 | partials: {},
|
65 | 66 | graph: PatternGraph.empty()
|
66 |
| - } |
67 |
| -}; |
| 67 | + }; |
| 68 | +} |
68 | 69 |
|
69 | 70 | tap.test('parameter hunter finds and extends templates', function(test) {
|
70 | 71 | var currentPattern = currentPatternClosure();
|
@@ -402,3 +403,21 @@ tap.test('parameter hunter parses parameters containing html tags', function(tes
|
402 | 403 |
|
403 | 404 | test.end();
|
404 | 405 | });
|
| 406 | + |
| 407 | +tap.test('parameter hunter expands links inside parameters', function (test) { |
| 408 | + var currentPattern = currentPatternClosure(); |
| 409 | + var patternlab = patternlabClosure(); |
| 410 | + var parameter_hunter = new ph(); |
| 411 | + |
| 412 | + patternlab.patterns[0].template = '<a href="{{{ url }}}">{{ description }}</a>'; |
| 413 | + patternlab.patterns[0].extendedTemplate = patternlab.patterns[0].template; |
| 414 | + |
| 415 | + currentPattern.template = "{{> molecules-single-comment(url: 'link.molecules-single-comment', description: 'Link to single comment') }}"; |
| 416 | + currentPattern.extendedTemplate = currentPattern.template; |
| 417 | + currentPattern.parameteredPartials[0] = currentPattern.template; |
| 418 | + |
| 419 | + parameter_hunter.find_parameters(currentPattern, patternlab); |
| 420 | + test.equals(currentPattern.extendedTemplate, '<a href="01-molecules-06-components-02-single-comment/01-molecules-06-components-02-single-comment.html">Link to single comment</a>'); |
| 421 | + |
| 422 | + test.end(); |
| 423 | +}); |
0 commit comments