|
100 | 100 | test.done();
|
101 | 101 | },
|
102 | 102 |
|
| 103 | + 'process_list_item_partials finds verbose partials and outputs repeated renders' : function(test){ |
| 104 | + var pattern1 = { |
| 105 | + "template": "{{#listItems.one}}{{> 00-test/00-foo }}{{/listItems.one}}", |
| 106 | + "extendedTemplate" : "{{#listItems.one}}{{> 00-test/00-foo }}{{/listItems.one}}", |
| 107 | + "key": "test-patternName1", |
| 108 | + "jsonFileData" : {} |
| 109 | + }; |
| 110 | + |
| 111 | + var pattern2 = { |
| 112 | + "template": "{{#listItems.two}}{{> 00-test/01-bar.mustache }}{{/listItems.two}}", |
| 113 | + "extendedTemplate" : "{{#listItems.two}}{{> 00-test/01-bar.mustache }}{{/listItems.two}}", |
| 114 | + "key": "test-patternName2", |
| 115 | + "jsonFileData" : {} |
| 116 | + }; |
| 117 | + |
| 118 | + var patternlab = { |
| 119 | + "listitems": { |
| 120 | + "1": [ |
| 121 | + { |
| 122 | + "title": "Foo" |
| 123 | + } |
| 124 | + ], |
| 125 | + "2": [ |
| 126 | + { |
| 127 | + "title": "Foo" |
| 128 | + }, |
| 129 | + { |
| 130 | + "title": "Bar" |
| 131 | + } |
| 132 | + ] |
| 133 | + }, |
| 134 | + "data": { |
| 135 | + "link": {}, |
| 136 | + "partials": [] |
| 137 | + }, |
| 138 | + "config": {"debug": false}, |
| 139 | + "patterns": [ |
| 140 | + { |
| 141 | + "template": "{{ title }}", |
| 142 | + "extendedTemplate" : "{{ title }}", |
| 143 | + "subdir": "00-test", |
| 144 | + "fileName": "00-foo", |
| 145 | + "jsonFileData" : {} |
| 146 | + }, |
| 147 | + { |
| 148 | + "template": "{{ title }}", |
| 149 | + "extendedTemplate" : "{{ title }}", |
| 150 | + "subdir": "00-test", |
| 151 | + "fileName": "01-bar", |
| 152 | + "jsonFileData" : {} |
| 153 | + } |
| 154 | + ] |
| 155 | + }; |
| 156 | + |
| 157 | + var list_item_hunter = new lih(); |
| 158 | + |
| 159 | + //act |
| 160 | + list_item_hunter.process_list_item_partials(pattern1, patternlab); |
| 161 | + list_item_hunter.process_list_item_partials(pattern2, patternlab); |
| 162 | + |
| 163 | + //assert |
| 164 | + test.equals(pattern1.extendedTemplate, "Foo" ); |
| 165 | + test.equals(pattern2.extendedTemplate, "FooBar" ); |
| 166 | + |
| 167 | + test.done(); |
| 168 | + }, |
| 169 | + |
103 | 170 | 'process_list_item_partials overwrites listItem property if that property is in local .listitem.json' : function(test){
|
104 | 171 | //arrange
|
105 | 172 | //setup current pattern from what we would have during execution
|
|
0 commit comments