Skip to content

Commit

Permalink
Merge pull request #167 from pattern-lab/dev
Browse files Browse the repository at this point in the history
Dev push for v0.13.1
  • Loading branch information
Brian Muenzenmeyer authored and geoffp committed Feb 23, 2018
1 parent ba7951b commit 538a62a
Show file tree
Hide file tree
Showing 5 changed files with 73 additions and 3 deletions.
2 changes: 0 additions & 2 deletions packages/patternengine-node-twig/.travis.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
language: node_js

node_js:
- 4.1
- 4.0
- 0.12
- 0.11

Expand Down
4 changes: 4 additions & 0 deletions packages/patternengine-node-twig/CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
THIS CHANGELOG IS AN ATTEMPT TO DOCUMENT CHANGES TO THIS PROJECT.

PL-node-v0.13.1
- FIX: Allow verbose partials for list items
- THX: Thanks @e2tha-e

PL-node-v0.13.0
- FIX: Cleanup an old file and an incorrect entry in the .gitignore file
- CHG: Change order of pattern addition and ~variant pattern addition so they build naturally in the menu.
Expand Down
1 change: 1 addition & 0 deletions packages/patternengine-node-twig/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ This repository contains the vanilla builder logic, grunt and gulp configuration

* Download the [latest release of patternlab-node](https://github.com/pattern-lab/patternlab-node/releases/latest) from Github
* Via npm, run `npm install patternlab-node` (Note this will auto install the grunt version currently. see below)
* **NOTE** Node version 4.X is not officially supported yet, citing [a lot of Windows issues](https://github.com/nodejs/node-gyp/issues/629), including [mine](https://github.com/pattern-lab/patternlab-node/issues/162). Upgrade node at your own risk until otherwise stated.

### Choose Your Adventure! Now Vanilla, Grunt & Gulp

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
for(var j = 0; j < foundPartials.length; j++){

//get the partial
var partialName = foundPartials[j].match(/([a-z-]+)/ig)[0];
var partialName = foundPartials[j].match(/([\w\-\.\/~]+)/g)[0];
var partialPattern = pattern_assembler.get_pattern_by_key(partialName, patternlab);

//replace its reference within the block with the extended template
Expand Down
67 changes: 67 additions & 0 deletions packages/patternengine-node-twig/test/list_item_hunter_tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,73 @@
test.done();
},

'process_list_item_partials finds verbose partials and outputs repeated renders' : function(test){
var pattern1 = {
"template": "{{#listItems.one}}{{> 00-test/00-foo }}{{/listItems.one}}",
"extendedTemplate" : "{{#listItems.one}}{{> 00-test/00-foo }}{{/listItems.one}}",
"key": "test-patternName1",
"jsonFileData" : {}
};

var pattern2 = {
"template": "{{#listItems.two}}{{> 00-test/01-bar.mustache }}{{/listItems.two}}",
"extendedTemplate" : "{{#listItems.two}}{{> 00-test/01-bar.mustache }}{{/listItems.two}}",
"key": "test-patternName2",
"jsonFileData" : {}
};

var patternlab = {
"listitems": {
"1": [
{
"title": "Foo"
}
],
"2": [
{
"title": "Foo"
},
{
"title": "Bar"
}
]
},
"data": {
"link": {},
"partials": []
},
"config": {"debug": false},
"patterns": [
{
"template": "{{ title }}",
"extendedTemplate" : "{{ title }}",
"subdir": "00-test",
"fileName": "00-foo",
"jsonFileData" : {}
},
{
"template": "{{ title }}",
"extendedTemplate" : "{{ title }}",
"subdir": "00-test",
"fileName": "01-bar",
"jsonFileData" : {}
}
]
};

var list_item_hunter = new lih();

//act
list_item_hunter.process_list_item_partials(pattern1, patternlab);
list_item_hunter.process_list_item_partials(pattern2, patternlab);

//assert
test.equals(pattern1.extendedTemplate, "Foo" );
test.equals(pattern2.extendedTemplate, "FooBar" );

test.done();
},

'process_list_item_partials overwrites listItem property if that property is in local .listitem.json' : function(test){
//arrange
//setup current pattern from what we would have during execution
Expand Down

0 comments on commit 538a62a

Please sign in to comment.