92
92
test . equals ( currentPattern . lineageIndex [ 1 ] , "molecules-primary-nav" ) ;
93
93
test . equals ( currentPattern . lineageIndex [ 2 ] , "molecules-search" ) ;
94
94
95
+ test . done ( ) ;
96
+ } ,
97
+
98
+ 'test lineage hunter finds lineage with spaced pattern parameters' : function ( test ) {
99
+ //setup current pattern from what we would have during execution
100
+ var currentPattern = {
101
+ "name" : "01-molecules-01-toast-00-error" ,
102
+ "subdir" : "01-molecules\\01-toast" ,
103
+ "filename" : "00-error.mustache" ,
104
+ "data" : null ,
105
+ "template" : "{{> atoms-error(message: 'That\'s no moon...') }}" ,
106
+ "patternPartial" : "{{> atoms-error(message: 'That\'s no moon...') }}" ,
107
+ "patternName" : "error" ,
108
+ "patternLink" : "01-molecules-01-toast-00-error/01-molecules-01-toast-00-error.html" ,
109
+ "patternGroup" : "molecules" ,
110
+ "patternSubGroup" : "molecules\\01-toast" ,
111
+ "flatPatternPath" : "01-molecules\\01-toast" ,
112
+ "patternState" : "" ,
113
+ "lineage" : [ ] ,
114
+ "lineageIndex" : [ ] ,
115
+ "lineageR" : [ ] ,
116
+ "lineageRIndex" : [ ]
117
+ } ;
118
+ var patternlab = {
119
+ patterns : [
120
+ {
121
+ "name" : "01-atoms-05-alerts-00-error" ,
122
+ "subdir" : "01-atoms\\05-alerts" ,
123
+ "filename" : "00-error.mustache" ,
124
+ "data" : null ,
125
+ "template" : "<h1> {{message}} </h1>" ,
126
+ "patternPartial" : "<h1> {{message}} </h1>" ,
127
+ "patternName" : "error" ,
128
+ "patternLink" : "01-atoms-05-alerts-00-error/01-atoms-05-alerts-00-error.html" ,
129
+ "patternGroup" : "atoms" ,
130
+ "patternSubGroup" : "atoms\\05-alerts" ,
131
+ "flatPatternPath" : "01-atoms\\05-alerts" ,
132
+ "patternState" : "" ,
133
+ "lineage" : [ ] ,
134
+ "lineageIndex" : [ ] ,
135
+ "lineageR" : [ ] ,
136
+ "lineageRIndex" : [ ]
137
+ }
138
+ ]
139
+ } ;
140
+
141
+ var lineage_hunter = new lh ( ) ;
142
+ lineage_hunter . find_lineage ( currentPattern , patternlab ) ;
143
+
144
+ test . equals ( currentPattern . lineageIndex . length , 1 ) ;
145
+ test . equals ( currentPattern . lineageIndex [ 0 ] , "atoms-error" ) ;
146
+
147
+ test . done ( ) ;
148
+ } ,
149
+
150
+ 'test lineage hunter finds lineage with unspaced pattern parameters' : function ( test ) {
151
+ //setup current pattern from what we would have during execution
152
+ var currentPattern = {
153
+ "name" : "01-molecules-01-toast-00-error" ,
154
+ "subdir" : "01-molecules\\01-toast" ,
155
+ "filename" : "00-error.mustache" ,
156
+ "data" : null ,
157
+ "template" : "{{>atoms-error(message: 'That\'s no moon...')}}" ,
158
+ "patternPartial" : "{{>atoms-error(message: 'That\'s no moon...')}}" ,
159
+ "patternName" : "error" ,
160
+ "patternLink" : "01-molecules-01-toast-00-error/01-molecules-01-toast-00-error.html" ,
161
+ "patternGroup" : "molecules" ,
162
+ "patternSubGroup" : "molecules\\01-toast" ,
163
+ "flatPatternPath" : "01-molecules\\01-toast" ,
164
+ "patternState" : "" ,
165
+ "lineage" : [ ] ,
166
+ "lineageIndex" : [ ] ,
167
+ "lineageR" : [ ] ,
168
+ "lineageRIndex" : [ ]
169
+ } ;
170
+ var patternlab = {
171
+ patterns : [
172
+ {
173
+ "name" : "01-atoms-05-alerts-00-error" ,
174
+ "subdir" : "01-atoms\\05-alerts" ,
175
+ "filename" : "00-error.mustache" ,
176
+ "data" : null ,
177
+ "template" : "<h1> {{message}} </h1>" ,
178
+ "patternPartial" : "<h1> {{message}} </h1>" ,
179
+ "patternName" : "error" ,
180
+ "patternLink" : "01-atoms-05-alerts-00-error/01-atoms-05-alerts-00-error.html" ,
181
+ "patternGroup" : "atoms" ,
182
+ "patternSubGroup" : "atoms\\05-alerts" ,
183
+ "flatPatternPath" : "01-atoms\\05-alerts" ,
184
+ "patternState" : "" ,
185
+ "lineage" : [ ] ,
186
+ "lineageIndex" : [ ] ,
187
+ "lineageR" : [ ] ,
188
+ "lineageRIndex" : [ ]
189
+ }
190
+ ]
191
+ } ;
192
+
193
+ var lineage_hunter = new lh ( ) ;
194
+ lineage_hunter . find_lineage ( currentPattern , patternlab ) ;
195
+
196
+ test . equals ( currentPattern . lineageIndex . length , 1 ) ;
197
+ test . equals ( currentPattern . lineageIndex [ 0 ] , "atoms-error" ) ;
198
+
95
199
test . done ( ) ;
96
200
}
97
201
} ;
98
202
99
- } ( ) ) ;
203
+ } ( ) ) ;
0 commit comments