Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pattern Lab Node Core 2.11.1 #686

Merged
merged 5 commits into from
Sep 19, 2017
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
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,14 @@ This repository contains the core functionality for Pattern Lab Node. Pattern La

## Support for Pattern Lab Node

Pattern Lab Node wouldn't be what it is today without the support of the community. It will always be free and open source. Continued development is made possible in part from the support of [these wonderful project supporters](https://github.com/pattern-lab/patternlab-node/wiki/Thanks). If you want to learn more about supporting the project, visit the [Pattern Lab Node Patreon page](https://www.patreon.com/patternlab).
Pattern Lab Node wouldn't be what it is today without the support of the community. It will always be free and open source. Continued development is made possible in part from the support of [these wonderful project supporters](https://github.com/pattern-lab/patternlab-node/wiki/Thanks). If you want to learn more about supporting the project, visit the [Pattern Lab Node Patreon page](https://www.patreon.com/patternlab).

**:100: Thanks for support from the following:**
**:100: Thanks for support from the following:**

* **[Brad Frost](http://bradfrost.com/)**
* [Marcos Peebles](https://twitter.com/marcospeebles)
* [Susan Simkins](https://twitter.com/susanmsimkins)
* [Wilfred Nas](https://twitter.com/wnas)

## Installation

Expand Down
4 changes: 2 additions & 2 deletions core/lib/patternlab.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* patternlab-node - v2.11.0 - 2017
* patternlab-node - v2.11.1 - 2017
*
* Brian Muenzenmeyer, Geoff Pursell, Raphael Okon, tburny and the web community.
* Licensed under the MIT license.
Expand Down Expand Up @@ -504,7 +504,7 @@ var patternlab_engine = function (config) {
patternlab.data = {};
}
try {
patternlab.listitems = dataLoader.loadDataFromFile(path.resolve(paths.source.data, 'listitems.{json,yml,yaml}'));
patternlab.listitems = dataLoader.loadDataFromFile(path.resolve(paths.source.data, 'listitems'), fs);
} catch (ex) {
plutils.warning('WARNING: missing or malformed ' + paths.source.data + 'listitems file. Pattern Lab may not work without this file.');
patternlab.listitems = {};
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": "2.11.0",
"version": "2.11.1",
"main": "./core/lib/patternlab.js",
"dependencies": {
"chalk": "^1.1.3",
Expand Down
3 changes: 3 additions & 0 deletions test/files/_patterns/00-test/685-list.mustache
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{{#listItems.three}}
{{title}}
{{/listItems.three}}
36 changes: 35 additions & 1 deletion test/pattern_assembler_tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -456,6 +456,40 @@ tap.test('processPatternRecursive - ensure deep-nesting works', function(test) {
test.end();
});

tap.test('processPatternRecursive - 685 ensure listitems data is used', function(test) {
//arrange
var pattern_assembler = new pa();
var util = require('./util/test_utils.js');
var testPatternsPath = path.resolve(__dirname, 'files', '_patterns');
var pl = util.fakePatternLab(testPatternsPath);
pl.data.title = "0";
pl.listitems = {
"1": {
"title": "1"
},
"2": {
"title": "2"
},
"3": {
"title": "3"
}
};

pattern_assembler.combine_listItems(pl);

var listPatternPath = path.join('00-test', '685-list.mustache');
var listPattern = pattern_assembler.process_pattern_iterative(listPatternPath, pl);

//act
pattern_assembler.process_pattern_recursive(listPatternPath, pl);

//assert
test.true(listPattern.extendedTemplate.indexOf(1) > -1);
test.true(listPattern.extendedTemplate.indexOf(2) > -1);
test.true(listPattern.extendedTemplate.indexOf(3) > -1);
test.end();
});

tap.test('setState - applies any patternState matching the pattern', function(test) {
//arrange
var pa = require('../core/lib/pattern_assembler');
Expand Down Expand Up @@ -803,4 +837,4 @@ tap.test('parses pattern extra frontmatter correctly when frontmatter present',
//assert
test.equals(testPattern.allMarkdown.joke, 'bad','extra key not added');
test.end();
});
});