[Mobile, Gestures] Tests

Adjusted tests to call to correct
firedGesture.
This commit is contained in:
Shivam Dave 2015-08-11 10:57:52 -07:00
parent 3031579a62
commit caf1e3aea9
2 changed files with 26 additions and 7 deletions

View File

@ -31,7 +31,7 @@ define(
var JQLITE_FUNCTIONS = [ "on", "off", "unbind" ], var JQLITE_FUNCTIONS = [ "on", "off", "unbind" ],
LOG_FUNCTIONS = [ "error", "warn", "info", "debug"], LOG_FUNCTIONS = [ "error", "warn", "info", "debug"],
DOMAIN_OBJECT_METHODS = [ "getId", "getModel", DOMAIN_OBJECT_METHODS = [ "getName", "getModel",
"getCapability", "hasCapability", "useCapability"], "getCapability", "hasCapability", "useCapability"],
TEST_NAME = "Not Folder"; TEST_NAME = "Not Folder";
@ -63,9 +63,13 @@ define(
gesture = new PanGesture(mockLog, mockAgentService, gesture = new PanGesture(mockLog, mockAgentService,
mockElement, mockObject); mockElement, mockObject);
fireStartGesture = mockElement.on.calls[0]; fireStartGesture = mockElement.on.calls[0].args[1];
fireMoveGesture = mockElement.on.calls[1]; fireMoveGesture = mockElement.on.calls[1].args[1];
fireEndGesture = mockElement.on.calls[2]; fireEndGesture = mockElement.on.calls[2].args[1];
});
it("pan", function () {
}); });
}); });
} }

View File

@ -41,6 +41,9 @@ define(
mockElement, mockElement,
mockDomainObject, mockDomainObject,
mockObject, mockObject,
mockEvent,
mockTouchEvent,
mockChangedTouches,
gesture, gesture,
fireStartGesture, fireStartGesture,
fireMoveGesture, fireMoveGesture,
@ -59,15 +62,27 @@ define(
return c === 'type' && mockDomainObject; return c === 'type' && mockDomainObject;
}); });
mockAgentService.isMobile.andReturn(true); mockAgentService.isMobile.andReturn(true);
gesture = new PinchGesture(mockLog, mockAgentService, gesture = new PinchGesture(mockLog, mockAgentService,
mockElement, mockObject); mockElement, mockObject);
fireStartGesture = mockElement.on.calls[0];
fireMoveGesture = mockElement.on.calls[1]; fireStartGesture = mockElement.on.calls[0].args[1];
fireEndGesture = mockElement.on.calls[2]; fireMoveGesture = mockElement.on.calls[1].args[1];
fireEndGesture = mockElement.on.calls[2].args[1];
}); });
it("pinch", function () { it("pinch", function () {
mockTouchEvent = jasmine.createSpyObj("event", ["preventDefault", "stopPropagation",
"changedTouches"]);
mockChangedTouches = jasmine.createSpyObj("changedTouch", ["length"]);
mockChangedTouches.length.andReturn(2);
mockTouchEvent.changedTouches.andReturn(mockChangedTouches);
fireStartGesture(mockTouchEvent);
// fireMoveGesture(mockTouchEvent);
// fireEndGesture(mockTouchEvent);
}); });
}); });
} }