@@ -46,11 +46,7 @@ tap.test('pseudpattern found and added as a pattern', function (test) {
46
46
//arrange
47
47
var pl = stubPatternlab ( ) ;
48
48
49
- var atomPattern = new Pattern ( '00-test/03-styled-atom.mustache' ) ;
50
- atomPattern . template = fs . readFileSync ( patterns_dir + '00-test/03-styled-atom.mustache' , 'utf8' ) ;
51
- atomPattern . extendedTemplate = atomPattern . template ;
52
- atomPattern . stylePartials = pattern_assembler . find_pattern_partials_with_style_modifiers ( atomPattern ) ;
53
-
49
+ var atomPattern = pattern_assembler . load_pattern_iterative ( '00-test/03-styled-atom.mustache' , pl ) ;
54
50
pattern_assembler . addPattern ( atomPattern , pl ) ;
55
51
56
52
//act
@@ -59,12 +55,27 @@ tap.test('pseudpattern found and added as a pattern', function (test) {
59
55
//assert
60
56
test . equals ( patternCountBefore + 1 , pl . patterns . length ) ;
61
57
test . equals ( pl . patterns [ 1 ] . patternPartial , 'test-styled-atom-alt' ) ;
62
- test . equals ( pl . patterns [ 1 ] . extendedTemplate . replace ( / \s \s + / g, ' ' ) . replace ( / \n / g, ' ' ) . trim ( ) , '<span class="test_base {{styleModifier}}"> {{message}} </span>' ) ;
63
58
test . equals ( JSON . stringify ( pl . patterns [ 1 ] . jsonFileData ) , JSON . stringify ( { "message" : "alternateMessage" } ) ) ;
64
59
test . equals ( pl . patterns [ 1 ] . patternLink , '00-test-03-styled-atom-alt' + path . sep + '00-test-03-styled-atom-alt.html' ) ;
65
60
} ) ;
66
61
} ) ;
67
62
63
+ tap . test ( 'pseudpattern does not pollute base pattern data' , function ( test ) {
64
+ //arrange
65
+ var pl = stubPatternlab ( ) ;
66
+
67
+ var atomPattern = pattern_assembler . load_pattern_iterative ( '00-test/03-styled-atom.mustache' , pl ) ;
68
+ pattern_assembler . addPattern ( atomPattern , pl ) ;
69
+
70
+ //act
71
+ var patternCountBefore = pl . patterns . length ;
72
+ return pph . find_pseudopatterns ( atomPattern , pl ) . then ( ( ) => {
73
+ //assert
74
+ test . equals ( pl . patterns [ 0 ] . patternPartial , 'test-styled-atom' ) ;
75
+ test . equals ( JSON . stringify ( pl . patterns [ 0 ] . jsonFileData ) , JSON . stringify ( { "message" : "baseMessage" } ) ) ;
76
+ } ) ;
77
+ } ) ;
78
+
68
79
tap . test ( 'pseudpattern variant includes stylePartials and parameteredPartials' , function ( test ) {
69
80
//arrange
70
81
var pl = stubPatternlab ( ) ;
0 commit comments