Skip to content
This repository was archived by the owner on Dec 10, 2019. It is now read-only.

Commit 8c85264

Browse files
committed
fixed unit test. change lineage init a bit
1 parent 0ce790d commit 8c85264

File tree

4 files changed

+25
-9
lines changed

4 files changed

+25
-9
lines changed

builder/lineage_hunter.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,6 @@
1515

1616
function findlineage(pattern, patternlab){
1717

18-
pattern.lineage = [];
19-
pattern.lineageIndex = [];
20-
pattern.lineageR = [];
21-
pattern.lineageRIndex = [];
2218
//find the {{> template-name }} within patterns
2319
var matches = pattern.template.match(/{{>([ ]+)?([A-Za-z0-9-]+)(?:\:[A-Za-z0-9-]+)?(?:(| )\(.*)?([ ]+)}}/g);
2420
if(matches !== null){

builder/object_factory.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@
2323
this.patternGroup = name.substring(name.indexOf('-') + 1, name.indexOf('-', 4) + 1 - name.indexOf('-') + 1);
2424
this.patternSubGroup = subdir.substring(subdir.indexOf('/') + 4);
2525
this.flatPatternPath = subdir.replace(/\//g, '-');
26+
this.lineage = [];
27+
this.lineageIndex = [];
28+
this.lineageR = [];
29+
this.lineageRIndex = [];
2630
};
2731

2832
var oBucket = function(name){

builder/patternlab.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ var patternlab_engine = function(){
8383
}
8484

8585
//make a new Pattern Object
86-
var flatPatternName = subdir.replace(/\\/g, '-') + '-' + patternName;
86+
var flatPatternName = subdir.replace(/[\/\\]/g, '-') + '-' + patternName;
8787

8888
flatPatternName = flatPatternName.replace(/\\/g, '-');
8989
currentPattern = new of.oPattern(flatPatternName, subdir, filename, {});

test/lineage_hunter_tests.js

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,11 @@
1919
"patternGroup": "organisms",
2020
"patternSubGroup": "organisms\\00-global",
2121
"flatPatternPath": "02-organisms\\00-global",
22-
"patternState": ""
22+
"patternState": "",
23+
"lineage": [],
24+
"lineageIndex": [],
25+
"lineageR": [],
26+
"lineageRIndex": []
2327
};
2428
var patternlab = {
2529
patterns: [
@@ -35,7 +39,11 @@
3539
"patternGroup": "atoms",
3640
"patternSubGroup": "atoms\\03-images",
3741
"flatPatternPath": "00-atoms\\03-images",
38-
"patternState": ""
42+
"patternState": "",
43+
"lineage": [],
44+
"lineageIndex": [],
45+
"lineageR": [],
46+
"lineageRIndex": []
3947
},
4048
{
4149
"name": "01-molecules-05-navigation-00-primary-nav",
@@ -49,7 +57,11 @@
4957
"patternGroup": "molecules",
5058
"patternSubGroup": "molecules\\05-navigation",
5159
"flatPatternPath": "01-molecules\\05-navigation",
52-
"patternState": ""
60+
"patternState": "",
61+
"lineage": [],
62+
"lineageIndex": [],
63+
"lineageR": [],
64+
"lineageRIndex": []
5365
},
5466
{
5567
"name": "01-molecules-04-forms-00-search",
@@ -63,7 +75,11 @@
6375
"patternGroup": "molecules",
6476
"patternSubGroup": "molecules\\04-forms",
6577
"flatPatternPath": "01-molecules\\04-forms",
66-
"patternState": ""
78+
"patternState": "",
79+
"lineage": [],
80+
"lineageIndex": [],
81+
"lineageR": [],
82+
"lineageRIndex": []
6783
}
6884
]
6985
};

0 commit comments

Comments
 (0)