-
Book Overview & Buying
-
Table Of Contents
Jasmine JavaScript Testing Update
By :
Jasmine Ajax is an official plugin developed to help out the testing of AJAX requests. It changes the browser's AJAX request infrastructure to a fake implementation.
This fake (or mocked) implementation, although simpler, still behaves like the real implementation to any code using its API.
Before we dig into the spec implementation, first we need to add the plugin to the project. Go to https://github.com/jasmine/jasmine-ajax/ and download the current release (which should be compatible with the Jasmine 2.x release). Place it inside the lib folder.
It is also needed to be added to the SpecRunner.html file, so go ahead and add another script:
<script type="text/javascript" src="lib/mock-ajax.js"></script>
Whenever you are using jQuery to make AJAX requests, under the hood it is actually using the XMLHttpRequest object to perform the request.
XMLHttpRequest is the standard JavaScript HTTP API. Even though its name suggests that it...
Change the font size
Change margin width
Change background colour