diff --git a/platform/representation/test/TemplateLinkerSpec.js b/platform/representation/test/TemplateLinkerSpec.js index 6f525ce73f..28e0e87ffd 100644 --- a/platform/representation/test/TemplateLinkerSpec.js +++ b/platform/representation/test/TemplateLinkerSpec.js @@ -37,6 +37,8 @@ define( mockElement, mockTemplates, mockElements, + mockHttpPromise, + mockChainPromise, linker; beforeEach(function () { @@ -45,9 +47,13 @@ define( mockLog = jasmine.createSpyObj('$log', ['error', 'warn']); mockScope = jasmine.createSpyObj('$scope', ['$on']); mockElement = jasmine.createSpyObj('element', JQLITE_METHODS); + mockHttpPromise = jasmine.createSpyObj('promise1', ['then']); + mockChainPromise = jasmine.createSpyObj('promise2', ['then']); mockTemplates = {}; mockElements = {}; + mockHttp.get.andReturn(mockHttpPromise); + mockHttpPromise.then.andReturn(mockChainPromise); mockCompile.andCallFake(function (html) { mockTemplates[html] = jasmine.createSpy('template'); mockElements[html] = @@ -89,6 +95,49 @@ define( expect(mockElement.replaceWith) .toHaveBeenCalledWith(commentElement); }); + + it("provides a function to change templates", function () { + expect(changeTemplate).toEqual(jasmine.any(Function)); + }); + + describe("and then changing templates", function () { + var testUrl, + testTemplate; + + beforeEach(function () { + testUrl = "some/url/template.html"; + testTemplate = "