diff --git a/src/Umbraco.Web.UI.Client/test/unit/common/services/template-helper.spec.js b/src/Umbraco.Web.UI.Client/test/unit/common/services/template-helper.spec.js new file mode 100644 index 0000000000..e1ba0670ed --- /dev/null +++ b/src/Umbraco.Web.UI.Client/test/unit/common/services/template-helper.spec.js @@ -0,0 +1,84 @@ +describe('service: templateHelper', function () { + + var templateHelper; + + beforeEach(module("umbraco.services")); + + beforeEach(inject(function ($injector) { + templateHelper = $injector.get('templateHelper'); + })); + + afterEach(inject(function ($rootScope) { + $rootScope.$apply(); + })); + + describe('getInsertDictionarySnippet', function () { + + it('should return the snippet for inserting a dictionary item', function () { + var snippet = '@Umbraco.GetDictionaryValue("nodeName")'; + expect(templateHelper.getInsertDictionarySnippet('nodeName')).toBe(snippet); + }); + + }); + + describe('getInsertPartialSnippet', function () { + + it('should return the snippet for inserting a partial', function () { + var snippet = '@Html.Partial("nodeName")'; + expect(templateHelper.getInsertPartialSnippet("nodeName")).toBe(snippet); + }); + + }); + + describe('getQuerySnippet', function () { + + it('should return the snippet for a query', function () { + var queryExpression = "queryExpression"; + var snippet = "\n@{\n" + "\tvar selection = " + queryExpression + ";\n}\n"; + snippet += "