Update test specs to use Jasmine 3 (#2089)
* Updated Karma and Jasmine versions * Added DOMObserver class. Supports promise-based testing of DOM changes Update asynchronous test specs to use promises or done() instead of waitsFor/runs * Modified ActionCapability to duplicate context object properties as own properties for better object equality comparisons * Global find + replace to fix syntax issues * Fixed various issues caused by non-deterministic runtime order of tests in Jasmine 3. Fixed issues caused by changes to determination of object equality * Addressed review comments * Resolved merge conflicts with master * Fixed style errors * Use spy.calls.count() instead of manually tracking
This commit is contained in:
committed by
Pete Richards
parent
013eba744d
commit
433dee0314
@@ -45,7 +45,7 @@ define(
|
||||
mockTimeout = jasmine.createSpy('$timeout');
|
||||
mockDocument = jasmine.createSpyObj('$document', ['find']);
|
||||
mockBody = jasmine.createSpyObj('body', ['on', 'off', 'scope', 'css', 'unbind']);
|
||||
mockDocument.find.andReturn(mockBody);
|
||||
mockDocument.find.and.returnValue(mockBody);
|
||||
mockAgentService = jasmine.createSpyObj('agentService', ['isMobile', 'isPhone']);
|
||||
mockInfoService = jasmine.createSpyObj(
|
||||
'infoService',
|
||||
@@ -68,14 +68,14 @@ define(
|
||||
testMetadata = [{ name: "Test name", value: "Test value" }];
|
||||
mockHide = jasmine.createSpy('hide');
|
||||
|
||||
mockDomainObject.getModel.andReturn({ name: "Test Object" });
|
||||
mockDomainObject.useCapability.andCallFake(function (c) {
|
||||
mockDomainObject.getModel.and.returnValue({ name: "Test Object" });
|
||||
mockDomainObject.useCapability.and.callFake(function (c) {
|
||||
return (c === 'metadata') ? testMetadata : undefined;
|
||||
});
|
||||
mockElement.scope.andReturn(mockScope);
|
||||
mockScope.$on.andReturn(mockOff);
|
||||
mockInfoService.display.andReturn(mockHide);
|
||||
mockAgentService.isMobile.andReturn(true);
|
||||
mockElement.scope.and.returnValue(mockScope);
|
||||
mockScope.$on.and.returnValue(mockOff);
|
||||
mockInfoService.display.and.returnValue(mockHide);
|
||||
mockAgentService.isMobile.and.returnValue(true);
|
||||
gesture = new InfoButtonGesture(
|
||||
mockDocument,
|
||||
mockAgentService,
|
||||
@@ -83,7 +83,7 @@ define(
|
||||
mockElement,
|
||||
mockDomainObject
|
||||
);
|
||||
fireGesture = mockElement.on.mostRecentCall.args[1];
|
||||
fireGesture = mockElement.on.calls.mostRecent().args[1];
|
||||
});
|
||||
|
||||
it("expect click on the representation", function () {
|
||||
@@ -106,7 +106,7 @@ define(
|
||||
|
||||
// Get the touch start on the body
|
||||
// and fire the dismiss gesture
|
||||
fireDismissGesture = mockBody.on.mostRecentCall.args[1];
|
||||
fireDismissGesture = mockBody.on.calls.mostRecent().args[1];
|
||||
fireDismissGesture(mockEvent);
|
||||
// Expect Body to have been touched, event.preventDefault()
|
||||
// to be called, then the mockBody listener to be detached
|
||||
|
||||
Reference in New Issue
Block a user