eschwartz / jasmine-context

Additional Jasmine matchers for checking function call context.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

jasmine-context

jasmine-context is a matcher library for Jasmine to allow assertions on whether a function has been applied with a particular object as the this argument. You can optionally pass an array of arguments that must also match a call to the function.

Dependencies

  • Jasmine >= 1.3.1
  • jQuery >= 1.9

Usage

// without arguments
it("should call show", function () {
	spyOn($.fn, "show");
	$("#element").show();
	expect($.fn.show).toHaveBeenCalledInTheContextOf($("#element"));
});

// with arguments
it("should call show", function () {
	spyOn($.fn, "prop");
	$("#element").prop("disabled", true);
	expect($.fn.prop).toHaveBeenCalledInTheContextOf($("#element"), ["disabled", true]);
});

Additional Contributors

About

Additional Jasmine matchers for checking function call context.

License:MIT License


Languages

Language:JavaScript 100.0%