Skip to content

Commit 1aee056

Browse files
James NashBrian Muenzenmeyer
James Nash
authored and
Brian Muenzenmeyer
committed
145 test (#307)
* more accurate paramToJson in parameter_hunter * updating unit tests for parameter_hunter paramToJson * minor edit * another param string parser * bugs fixed, unit tests working * variable name change * Added (failing for now) test to highlight the bug. * Added another test for another bug (parenthesis in value confuses patternhunter) * Added additional parameter hunter tests. * replacing JSON with JSON5 for better error messaging * working paramToJson * stricter unit tests * comment updates * simplfying paramToJson further * simplfying paramToJson further * comment update * tightened parameter key search * comment update * accommodating decimals and exponentials as valid numeric values * comment update * fixing array instead of number typo * more comments * spacing to pass eslint * removing unnecessary escape * Fixed minor bug: Array instead of int used as substring() arg. * Added parameter_hunter test to explicity show that issue #145 will now be fixed too. * fixing substring param typo * renaming json5 instances * comment update * Added comment in test code to reference issue #145
1 parent 739e507 commit 1aee056

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

test/parameter_hunter_tests.js

+19
Original file line numberDiff line numberDiff line change
@@ -320,6 +320,25 @@
320320
parameter_hunter.find_parameters(currentPattern, patternlab);
321321
test.equals(currentPattern.extendedTemplate, '<p></p>');
322322

323+
test.done();
324+
},
325+
326+
'parameter hunter parses parameters containing html tags' : function(test){
327+
// From issue #145 https://github.com/pattern-lab/patternlab-node/issues/145
328+
var currentPattern = currentPatternClosure();
329+
var patternlab = patternlabClosure();
330+
var parameter_hunter = new ph();
331+
332+
patternlab.patterns[0].template = "<p>{{{ tag1 }}}</p><p>{{{ tag2 }}}</p><p>{{{ tag3 }}}</p>";
333+
patternlab.patterns[0].extendedTemplate = patternlab.patterns[0].template;
334+
335+
currentPattern.template = "{{> molecules-single-comment(tag1: '<strong>Single-quoted</strong>', tag2: \"<em>Double-quoted</em>\", tag3: '<strong class=\\\"foo\\\" id=\\\'bar\\\'>With attributes</strong>') }}";
336+
currentPattern.extendedTemplate = currentPattern.template;
337+
currentPattern.parameteredPartials[0] = currentPattern.template;
338+
339+
parameter_hunter.find_parameters(currentPattern, patternlab);
340+
test.equals(currentPattern.extendedTemplate, '<p><strong>Single-quoted</strong></p><p><em>Double-quoted</em></p><p><strong class="foo" id=\'bar\'>With attributes</strong></p>');
341+
323342
test.done();
324343
}
325344

0 commit comments

Comments
 (0)