diff --git a/README.md b/README.md index 1959d1f4a..9eb9eed3b 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/core/lib/patternlab.js b/core/lib/patternlab.js index 3de471df1..c3841dc76 100644 --- a/core/lib/patternlab.js +++ b/core/lib/patternlab.js @@ -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. @@ -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 = {}; diff --git a/package.json b/package.json index 29f934f20..f09565fef 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/test/files/_patterns/00-test/685-list.mustache b/test/files/_patterns/00-test/685-list.mustache new file mode 100644 index 000000000..1b3623c07 --- /dev/null +++ b/test/files/_patterns/00-test/685-list.mustache @@ -0,0 +1,3 @@ +{{#listItems.three}} +{{title}} +{{/listItems.three}} diff --git a/test/pattern_assembler_tests.js b/test/pattern_assembler_tests.js index bb92d1d91..5d4e02a45 100644 --- a/test/pattern_assembler_tests.js +++ b/test/pattern_assembler_tests.js @@ -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'); @@ -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(); -}); \ No newline at end of file +});