|
4 | 4 | var lih = require('../core/lib/list_item_hunter');
|
5 | 5 | var Pattern = require('../core/lib/object_factory').Pattern;
|
6 | 6 | var extend = require('util')._extend;
|
| 7 | + var pa = require('../core/lib/pattern_assembler'); |
| 8 | + var pattern_assembler = new pa(); |
7 | 9 |
|
8 | 10 | // fake pattern creators
|
9 | 11 | function createFakeListPattern(customProps) {
|
|
17 | 19 | }
|
18 | 20 |
|
19 | 21 | function createFakePatternLab(customProps) {
|
| 22 | + |
| 23 | + //NOTE: These listitems are faked so that pattern_assembler.combine_listitems has already clobbered them. |
| 24 | + |
20 | 25 | var pl = {
|
21 | 26 | "listitems": {
|
22 | 27 | "1": [
|
23 |
| - { "title": "Foo" }, |
24 |
| - { "message" : "FooM"} |
| 28 | + { |
| 29 | + "title": "Foo", |
| 30 | + "message": "FooM" |
| 31 | + } |
25 | 32 | ],
|
26 |
| - "2": [ |
27 |
| - { "title": "Foo" }, |
28 |
| - { "title": "Bar" } |
| 33 | + "2" : [ |
| 34 | + { |
| 35 | + "title": "Foo", |
| 36 | + "message": "FooM" |
| 37 | + }, |
| 38 | + { |
| 39 | + "title": "Bar", |
| 40 | + "message": "BarM" |
| 41 | + } |
| 42 | + ], |
| 43 | + "3": [ |
| 44 | + { |
| 45 | + "title": "Foo", |
| 46 | + "message": "FooM" |
| 47 | + }, |
| 48 | + { |
| 49 | + "title": "Bar", |
| 50 | + "message": "BarM" |
| 51 | + }, |
| 52 | + { |
| 53 | + "title": "Baz", |
| 54 | + "message": "BazM" |
| 55 | + }, |
29 | 56 | ]
|
30 | 57 | },
|
31 | 58 | "data": {
|
|
349 | 376 | 'process_list_item_partials - correctly ignores already processed partial that had a style modifier when the same partial no longer has one' : function(test){
|
350 | 377 | //arrange
|
351 | 378 | var fs = require('fs-extra');
|
352 |
| - var pa = require('../core/lib/pattern_assembler'); |
353 |
| - var pattern_assembler = new pa(); |
354 | 379 | var list_item_hunter = new lih();
|
355 |
| - var patterns_dir = './test/files/_patterns'; |
356 | 380 |
|
357 | 381 | var pl = createFakePatternLab();
|
358 | 382 |
|
359 | 383 | var atomPattern = new Pattern('00-test/03-styled-atom.mustache');
|
360 |
| - atomPattern.template = fs.readFileSync(patterns_dir + '/00-test/03-styled-atom.mustache', 'utf8'); |
| 384 | + atomPattern.template = fs.readFileSync(pl.config.paths.source.patterns + '/00-test/03-styled-atom.mustache', 'utf8'); |
361 | 385 | atomPattern.extendedTemplate = atomPattern.template;
|
362 | 386 | atomPattern.stylePartials = pattern_assembler.find_pattern_partials_with_style_modifiers(atomPattern);
|
363 | 387 |
|
364 | 388 | var anotherStyledAtomPattern = new Pattern('00-test/12-another-styled-atom.mustache');
|
365 |
| - anotherStyledAtomPattern.template = fs.readFileSync(patterns_dir + '/00-test/12-another-styled-atom.mustache', 'utf8'); |
| 389 | + anotherStyledAtomPattern.template = fs.readFileSync(pl.config.paths.source.patterns + '/00-test/12-another-styled-atom.mustache', 'utf8'); |
366 | 390 | anotherStyledAtomPattern.extendedTemplate = anotherStyledAtomPattern.template;
|
367 | 391 | anotherStyledAtomPattern.stylePartials = pattern_assembler.find_pattern_partials_with_style_modifiers(anotherStyledAtomPattern);
|
368 | 392 |
|
369 | 393 | var listPattern = new Pattern('00-test/13-listitem.mustache');
|
370 |
| - listPattern.template = fs.readFileSync(patterns_dir + '/00-test/13-listitem.mustache', 'utf8'); |
| 394 | + listPattern.template = fs.readFileSync(pl.config.paths.source.patterns + '/00-test/13-listitem.mustache', 'utf8'); |
371 | 395 | listPattern.extendedTemplate = listPattern.template;
|
372 | 396 | listPattern.stylePartials = pattern_assembler.find_pattern_partials_with_style_modifiers(listPattern);
|
373 | 397 |
|
|
0 commit comments