|
522 | 522 | test.equals(bookendPattern.extendedTemplate.replace(/\s\s+/g, ' ').replace(/\n/g, ' ').trim(), expectedValue.trim()); |
523 | 523 | test.done(); |
524 | 524 | }, |
525 | | - 'processPatternIterative - ignores files that start with underscore' : function(test){ |
526 | | - //arrange |
527 | | - var diveSync = require('diveSync'); |
528 | | - var fs = require('fs-extra'); |
529 | | - var pa = require('../builder/pattern_assembler'); |
530 | | - var pattern_assembler = new pa(); |
531 | | - var patterns_dir = './test/files/_patterns'; |
532 | | - var patternlab = {}; |
533 | | - patternlab.config = fs.readJSONSync('./config.json'); |
534 | | - patternlab.config.patterns = {source: patterns_dir}; |
535 | | - patternlab.data = fs.readJSONSync(path.resolve(patternlab.config.paths.source.data, 'data.json')); |
536 | | - patternlab.listitems = fs.readJSONSync(path.resolve(patternlab.config.paths.source.data, 'listitems.json')); |
537 | | - patternlab.header = fs.readFileSync(path.resolve(patternlab.config.paths.source.patternlabFiles, 'pattern-header-footer/header.html'), 'utf8'); |
538 | | - patternlab.footer = fs.readFileSync(path.resolve(patternlab.config.paths.source.patternlabFiles, 'pattern-header-footer/footer.html'), 'utf8'); |
539 | | - |
540 | | - patternlab.patterns = []; |
541 | | - patternlab.data.link = {}; |
542 | | - patternlab.partials = {}; |
543 | | - |
544 | | - //act |
545 | | - diveSync(patterns_dir, |
546 | | - { |
547 | | - filter: function(path, dir){ |
548 | | - if(dir){ |
549 | | - var remainingPath = path.replace(patterns_dir, ''); |
550 | | - var isValidPath = remainingPath.indexOf('/_') === -1; |
551 | | - return isValidPath; |
552 | | - } |
553 | | - return true; |
554 | | - } |
555 | | - }, |
556 | | - function(err, file){ |
557 | | - //log any errors |
558 | | - if(err){ |
559 | | - console.log(err); |
560 | | - return; |
561 | | - } |
562 | | - |
563 | | - pattern_assembler.process_pattern_iterative(path.resolve(file), patternlab); |
564 | | - } |
565 | | - ); |
566 | | - |
567 | | - //assert |
568 | | - var foundIgnoredPattern = false; |
569 | | - for(var i = 0; i < patternlab.patterns.length; i++){ |
570 | | - if(patternlab.patterns[i].fileName[0] === '_'){ |
571 | | - foundIgnoredPattern = true; |
572 | | - } |
573 | | - } |
574 | | - test.equals(foundIgnoredPattern, false); |
575 | | - test.done(); |
576 | | - }, |
577 | 525 | 'processPatternIterative - ignores files that are variants' : function(test){ |
578 | 526 | //arrange |
579 | 527 | var diveSync = require('diveSync'); |
|
0 commit comments