Commit Graph

111 Commits

Author SHA1 Message Date
Kevin Ring
aae5d0bbd7 Add `RequestStub.andCallFunction.
The provided function is called with the stub and the fake XHR object when the stub matches a request, and it can inspect the request and then call the usual `andReturn`, `andError`, `andTimeout` functions based on the result.
2016-03-14 14:10:49 +11:00
Gregg Van Hove
cef5bbcc6c Merge branch 'master' of https://github.com/mooglemoogle/jasmine-ajax into mooglemoogle-master
- Merges #147
- Fixes #142
2016-02-16 17:00:12 -08:00
Gregg Van Hove
70d5dc42f3 Merge branch 'joeyparrish-master'
- Merges #146
- Fixes #145
2016-02-16 16:39:30 -08:00
Christopher Rock
ca2ee0202a Clearing request headers on fakeRequest.open()
https://github.com/jasmine/jasmine-ajax/issues/142
2016-01-19 22:01:43 -05:00
Joey Parrish
4df24d7e81 Add responseURL support
This adds the ability to mock responseURL, which is used to detect the
ultimate request URL when following 302 redirects.

For more information, see:
https://xhr.spec.whatwg.org/#the-responseurl-attribute

Closes jasmine/jasmine-ajax#145
2016-01-12 14:13:39 -08:00
Gregg Van Hove
920f8e7771 Merge branch 'salticus-master' 2015-10-28 12:09:21 -07:00
Gregg Van Hove
27fbe694e5 Merge branch 'master' of https://github.com/salticus/jasmine-ajax into salticus-master 2015-10-28 12:09:12 -07:00
Gregg Van Hove
00038a117a Include all spec file when running against combined file 2015-10-28 12:06:53 -07:00
Robert Stewart
056f96c935 Throw exception on multiple calls to jasmine.Ajax.uninstall.
Running multiple tests under Karma showed some race condition behavior.
2015-08-18 10:59:00 -06:00
Mickael Jeanroy
d3c52e8e29 Set the this context for event handler to the current XHR and pass proper ProgressEvent arguments
Fixes #108
2015-06-12 14:16:56 -07:00
unknown
6e77139011 added feature to match data/query against RegExp
Fixes #115
2015-06-12 13:33:26 -07:00
Martin Jantosovic
732f91f5f1 Allow error and timeout using RequestStub
Closes #111
2015-06-05 07:12:05 +02:00
Mickael Jeanroy
5d96ce9609 Event readystatechange is triggered when headers are available
According to the specification, readyState value must
be equal to 2 and readystatechange event should be triggered
once status and headers are available.

Close #97
2015-04-09 22:27:02 +02:00
Mickael Jeanroy
d2762c59f0 Event 'readystatechange' is now triggered
Close #102
2015-04-09 10:21:24 -07:00
Jen Hamon
fb5a98e63e Throw error on duplicate calls to MockAjax#install.
Fixes #96
2015-04-01 08:00:23 -07:00
Gregg Van Hove and Molly Trombley-McCann
09861cacba Cleanup removeEventListener
- Add tests
- Extract an EventBus
2015-03-04 11:34:55 -08:00
Tomek Wytrebowicz
f0b3027f18 Add spec for responseHeaders in andRaturn method 2015-02-17 09:58:10 +01:00
slackersoft
2d0bf42151 Include trailing newline in response headers to match browsers.
- Some libraries are relying on it existing, even though the specs
  doesn't say it should.

Fix #91
2015-01-23 13:11:42 -08:00
slackersoft
7446f2a190 Set response attribute for document responses 2014-11-26 21:25:49 -08:00
slackersoft
6b5cae82d5 Merge branch 'master' of https://github.com/albertyw/jasmine-ajax into albertyw-master
Conflicts:
	lib/mock-ajax.js
	spec/javascripts/fake-xml-http-request-spec.js
	spec/mock-ajax-toplevel-spec.js
2014-11-25 18:41:01 -08:00
slackersoft
0d14f5729d Deprecate the response function on fake request.
Starting on #49 #60 #89
2014-11-17 13:35:55 -08:00
slackersoft
711764e290 Support listening to XHR progress events via addEventListener
Fixes #79
2014-11-04 07:39:23 -08:00
slackersoft
80297da4c1 Support the remainder of XHR events
- onloadstart
- onprogress
- onabort
- onerror
- onload
- ontimeout
- onloadend

Fixes #81 Fixes #82
2014-11-01 20:43:21 -07:00
slackersoft
9681f79ece Fix cross browser issues for responseXML
- IE8 doesn't support indexOf, use our own arrayContains
- Most browsers don't allow 'text/html' when using a DOMParser, so we
  won't support it for now.
- Firefox doesn't want to serialize Documents over selenium, so don't
  have them in as our expected, just use instanceof ourselves
2014-11-01 16:26:12 -07:00
slackersoft
4751eaafbb Parse responseText into a responseXML if the contentType is xml-ish
closes #55
2014-11-01 15:13:55 -07:00
slackersoft
20f194d25c move integrationy specs into integration folder 2014-08-08 12:50:45 -07:00
slackersoft
85059718ad Move specs for the fake XHR to be more unity and less integrationy 2014-08-08 12:50:30 -07:00
slackersoft
35ffa0d72c Move some specs into unit tests for request tracker 2014-08-06 18:30:35 -07:00
slackersoft
d5e04f35af Add some unit tests for stubTracker 2014-08-06 08:02:55 -07:00
slackersoft
3a0fb720d2 Move some specs over to unit tests for requestStub 2014-08-06 07:45:03 -07:00
slackersoft
c825452b60 Move some specs over to unit tests for param parser 2014-08-05 08:08:54 -07:00
slackersoft
9322af290a Run specs against separate and concatenated files
- also get rid of spec/javascripts, since there's only js here
2014-08-04 13:15:28 -07:00
slackersoft
1ec196e525 refactor response headers normalization into it's own method 2014-07-30 18:46:02 -07:00
slackersoft
f38d9ad97c Merge branch 'master' of https://github.com/resident-uhlig/jasmine-ajax into resident-uhlig-master
Closes #72
2014-07-30 13:37:44 -07:00
slackersoft
8e1b1fc422 Record overridden mime types
Fix #74
2014-07-29 18:28:13 -07:00
slackersoft
864c8df82b Find response case-insensitively 2014-07-29 08:08:03 -07:00
slackersoft
0b2b4a4a2e Combine request headers with the same name 2014-07-29 07:45:12 -07:00
slackersoft
80af85b4cf Run jshint against spec files too. 2014-07-28 18:38:06 -07:00
Sven Uhlig
1e84763bd5 added support for multiple headers with same name 2014-07-13 03:14:02 +02:00
Kevin Montag
9908439d81 Throw an error if response() is called more than once on requests
Closes #71 Fixes #70
2014-07-11 12:58:34 -07:00
slackersoft
199324e720 Allow stubs to match only a particular http method (GET, POST, PUT, etc.)
Fixes #36
2014-07-10 12:44:56 -07:00
Danny Guinther
63bd205cfa Fix broken PhantomJS tests 2014-06-13 10:12:47 -04:00
Danny Guinther
898e0ed6e9 Better support XHR2 response
Conflicts:
	spec/javascripts/mock-ajax-toplevel-spec.js
2014-06-12 20:22:11 -07:00
Albert Wang
d49bb240ac Added XHR2's response and responseType 2014-06-12 20:21:30 -07:00
Albert Wang
f480e105c2 Renamed response function to makeResponse so that it doesn't conflict with the builtin method 2014-06-12 20:09:03 -07:00
slackersoft
54864a45d3 Allow extra qualifications when matching json content-type 2014-06-12 13:33:48 -07:00
slackersoft
d893394765 Add the ability to add custom parameter parsers at runtime 2014-06-12 13:29:33 -07:00
slackersoft
080bbde2b1 Allow to parse request params as JSON
fixes #51
2014-06-11 08:13:26 -07:00
slackersoft
477f044b4a The HTTP spec says it's 'Content-Type'
Fixes #67
2014-06-10 13:33:32 -07:00
Wil Linssen
49d953c954 Allow stubs to use Regex 2014-06-10 13:10:16 -07:00