Single Accessor Spies
Methods for validating and creating a single automatic accessor of a particular type. If a resource name does not exist on the instance, these methods will throw, ensuring that rename errors are caught by a test suite.
Example
The following spec will pass because the instance contains a ref named usersGridRef.
Production code:
refs: [{
ref: 'usersGridRef',
selector: '#usersGridId'
}],
onUsersGridHideButtonClick: function () {
this.getUsersGridRef().hide();
}
Test suite:
it('should hide the users grid', function () {
var ref = jasmine.createSpyObject('usersGrid', ['hide']);
ExtSpec.Jasmine.createRefSpy(controller, 'usersGridRef').andReturn(ref);
// getUsersGridRef now exists
controller.onUsersGridHideButtonClick();
expect(controller.getUsersGridRef).toHaveBeenCalled();
expect(ref.hide).tohHaveBeenCalled();
});
Helpers
createModelSpy
Creates and returns a getter spy for model
y in instance
x:
ExtSpec.Jasmine.createModelSpy(x, y);
Creates and returns a getter spy for model
y in instance
x using
configuration z:
ExtSpec.Jasmine.createModelSpy(x, y, z);
createViewSpy
Creates and returns a getter spy for view
y in instance
x:
ExtSpec.Jasmine.createViewSpy(x, y);
Creates and returns a getter spy for view
y in instance
x using
configuration z:
ExtSpec.Jasmine.createViewSpy(x, y, z);
createControllerSpy
Creates and returns a getter spy for controller
y in instance
x:
ExtSpec.Jasmine.createControllerSpy(x, y);
Creates and returns a getter spy for controller
y in instance
x using
configuration z:
ExtSpec.Jasmine.createControllerSpy(x, y, z);
createStoreSpy
Creates and returns a getter spy for store
y in instance
x:
ExtSpec.Jasmine.createStoreSpy(x, y);
Creates and returns a getter spy for store
y in instance
x using
configuration z:
ExtSpec.Jasmine.createStoreSpy(x, y, z);
createRefSpy
Creates and returns a getter spy for ref
y in instance
x:
ExtSpec.Jasmine.createRefSpy(x, y);
Creates and returns a getter spy for ref
y in instance
x using
configuration z:
ExtSpec.Jasmine.createRefSpy(x, y, z);
createConfigSpy
Creates accessor spies and returns the getter for config
y in instance
x:
ExtSpec.Jasmine.createConfigSpy(x, y);
Creates accessor spies and returns the getter for config
y in instance
x using
configuration z:
ExtSpec.Jasmine.createConfigSpy(x, y, z);