Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
THIS CHANGELOG IS AN ATTEMPT TO DOCUMENT CHANGES TO THIS PROJECT.

PL-node-v1.0.1
- FIX: Fix issue where partials containing styleModifiers with integers were not found correctly under all circumstances

PL-node-v1.0.0
- FIX: Resolve issue with not hiding underscored patterns.
- THX: Thanks @ivancamilov for reporting this regression.
Expand Down
14 changes: 7 additions & 7 deletions builder/pattern_assembler.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
/*
* patternlab-node - v1.0.0 - 2015
*
/*
* patternlab-node - v1.0.0 - 2015
*
* Brian Muenzenmeyer, and the web community.
* Licensed under the MIT license.
*
* Many thanks to Brad Frost and Dave Olsen for inspiration, encouragement, and advice.
* Licensed under the MIT license.
*
* Many thanks to Brad Frost and Dave Olsen for inspiration, encouragement, and advice.
*
*/

Expand Down Expand Up @@ -204,7 +204,7 @@

//do something with the regular old partials
for(i = 0; i < foundPatternPartials.length; i++){
var partialKey = foundPatternPartials[i].replace(/{{>([ ])?([\w\-\.\/~]+)(:[A-z-_|]+)?(?:\:[A-Za-z0-9-_]+)?(?:(| )\(.*)?([ ])?}}/g, '$2');
var partialKey = foundPatternPartials[i].replace(/{{>([ ])?([\w\-\.\/~]+)(:[A-z0-9-_|]+)?(?:\:[A-Za-z0-9-_]+)?(?:(| )\(.*)?([ ])?}}/g, '$2');

var partialPath;

Expand Down
2 changes: 1 addition & 1 deletion package.gulp.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "patternlab-node",
"description": "Pattern Lab is a collection of tools to help you create atomic design systems. This is the node command line interface (CLI).",
"version": "1.0.0",
"version": "1.0.1",
"devDependencies": {
"browser-sync": "^2.10.0",
"del": "^2.0.2",
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "patternlab-node",
"description": "Pattern Lab is a collection of tools to help you create atomic design systems. This is the node command line interface (CLI).",
"version": "1.0.0",
"version": "1.0.1",
"devDependencies": {
"bs-html-injector": "^3.0.0",
"diveSync": "^0.3.0",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<div class="test_group">
{{> test-styled-atom:foo1 }}
{{> test-styled-atom:foo1|foo2 }}
{{> test-styled-atom:foo1|foo2(message: "bar") }}
</div>
35 changes: 35 additions & 0 deletions test/pattern_assembler_tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,41 @@
test.equals(groupPattern.extendedTemplate.replace(/\s\s+/g, ' ').replace(/\n/g, ' ').trim(), expectedValue.trim());
test.done();
},
'processPatternRecursive - correctly replaces multiple stylemodifier classes on same partial' : function(test){
//arrange
var fs = require('fs-extra');
var pattern_assembler = new pa();
var patterns_dir = './test/files/_patterns';

var pl = {};
pl.config = {};
pl.data = {};
pl.data.link = {};
pl.config.debug = false;
pl.patterns = [];
pl.config.patterns = { source: patterns_dir};

var atomPattern = new object_factory.oPattern('test/files/_patterns/00-test/03-styled-atom.mustache', '00-test', '03-styled-atom.mustache');
atomPattern.template = fs.readFileSync(patterns_dir + '/00-test/03-styled-atom.mustache', 'utf8');
atomPattern.stylePartials = pattern_assembler.find_pattern_partials_with_style_modifiers(atomPattern);
atomPattern.parameteredPartials = pattern_assembler.find_pattern_partials_with_parameters(atomPattern);

var groupPattern = new object_factory.oPattern('test/files/_patterns/00-test/10-multiple-classes-numeric.mustache', '00-test', '10-multiple-classes-numeric.mustache');
groupPattern.template = fs.readFileSync(patterns_dir + '/00-test/10-multiple-classes-numeric.mustache', 'utf8');
groupPattern.stylePartials = pattern_assembler.find_pattern_partials_with_style_modifiers(groupPattern);
groupPattern.parameteredPartials = pattern_assembler.find_pattern_partials_with_parameters(groupPattern);

pl.patterns.push(atomPattern);
pl.patterns.push(groupPattern);

//act
pattern_assembler.process_pattern_recursive('test/files/_patterns/00-test/10-multiple-classes-numeric.mustache', pl, {});

//assert
var expectedValue = '<div class="test_group"> <span class="test_base foo1"> {{message}} </span> <span class="test_base foo1 foo2"> {{message}} </span> <span class="test_base foo1 foo2"> bar </span> </div>';
test.equals(groupPattern.extendedTemplate.replace(/\s\s+/g, ' ').replace(/\n/g, ' ').trim(), expectedValue.trim());
test.done();
},
'processPatternRecursive - correctly ignores a partial without a style modifier when the same partial later has a style modifier' : function(test){
//arrange
var fs = require('fs-extra');
Expand Down