Fix _makeTemplateObjectGetter and add tests

Mainly fixes the case of the repetition where the template objects
for a label was an empty array instead of an array of repeated
components.
Merge pull request #1150 from Stuk/makeTemplateObjectGetter

Fix _makeTemplateObjectGetter and add tests