jasmine-jquery-rails 1.5.6 → 1.5.9

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0f654c4dc8bb49ce27762438413c5d27fab85de3
4
- data.tar.gz: cf27d66ca7dd55e80aca300e307cbc78af1060d4
3
+ metadata.gz: da4c21bea3d761fbf0cfb01e25af8ae03005a893
4
+ data.tar.gz: dda8eabbc7b390904a555042905dd24b0522a454
5
5
  SHA512:
6
- metadata.gz: ae84de8e90ce7b68c4f5b4fbfa7d4ab6fb72b2e340ca269645e64688c4d92f9063ba332ad9c62131d7155822338982d5194e8a95e83c5598f7e1f452450934ff
7
- data.tar.gz: cd539572c64e79c0957c31744f18281bf781da727eb04ac18f045e4edddb639b72747e508bdfeaefa467bfa6082fb8f110ff50e91d8528440671f2ed3c0a94f9
6
+ metadata.gz: 2446540a0e916a16cbc29db9b086df18e6733b4406d32452675e06bf25a26d63a38d84bd64bece3f74075047f36e9f8e74073d3aacef33dec37eb9bcb878a995
7
+ data.tar.gz: fbe32b410456ac91663d3ef6055702a0c73bc55052a578833aa404d3e43999e0fd3fee33b16ad05b99123ab337cad03bdcb18f43d93ae3fb79eaab3935c1919b
@@ -1,7 +1,7 @@
1
1
  module Jasmine
2
2
  module Jquery
3
3
  module Rails
4
- VERSION = "1.5.6"
4
+ VERSION = "1.5.9"
5
5
  end
6
6
  end
7
7
  end
@@ -1,664 +1,705 @@
1
1
  /*!
2
- Jasmine-jQuery: a set of jQuery helpers for Jasmine tests.
2
+ Jasmine-jQuery: a set of jQuery helpers for Jasmine tests.
3
3
 
4
- Version 1.5.6
4
+ Version 1.5.9
5
5
 
6
- https://github.com/velesin/jasmine-jquery
6
+ https://github.com/velesin/jasmine-jquery
7
7
 
8
- Copyright (c) 2010-2013 Wojciech Zawistowski, Travis Jeffery
8
+ Copyright (c) 2010-2013 Wojciech Zawistowski, Travis Jeffery
9
9
 
10
- Permission is hereby granted, free of charge, to any person obtaining
11
- a copy of this software and associated documentation files (the
12
- "Software"), to deal in the Software without restriction, including
13
- without limitation the rights to use, copy, modify, merge, publish,
14
- distribute, sublicense, and/or sell copies of the Software, and to
15
- permit persons to whom the Software is furnished to do so, subject to
16
- the following conditions:
10
+ Permission is hereby granted, free of charge, to any person obtaining
11
+ a copy of this software and associated documentation files (the
12
+ "Software"), to deal in the Software without restriction, including
13
+ without limitation the rights to use, copy, modify, merge, publish,
14
+ distribute, sublicense, and/or sell copies of the Software, and to
15
+ permit persons to whom the Software is furnished to do so, subject to
16
+ the following conditions:
17
17
 
18
- The above copyright notice and this permission notice shall be
19
- included in all copies or substantial portions of the Software.
18
+ The above copyright notice and this permission notice shall be
19
+ included in all copies or substantial portions of the Software.
20
20
 
21
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
22
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
23
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
24
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
25
- LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
26
- OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
27
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
22
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
23
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
24
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
25
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
26
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
27
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
28
28
  */
29
- var readFixtures = function() {
30
- return jasmine.getFixtures().proxyCallTo_('read', arguments)
31
- }
32
-
33
- var preloadFixtures = function() {
34
- jasmine.getFixtures().proxyCallTo_('preload', arguments)
35
- }
36
29
 
37
- var loadFixtures = function() {
38
- jasmine.getFixtures().proxyCallTo_('load', arguments)
39
- }
30
+ +function (jasmine, $) { "use strict";
40
31
 
41
- var appendLoadFixtures = function() {
42
- jasmine.getFixtures().proxyCallTo_('appendLoad', arguments)
43
- }
32
+ jasmine.spiedEventsKey = function (selector, eventName) {
33
+ return [$(selector).selector, eventName].toString()
34
+ }
35
+
36
+ jasmine.getFixtures = function () {
37
+ return jasmine.currentFixtures_ = jasmine.currentFixtures_ || new jasmine.Fixtures()
38
+ }
44
39
 
45
- var setFixtures = function(html) {
46
- jasmine.getFixtures().proxyCallTo_('set', arguments)
47
- }
40
+ jasmine.getStyleFixtures = function () {
41
+ return jasmine.currentStyleFixtures_ = jasmine.currentStyleFixtures_ || new jasmine.StyleFixtures()
42
+ }
43
+
44
+ jasmine.Fixtures = function () {
45
+ this.containerId = 'jasmine-fixtures'
46
+ this.fixturesCache_ = {}
47
+ this.fixturesPath = 'spec/javascripts/fixtures'
48
+ }
48
49
 
49
- var appendSetFixtures = function() {
50
- jasmine.getFixtures().proxyCallTo_('appendSet', arguments)
51
- }
50
+ jasmine.Fixtures.prototype.set = function (html) {
51
+ this.cleanUp()
52
+ return this.createContainer_(html)
53
+ }
52
54
 
53
- var sandbox = function(attributes) {
54
- return jasmine.getFixtures().sandbox(attributes)
55
- }
56
-
57
- var spyOnEvent = function(selector, eventName) {
58
- return jasmine.JQuery.events.spyOn(selector, eventName)
59
- }
60
-
61
- var preloadStyleFixtures = function() {
62
- jasmine.getStyleFixtures().proxyCallTo_('preload', arguments)
63
- }
64
-
65
- var loadStyleFixtures = function() {
66
- jasmine.getStyleFixtures().proxyCallTo_('load', arguments)
67
- }
68
-
69
- var appendLoadStyleFixtures = function() {
70
- jasmine.getStyleFixtures().proxyCallTo_('appendLoad', arguments)
71
- }
72
-
73
- var setStyleFixtures = function(html) {
74
- jasmine.getStyleFixtures().proxyCallTo_('set', arguments)
75
- }
76
-
77
- var appendSetStyleFixtures = function(html) {
78
- jasmine.getStyleFixtures().proxyCallTo_('appendSet', arguments)
79
- }
80
-
81
- var loadJSONFixtures = function() {
82
- return jasmine.getJSONFixtures().proxyCallTo_('load', arguments)
83
- }
84
-
85
- var getJSONFixture = function(url) {
86
- return jasmine.getJSONFixtures().proxyCallTo_('read', arguments)[url]
87
- }
88
-
89
- jasmine.spiedEventsKey = function (selector, eventName) {
90
- return [$(selector).selector, eventName].toString()
91
- }
92
-
93
- jasmine.getFixtures = function() {
94
- return jasmine.currentFixtures_ = jasmine.currentFixtures_ || new jasmine.Fixtures()
95
- }
96
-
97
- jasmine.getStyleFixtures = function() {
98
- return jasmine.currentStyleFixtures_ = jasmine.currentStyleFixtures_ || new jasmine.StyleFixtures()
99
- }
100
-
101
- jasmine.Fixtures = function() {
102
- this.containerId = 'jasmine-fixtures'
103
- this.fixturesCache_ = {}
104
- this.fixturesPath = 'spec/javascripts/fixtures'
105
- }
106
-
107
- jasmine.Fixtures.prototype.set = function(html) {
108
- this.cleanUp()
109
- this.createContainer_(html)
110
- }
111
-
112
- jasmine.Fixtures.prototype.appendSet= function(html) {
113
- this.addToContainer_(html)
114
- }
115
-
116
- jasmine.Fixtures.prototype.preload = function() {
117
- this.read.apply(this, arguments)
118
- }
119
-
120
- jasmine.Fixtures.prototype.load = function() {
121
- this.cleanUp()
122
- this.createContainer_(this.read.apply(this, arguments))
123
- }
124
-
125
- jasmine.Fixtures.prototype.appendLoad = function() {
126
- this.addToContainer_(this.read.apply(this, arguments))
127
- }
128
-
129
- jasmine.Fixtures.prototype.read = function() {
130
- var htmlChunks = []
55
+ jasmine.Fixtures.prototype.appendSet= function (html) {
56
+ this.addToContainer_(html)
57
+ }
131
58
 
132
- var fixtureUrls = arguments
133
- for(var urlCount = fixtureUrls.length, urlIndex = 0; urlIndex < urlCount; urlIndex++) {
134
- htmlChunks.push(this.getFixtureHtml_(fixtureUrls[urlIndex]))
59
+ jasmine.Fixtures.prototype.preload = function () {
60
+ this.read.apply(this, arguments)
135
61
  }
136
62
 
137
- return htmlChunks.join('')
138
- }
63
+ jasmine.Fixtures.prototype.load = function () {
64
+ this.cleanUp()
65
+ this.createContainer_(this.read.apply(this, arguments))
66
+ }
139
67
 
140
- jasmine.Fixtures.prototype.clearCache = function() {
141
- this.fixturesCache_ = {}
142
- }
68
+ jasmine.Fixtures.prototype.appendLoad = function () {
69
+ this.addToContainer_(this.read.apply(this, arguments))
70
+ }
143
71
 
144
- jasmine.Fixtures.prototype.cleanUp = function() {
145
- $('#' + this.containerId).remove()
146
- }
72
+ jasmine.Fixtures.prototype.read = function () {
73
+ var htmlChunks = []
74
+ , fixtureUrls = arguments
147
75
 
148
- jasmine.Fixtures.prototype.sandbox = function(attributes) {
149
- var attributesToSet = attributes || {}
150
- return $('<div id="sandbox" />').attr(attributesToSet)
151
- }
76
+ for(var urlCount = fixtureUrls.length, urlIndex = 0; urlIndex < urlCount; urlIndex++) {
77
+ htmlChunks.push(this.getFixtureHtml_(fixtureUrls[urlIndex]))
78
+ }
152
79
 
153
- jasmine.Fixtures.prototype.createContainer_ = function(html) {
154
- var container
155
- if(html instanceof $) {
156
- container = $('<div id="' + this.containerId + '" />')
157
- container.html(html)
158
- } else {
159
- container = '<div id="' + this.containerId + '">' + html + '</div>'
80
+ return htmlChunks.join('')
160
81
  }
161
- $(document.body).append(container)
162
- }
163
82
 
164
- jasmine.Fixtures.prototype.addToContainer_ = function(html){
165
- var container = $(document.body).find('#'+this.containerId).append(html)
166
- if(!container.length){
167
- this.createContainer_(html)
83
+ jasmine.Fixtures.prototype.clearCache = function () {
84
+ this.fixturesCache_ = {}
168
85
  }
169
- }
170
86
 
171
- jasmine.Fixtures.prototype.getFixtureHtml_ = function(url) {
172
- if (typeof this.fixturesCache_[url] === 'undefined') {
173
- this.loadFixtureIntoCache_(url)
87
+ jasmine.Fixtures.prototype.cleanUp = function () {
88
+ $('#' + this.containerId).remove()
174
89
  }
175
- return this.fixturesCache_[url]
176
- }
177
90
 
178
- jasmine.Fixtures.prototype.loadFixtureIntoCache_ = function(relativeUrl) {
179
- var url = this.makeFixtureUrl_(relativeUrl)
180
- var request = $.ajax({
181
- type: "GET",
182
- url: url + "?" + new Date().getTime(),
183
- async: false
184
- })
185
- this.fixturesCache_[relativeUrl] = request.responseText
186
- }
91
+ jasmine.Fixtures.prototype.sandbox = function (attributes) {
92
+ var attributesToSet = attributes || {}
93
+ return $('<div id="sandbox" />').attr(attributesToSet)
94
+ }
187
95
 
188
- jasmine.Fixtures.prototype.makeFixtureUrl_ = function(relativeUrl){
189
- return this.fixturesPath.match('/$') ? this.fixturesPath + relativeUrl : this.fixturesPath + '/' + relativeUrl
190
- }
96
+ jasmine.Fixtures.prototype.createContainer_ = function (html) {
97
+ var container = $('<div>')
98
+ .attr('id', this.containerId)
99
+ .html(html)
191
100
 
192
- jasmine.Fixtures.prototype.proxyCallTo_ = function(methodName, passedArguments) {
193
- return this[methodName].apply(this, passedArguments)
194
- }
101
+ $(document.body).append(container)
102
+ return container
103
+ }
195
104
 
105
+ jasmine.Fixtures.prototype.addToContainer_ = function (html){
106
+ var container = $(document.body).find('#'+this.containerId).append(html)
107
+ if(!container.length){
108
+ this.createContainer_(html)
109
+ }
110
+ }
196
111
 
197
- jasmine.StyleFixtures = function() {
198
- this.fixturesCache_ = {}
199
- this.fixturesNodes_ = []
200
- this.fixturesPath = 'spec/javascripts/fixtures'
201
- }
112
+ jasmine.Fixtures.prototype.getFixtureHtml_ = function (url) {
113
+ if (typeof this.fixturesCache_[url] === 'undefined') {
114
+ this.loadFixtureIntoCache_(url)
115
+ }
116
+ return this.fixturesCache_[url]
117
+ }
202
118
 
203
- jasmine.StyleFixtures.prototype.set = function(css) {
204
- this.cleanUp()
205
- this.createStyle_(css)
206
- }
119
+ jasmine.Fixtures.prototype.loadFixtureIntoCache_ = function (relativeUrl) {
120
+ var self = this
121
+ , url = this.makeFixtureUrl_(relativeUrl)
122
+ , request = $.ajax({
123
+ async: false, // must be synchronous to guarantee that no tests are run before fixture is loaded
124
+ cache: false,
125
+ url: url,
126
+ success: function (data, status, $xhr) {
127
+ self.fixturesCache_[relativeUrl] = $xhr.responseText
128
+ },
129
+ error: function (jqXHR, status, errorThrown) {
130
+ throw new Error('Fixture could not be loaded: ' + url + ' (status: ' + status + ', message: ' + errorThrown.message + ')')
131
+ }
132
+ })
133
+ }
134
+
135
+ jasmine.Fixtures.prototype.makeFixtureUrl_ = function (relativeUrl){
136
+ return this.fixturesPath.match('/$') ? this.fixturesPath + relativeUrl : this.fixturesPath + '/' + relativeUrl
137
+ }
207
138
 
208
- jasmine.StyleFixtures.prototype.appendSet = function(css) {
209
- this.createStyle_(css)
210
- }
139
+ jasmine.Fixtures.prototype.proxyCallTo_ = function (methodName, passedArguments) {
140
+ return this[methodName].apply(this, passedArguments)
141
+ }
211
142
 
212
- jasmine.StyleFixtures.prototype.preload = function() {
213
- this.read_.apply(this, arguments)
214
- }
215
143
 
216
- jasmine.StyleFixtures.prototype.load = function() {
217
- this.cleanUp()
218
- this.createStyle_(this.read_.apply(this, arguments))
219
- }
144
+ jasmine.StyleFixtures = function () {
145
+ this.fixturesCache_ = {}
146
+ this.fixturesNodes_ = []
147
+ this.fixturesPath = 'spec/javascripts/fixtures'
148
+ }
220
149
 
221
- jasmine.StyleFixtures.prototype.appendLoad = function() {
222
- this.createStyle_(this.read_.apply(this, arguments))
223
- }
150
+ jasmine.StyleFixtures.prototype.set = function (css) {
151
+ this.cleanUp()
152
+ this.createStyle_(css)
153
+ }
224
154
 
225
- jasmine.StyleFixtures.prototype.cleanUp = function() {
226
- while(this.fixturesNodes_.length) {
227
- this.fixturesNodes_.pop().remove()
155
+ jasmine.StyleFixtures.prototype.appendSet = function (css) {
156
+ this.createStyle_(css)
228
157
  }
229
- }
230
158
 
231
- jasmine.StyleFixtures.prototype.createStyle_ = function(html) {
232
- var styleText = $('<div></div>').html(html).text(),
233
- style = $('<style>' + styleText + '</style>')
159
+ jasmine.StyleFixtures.prototype.preload = function () {
160
+ this.read_.apply(this, arguments)
161
+ }
234
162
 
235
- this.fixturesNodes_.push(style)
163
+ jasmine.StyleFixtures.prototype.load = function () {
164
+ this.cleanUp()
165
+ this.createStyle_(this.read_.apply(this, arguments))
166
+ }
236
167
 
237
- $('head').append(style)
238
- }
168
+ jasmine.StyleFixtures.prototype.appendLoad = function () {
169
+ this.createStyle_(this.read_.apply(this, arguments))
170
+ }
239
171
 
240
- jasmine.StyleFixtures.prototype.clearCache = jasmine.Fixtures.prototype.clearCache
172
+ jasmine.StyleFixtures.prototype.cleanUp = function () {
173
+ while(this.fixturesNodes_.length) {
174
+ this.fixturesNodes_.pop().remove()
175
+ }
176
+ }
241
177
 
242
- jasmine.StyleFixtures.prototype.read_ = jasmine.Fixtures.prototype.read
178
+ jasmine.StyleFixtures.prototype.createStyle_ = function (html) {
179
+ var styleText = $('<div></div>').html(html).text()
180
+ , style = $('<style>' + styleText + '</style>')
243
181
 
244
- jasmine.StyleFixtures.prototype.getFixtureHtml_ = jasmine.Fixtures.prototype.getFixtureHtml_
182
+ this.fixturesNodes_.push(style)
183
+ $('head').append(style)
184
+ }
245
185
 
246
- jasmine.StyleFixtures.prototype.loadFixtureIntoCache_ = jasmine.Fixtures.prototype.loadFixtureIntoCache_
186
+ jasmine.StyleFixtures.prototype.clearCache = jasmine.Fixtures.prototype.clearCache
187
+ jasmine.StyleFixtures.prototype.read_ = jasmine.Fixtures.prototype.read
188
+ jasmine.StyleFixtures.prototype.getFixtureHtml_ = jasmine.Fixtures.prototype.getFixtureHtml_
189
+ jasmine.StyleFixtures.prototype.loadFixtureIntoCache_ = jasmine.Fixtures.prototype.loadFixtureIntoCache_
190
+ jasmine.StyleFixtures.prototype.makeFixtureUrl_ = jasmine.Fixtures.prototype.makeFixtureUrl_
191
+ jasmine.StyleFixtures.prototype.proxyCallTo_ = jasmine.Fixtures.prototype.proxyCallTo_
247
192
 
248
- jasmine.StyleFixtures.prototype.makeFixtureUrl_ = jasmine.Fixtures.prototype.makeFixtureUrl_
193
+ jasmine.getJSONFixtures = function () {
194
+ return jasmine.currentJSONFixtures_ = jasmine.currentJSONFixtures_ || new jasmine.JSONFixtures()
195
+ }
249
196
 
250
- jasmine.StyleFixtures.prototype.proxyCallTo_ = jasmine.Fixtures.prototype.proxyCallTo_
197
+ jasmine.JSONFixtures = function () {
198
+ this.fixturesCache_ = {}
199
+ this.fixturesPath = 'spec/javascripts/fixtures/json'
200
+ }
251
201
 
252
- jasmine.getJSONFixtures = function() {
253
- return jasmine.currentJSONFixtures_ = jasmine.currentJSONFixtures_ || new jasmine.JSONFixtures()
254
- }
202
+ jasmine.JSONFixtures.prototype.load = function () {
203
+ this.read.apply(this, arguments)
204
+ return this.fixturesCache_
205
+ }
255
206
 
256
- jasmine.JSONFixtures = function() {
257
- this.fixturesCache_ = {}
258
- this.fixturesPath = 'spec/javascripts/fixtures/json'
259
- }
207
+ jasmine.JSONFixtures.prototype.read = function () {
208
+ var fixtureUrls = arguments
260
209
 
261
- jasmine.JSONFixtures.prototype.load = function() {
262
- this.read.apply(this, arguments)
263
- return this.fixturesCache_
264
- }
210
+ for(var urlCount = fixtureUrls.length, urlIndex = 0; urlIndex < urlCount; urlIndex++) {
211
+ this.getFixtureData_(fixtureUrls[urlIndex])
212
+ }
265
213
 
266
- jasmine.JSONFixtures.prototype.read = function() {
267
- var fixtureUrls = arguments
268
- for(var urlCount = fixtureUrls.length, urlIndex = 0; urlIndex < urlCount; urlIndex++) {
269
- this.getFixtureData_(fixtureUrls[urlIndex])
214
+ return this.fixturesCache_
270
215
  }
271
- return this.fixturesCache_
272
- }
273
-
274
- jasmine.JSONFixtures.prototype.clearCache = function() {
275
- this.fixturesCache_ = {}
276
- }
277
216
 
278
- jasmine.JSONFixtures.prototype.getFixtureData_ = function(url) {
279
- this.loadFixtureIntoCache_(url)
280
- return this.fixturesCache_[url]
281
- }
217
+ jasmine.JSONFixtures.prototype.clearCache = function () {
218
+ this.fixturesCache_ = {}
219
+ }
282
220
 
283
- jasmine.JSONFixtures.prototype.loadFixtureIntoCache_ = function(relativeUrl) {
284
- var self = this
285
- var url = this.fixturesPath.match('/$') ? this.fixturesPath + relativeUrl : this.fixturesPath + '/' + relativeUrl
286
- $.ajax({
287
- async: false, // must be synchronous to guarantee that no tests are run before fixture is loaded
288
- cache: false,
289
- dataType: 'json',
290
- url: url,
291
- success: function(data) {
292
- self.fixturesCache_[relativeUrl] = data
293
- },
294
- error: function(jqXHR, status, errorThrown) {
295
- throw Error('JSONFixture could not be loaded: ' + url + ' (status: ' + status + ', message: ' + errorThrown.message + ')')
296
- }
297
- })
298
- }
221
+ jasmine.JSONFixtures.prototype.getFixtureData_ = function (url) {
222
+ this.loadFixtureIntoCache_(url)
223
+ return this.fixturesCache_[url]
224
+ }
299
225
 
300
- jasmine.JSONFixtures.prototype.proxyCallTo_ = function(methodName, passedArguments) {
301
- return this[methodName].apply(this, passedArguments)
302
- }
226
+ jasmine.JSONFixtures.prototype.loadFixtureIntoCache_ = function (relativeUrl) {
227
+ var self = this
228
+ , url = this.fixturesPath.match('/$') ? this.fixturesPath + relativeUrl : this.fixturesPath + '/' + relativeUrl
229
+
230
+ $.ajax({
231
+ async: false, // must be synchronous to guarantee that no tests are run before fixture is loaded
232
+ cache: false,
233
+ dataType: 'json',
234
+ url: url,
235
+ success: function (data) {
236
+ self.fixturesCache_[relativeUrl] = data
237
+ },
238
+ error: function (jqXHR, status, errorThrown) {
239
+ throw new Error('JSONFixture could not be loaded: ' + url + ' (status: ' + status + ', message: ' + errorThrown.message + ')')
240
+ }
241
+ })
242
+ }
303
243
 
304
- jasmine.JQuery = function() {}
244
+ jasmine.JSONFixtures.prototype.proxyCallTo_ = function (methodName, passedArguments) {
245
+ return this[methodName].apply(this, passedArguments)
246
+ }
305
247
 
306
- jasmine.JQuery.browserTagCaseIndependentHtml = function(html) {
307
- return $('<div/>').append(html).html()
308
- }
248
+ jasmine.JQuery = function () {}
309
249
 
310
- jasmine.JQuery.elementToString = function(element) {
311
- var domEl = $(element).get(0)
312
- if (domEl == undefined || domEl.cloneNode)
313
- return $('<div />').append($(element).clone()).html()
314
- else
315
- return element.toString()
316
- }
250
+ jasmine.JQuery.browserTagCaseIndependentHtml = function (html) {
251
+ return $('<div/>').append(html).html()
252
+ }
317
253
 
318
- jasmine.JQuery.matchersClass = {}
254
+ jasmine.JQuery.elementToString = function (element) {
255
+ var domEl = $(element).get(0)
319
256
 
320
- !function(namespace) {
321
- var data = {
322
- spiedEvents: {},
323
- handlers: []
257
+ if (domEl === undefined || domEl.cloneNode)
258
+ return $('<div />').append($(element).clone()).html()
259
+ else
260
+ return element.toString()
324
261
  }
325
262
 
326
- namespace.events = {
327
- spyOn: function(selector, eventName) {
328
- var handler = function(e) {
329
- data.spiedEvents[jasmine.spiedEventsKey(selector, eventName)] = jasmine.util.argsToArray(arguments)
330
- }
331
- $(selector).on(eventName, handler)
332
- data.handlers.push(handler)
333
- return {
334
- selector: selector,
335
- eventName: eventName,
336
- handler: handler,
337
- reset: function(){
338
- delete data.spiedEvents[jasmine.spiedEventsKey(selector, eventName)]
263
+ jasmine.JQuery.matchersClass = {}
264
+
265
+ !function (namespace) {
266
+ var data = {
267
+ spiedEvents: {}
268
+ , handlers: []
269
+ }
270
+
271
+ namespace.events = {
272
+ spyOn: function (selector, eventName) {
273
+ var handler = function (e) {
274
+ data.spiedEvents[jasmine.spiedEventsKey(selector, eventName)] = jasmine.util.argsToArray(arguments)
339
275
  }
340
- }
341
- },
342
276
 
343
- args: function(selector, eventName) {
344
- var actualArgs = data.spiedEvents[jasmine.spiedEventsKey(selector, eventName)];
277
+ $(selector).on(eventName, handler)
278
+ data.handlers.push(handler)
345
279
 
346
- if (!actualArgs) {
347
- throw "There is no spy for " + eventName + " on " + selector.toString() + ". Make sure to create a spy using spyOnEvent.";
348
- }
280
+ return {
281
+ selector: selector,
282
+ eventName: eventName,
283
+ handler: handler,
284
+ reset: function (){
285
+ delete data.spiedEvents[jasmine.spiedEventsKey(selector, eventName)]
286
+ }
287
+ }
288
+ },
289
+
290
+ args: function (selector, eventName) {
291
+ var actualArgs = data.spiedEvents[jasmine.spiedEventsKey(selector, eventName)]
349
292
 
350
- return actualArgs;
351
- },
293
+ if (!actualArgs) {
294
+ throw "There is no spy for " + eventName + " on " + selector.toString() + ". Make sure to create a spy using spyOnEvent."
295
+ }
296
+
297
+ return actualArgs
298
+ },
352
299
 
353
- wasTriggered: function(selector, eventName) {
354
- return !!(data.spiedEvents[jasmine.spiedEventsKey(selector, eventName)])
355
- },
300
+ wasTriggered: function (selector, eventName) {
301
+ return !!(data.spiedEvents[jasmine.spiedEventsKey(selector, eventName)])
302
+ },
356
303
 
357
- wasTriggeredWith: function(selector, eventName, expectedArgs, env) {
358
- var actualArgs = jasmine.JQuery.events.args(selector, eventName).slice(1);
359
- if (Object.prototype.toString.call(expectedArgs) !== '[object Array]') {
360
- actualArgs = actualArgs[0];
304
+ wasTriggeredWith: function (selector, eventName, expectedArgs, env) {
305
+ var actualArgs = jasmine.JQuery.events.args(selector, eventName).slice(1)
306
+ if (Object.prototype.toString.call(expectedArgs) !== '[object Array]') {
307
+ actualArgs = actualArgs[0]
308
+ }
309
+ return env.equals_(expectedArgs, actualArgs)
310
+ },
311
+
312
+ wasPrevented: function (selector, eventName) {
313
+ var args = data.spiedEvents[jasmine.spiedEventsKey(selector, eventName)]
314
+ , e = args ? args[0] : undefined
315
+
316
+ return e && e.isDefaultPrevented()
317
+ },
318
+
319
+ wasStopped: function (selector, eventName) {
320
+ var args = data.spiedEvents[jasmine.spiedEventsKey(selector, eventName)]
321
+ , e = args ? args[0] : undefined
322
+ return e && e.isPropagationStopped()
323
+ },
324
+
325
+ cleanUp: function () {
326
+ data.spiedEvents = {}
327
+ data.handlers = []
361
328
  }
362
- return env.equals_(expectedArgs, actualArgs);
363
- },
364
-
365
- wasPrevented: function(selector, eventName) {
366
- var args = data.spiedEvents[jasmine.spiedEventsKey(selector, eventName)],
367
- e = args ? args[0] : undefined;
368
- return e && e.isDefaultPrevented()
369
- },
370
-
371
- wasStopped: function(selector, eventName) {
372
- var args = data.spiedEvents[jasmine.spiedEventsKey(selector, eventName)],
373
- e = args ? args[0] : undefined;
374
- return e && e.isPropagationStopped()
375
- },
376
-
377
- cleanUp: function() {
378
- data.spiedEvents = {}
379
- data.handlers = []
380
329
  }
381
- }
382
- }(jasmine.JQuery)
330
+ }(jasmine.JQuery)
331
+
332
+ !function (){
333
+ var jQueryMatchers = {
334
+ toHaveClass: function (className) {
335
+ return this.actual.hasClass(className)
336
+ },
337
+
338
+ toHaveCss: function (css){
339
+ for (var prop in css){
340
+ var value = css[prop]
341
+ // see issue #147 on gh
342
+ ;if (value === 'auto' && this.actual.get(0).style[prop] === 'auto') continue
343
+ if (this.actual.css(prop) !== value) return false
344
+ }
345
+ return true
346
+ },
383
347
 
384
- !function(){
385
- var jQueryMatchers = {
386
- toHaveClass: function(className) {
387
- return this.actual.hasClass(className)
388
- },
348
+ toBeVisible: function () {
349
+ return this.actual.is(':visible')
350
+ },
389
351
 
390
- toHaveCss: function(css){
391
- for (var prop in css){
392
- if (this.actual.css(prop) !== css[prop]) return false
393
- }
394
- return true
395
- },
396
-
397
- toBeVisible: function() {
398
- return this.actual.is(':visible')
399
- },
400
-
401
- toBeHidden: function() {
402
- return this.actual.is(':hidden')
403
- },
404
-
405
- toBeSelected: function() {
406
- return this.actual.is(':selected')
407
- },
408
-
409
- toBeChecked: function() {
410
- return this.actual.is(':checked')
411
- },
412
-
413
- toBeEmpty: function() {
414
- return this.actual.is(':empty')
415
- },
416
-
417
- toExist: function() {
418
- return $(document).find(this.actual).length
419
- },
420
-
421
- toHaveLength: function(length) {
422
- return this.actual.length === length
423
- },
424
-
425
- toHaveAttr: function(attributeName, expectedAttributeValue) {
426
- return hasProperty(this.actual.attr(attributeName), expectedAttributeValue)
427
- },
428
-
429
- toHaveProp: function(propertyName, expectedPropertyValue) {
430
- return hasProperty(this.actual.prop(propertyName), expectedPropertyValue)
431
- },
432
-
433
- toHaveId: function(id) {
434
- return this.actual.attr('id') == id
435
- },
436
-
437
- toHaveHtml: function(html) {
438
- return this.actual.html() == jasmine.JQuery.browserTagCaseIndependentHtml(html)
439
- },
440
-
441
- toContainHtml: function(html){
442
- var actualHtml = this.actual.html()
443
- var expectedHtml = jasmine.JQuery.browserTagCaseIndependentHtml(html)
444
- return (actualHtml.indexOf(expectedHtml) >= 0)
445
- },
446
-
447
- toHaveText: function(text) {
448
- var trimmedText = $.trim(this.actual.text())
449
- if (text && $.isFunction(text.test)) {
450
- return text.test(trimmedText)
451
- } else {
452
- return trimmedText == text
453
- }
454
- },
455
-
456
- toContainText: function(text) {
457
- var trimmedText = $.trim(this.actual.text())
458
- if (text && $.isFunction(text.test)) {
459
- return text.test(trimmedText)
460
- } else {
461
- return trimmedText.indexOf(text) != -1;
462
- }
463
- },
352
+ toBeHidden: function () {
353
+ return this.actual.is(':hidden')
354
+ },
464
355
 
465
- toHaveValue: function(value) {
466
- return this.actual.val() === value
467
- },
356
+ toBeSelected: function () {
357
+ return this.actual.is(':selected')
358
+ },
468
359
 
469
- toHaveData: function(key, expectedValue) {
470
- return hasProperty(this.actual.data(key), expectedValue)
471
- },
360
+ toBeChecked: function () {
361
+ return this.actual.is(':checked')
362
+ },
472
363
 
473
- toBe: function(selector) {
474
- return this.actual.is(selector)
475
- },
364
+ toBeEmpty: function () {
365
+ return this.actual.is(':empty')
366
+ },
476
367
 
477
- toContain: function(selector) {
478
- return this.actual.find(selector).length
479
- },
368
+ toExist: function () {
369
+ return this.actual.length
370
+ },
480
371
 
481
- toBeMatchedBy: function(selector) {
482
- return this.actual.filter(selector).length
483
- },
372
+ toHaveLength: function (length) {
373
+ return this.actual.length === length
374
+ },
484
375
 
485
- toBeDisabled: function(selector){
486
- return this.actual.is(':disabled')
487
- },
376
+ toHaveAttr: function (attributeName, expectedAttributeValue) {
377
+ return hasProperty(this.actual.attr(attributeName), expectedAttributeValue)
378
+ },
488
379
 
489
- toBeFocused: function(selector) {
490
- return this.actual[0] === this.actual[0].ownerDocument.activeElement
491
- },
380
+ toHaveProp: function (propertyName, expectedPropertyValue) {
381
+ return hasProperty(this.actual.prop(propertyName), expectedPropertyValue)
382
+ },
492
383
 
493
- toHandle: function(event) {
384
+ toHaveId: function (id) {
385
+ return this.actual.attr('id') == id
386
+ },
494
387
 
495
- var events = $._data(this.actual.get(0), "events")
388
+ toHaveHtml: function (html) {
389
+ return this.actual.html() == jasmine.JQuery.browserTagCaseIndependentHtml(html)
390
+ },
496
391
 
497
- if(!events || !event || typeof event !== "string") {
498
- return false
499
- }
392
+ toContainHtml: function (html){
393
+ var actualHtml = this.actual.html()
394
+ , expectedHtml = jasmine.JQuery.browserTagCaseIndependentHtml(html)
500
395
 
501
- var namespaces = event.split(".")
502
- var eventType = namespaces.shift()
503
- var sortedNamespaces = namespaces.slice(0).sort()
504
- var namespaceRegExp = new RegExp("(^|\\.)" + sortedNamespaces.join("\\.(?:.*\\.)?") + "(\\.|$)")
396
+ return (actualHtml.indexOf(expectedHtml) >= 0)
397
+ },
505
398
 
506
- if(events[eventType] && namespaces.length) {
507
- for(var i = 0; i < events[eventType].length; i++) {
508
- var namespace = events[eventType][i].namespace
509
- if(namespaceRegExp.test(namespace)) {
510
- return true
399
+ toHaveText: function (text) {
400
+ var trimmedText = $.trim(this.actual.text())
401
+
402
+ if (text && $.isFunction(text.test)) {
403
+ return text.test(trimmedText)
404
+ } else {
405
+ return trimmedText == text
406
+ }
407
+ },
408
+
409
+ toContainText: function (text) {
410
+ var trimmedText = $.trim(this.actual.text())
411
+
412
+ if (text && $.isFunction(text.test)) {
413
+ return text.test(trimmedText)
414
+ } else {
415
+ return trimmedText.indexOf(text) != -1
416
+ }
417
+ },
418
+
419
+ toHaveValue: function (value) {
420
+ return this.actual.val() === value
421
+ },
422
+
423
+ toHaveData: function (key, expectedValue) {
424
+ return hasProperty(this.actual.data(key), expectedValue)
425
+ },
426
+
427
+ toBe: function (selector) {
428
+ return this.actual.is(selector)
429
+ },
430
+
431
+ toContain: function (selector) {
432
+ return this.actual.find(selector).length
433
+ },
434
+
435
+ toBeMatchedBy: function (selector) {
436
+ return this.actual.filter(selector).length
437
+ },
438
+
439
+ toBeDisabled: function (selector){
440
+ return this.actual.is(':disabled')
441
+ },
442
+
443
+ toBeFocused: function (selector) {
444
+ return this.actual[0] === this.actual[0].ownerDocument.activeElement
445
+ },
446
+
447
+ toHandle: function (event) {
448
+ var events = $._data(this.actual.get(0), "events")
449
+
450
+ if(!events || !event || typeof event !== "string") {
451
+ return false
452
+ }
453
+
454
+ var namespaces = event.split(".")
455
+ , eventType = namespaces.shift()
456
+ , sortedNamespaces = namespaces.slice(0).sort()
457
+ , namespaceRegExp = new RegExp("(^|\\.)" + sortedNamespaces.join("\\.(?:.*\\.)?") + "(\\.|$)")
458
+
459
+ if(events[eventType] && namespaces.length) {
460
+ for(var i = 0; i < events[eventType].length; i++) {
461
+ var namespace = events[eventType][i].namespace
462
+
463
+ if(namespaceRegExp.test(namespace)) {
464
+ return true
465
+ }
511
466
  }
467
+ } else {
468
+ return events[eventType] && events[eventType].length > 0
512
469
  }
513
- } else {
514
- return events[eventType] && events[eventType].length > 0
515
- }
516
- },
517
-
518
- // tests the existence of a specific event binding + handler
519
- toHandleWith: function(eventName, eventHandler) {
520
- var normalizedEventName = eventName.split('.')[0];
521
- var stack = $._data(this.actual.get(0), "events")[normalizedEventName]
522
- for (var i = 0; i < stack.length; i++) {
523
- if (stack[i].handler == eventHandler) return true
470
+ },
471
+
472
+ toHandleWith: function (eventName, eventHandler) {
473
+ var normalizedEventName = eventName.split('.')[0]
474
+ , stack = $._data(this.actual.get(0), "events")[normalizedEventName]
475
+
476
+ for (var i = 0; i < stack.length; i++) {
477
+ if (stack[i].handler == eventHandler) return true
478
+ }
479
+
480
+ return false
524
481
  }
525
- return false
526
482
  }
527
- }
528
483
 
529
- var hasProperty = function(actualValue, expectedValue) {
530
- if (expectedValue === undefined) return actualValue !== undefined
531
- return actualValue == expectedValue
532
- }
484
+ var hasProperty = function (actualValue, expectedValue) {
485
+ if (expectedValue === undefined) return actualValue !== undefined
533
486
 
534
- var bindMatcher = function(methodName) {
535
- var builtInMatcher = jasmine.Matchers.prototype[methodName]
487
+ return actualValue == expectedValue
488
+ }
536
489
 
537
- jasmine.JQuery.matchersClass[methodName] = function() {
538
- if (this.actual
539
- && (this.actual instanceof $
540
- || jasmine.isDomNode(this.actual))) {
541
- this.actual = $(this.actual)
542
- var result = jQueryMatchers[methodName].apply(this, arguments)
543
- var element
544
- if (this.actual.get && (element = this.actual.get()[0]) && !$.isWindow(element) && element.tagName !== "HTML")
545
- this.actual = jasmine.JQuery.elementToString(this.actual)
546
- return result
547
- }
490
+ var bindMatcher = function (methodName) {
491
+ var builtInMatcher = jasmine.Matchers.prototype[methodName]
548
492
 
549
- if (builtInMatcher) {
550
- return builtInMatcher.apply(this, arguments)
551
- }
493
+ jasmine.JQuery.matchersClass[methodName] = function () {
494
+ if (this.actual
495
+ && (this.actual instanceof $
496
+ || jasmine.isDomNode(this.actual))) {
497
+ this.actual = $(this.actual)
498
+ var result = jQueryMatchers[methodName].apply(this, arguments)
499
+ , element
552
500
 
553
- return false
554
- }
555
- }
501
+ if (this.actual.get && (element = this.actual.get()[0]) && !$.isWindow(element) && element.tagName !== "HTML")
502
+ this.actual = jasmine.JQuery.elementToString(this.actual)
556
503
 
557
- for(var methodName in jQueryMatchers) {
558
- bindMatcher(methodName)
559
- }
560
- }()
504
+ return result
505
+ }
506
+
507
+ if (builtInMatcher) {
508
+ return builtInMatcher.apply(this, arguments)
509
+ }
561
510
 
562
- beforeEach(function() {
563
- this.addMatchers(jasmine.JQuery.matchersClass)
564
- this.addMatchers({
565
- toHaveBeenTriggeredOn: function(selector) {
566
- this.message = function() {
567
- return [
568
- "Expected event " + this.actual + " to have been triggered on " + selector,
569
- "Expected event " + this.actual + " not to have been triggered on " + selector
570
- ]
511
+ return false
571
512
  }
572
- return jasmine.JQuery.events.wasTriggered(selector, this.actual)
573
513
  }
574
- })
575
- this.addMatchers({
576
- toHaveBeenTriggered: function(){
577
- var eventName = this.actual.eventName,
578
- selector = this.actual.selector
579
- this.message = function() {
580
- return [
581
- "Expected event " + eventName + " to have been triggered on " + selector,
582
- "Expected event " + eventName + " not to have been triggered on " + selector
583
- ]
514
+
515
+ for(var methodName in jQueryMatchers) {
516
+ bindMatcher(methodName)
517
+ }
518
+ }()
519
+
520
+ beforeEach(function () {
521
+ this.addMatchers(jasmine.JQuery.matchersClass)
522
+ this.addMatchers({
523
+ toHaveBeenTriggeredOn: function (selector) {
524
+ this.message = function () {
525
+ return [
526
+ "Expected event " + this.actual + " to have been triggered on " + selector,
527
+ "Expected event " + this.actual + " not to have been triggered on " + selector
528
+ ]
529
+ }
530
+ return jasmine.JQuery.events.wasTriggered(selector, this.actual)
584
531
  }
585
- return jasmine.JQuery.events.wasTriggered(selector, eventName)
586
- }
587
- })
588
- this.addMatchers({
589
- toHaveBeenTriggeredOnAndWith: function() {
590
- var selector = arguments[0],
591
- expectedArgs = arguments[1],
592
- wasTriggered = jasmine.JQuery.events.wasTriggered(selector, this.actual);
593
- this.message = function() {
594
- if (wasTriggered) {
595
- var actualArgs = jasmine.JQuery.events.args(selector, this.actual, expectedArgs)[1];
532
+ })
533
+ this.addMatchers({
534
+ toHaveBeenTriggered: function (){
535
+ var eventName = this.actual.eventName
536
+ , selector = this.actual.selector
537
+
538
+ this.message = function () {
596
539
  return [
597
- "Expected event " + this.actual + " to have been triggered with " + jasmine.pp(expectedArgs) + " but it was triggered with " + jasmine.pp(actualArgs),
598
- "Expected event " + this.actual + " not to have been triggered with " + jasmine.pp(expectedArgs) + " but it was triggered with " + jasmine.pp(actualArgs)
540
+ "Expected event " + eventName + " to have been triggered on " + selector,
541
+ "Expected event " + eventName + " not to have been triggered on " + selector
599
542
  ]
600
- } else {
543
+ }
544
+
545
+ return jasmine.JQuery.events.wasTriggered(selector, eventName)
546
+ }
547
+ })
548
+ this.addMatchers({
549
+ toHaveBeenTriggeredOnAndWith: function () {
550
+ var selector = arguments[0]
551
+ , expectedArgs = arguments[1]
552
+ , wasTriggered = jasmine.JQuery.events.wasTriggered(selector, this.actual)
553
+
554
+ this.message = function () {
555
+ if (wasTriggered) {
556
+ var actualArgs = jasmine.JQuery.events.args(selector, this.actual, expectedArgs)[1]
557
+ return [
558
+ "Expected event " + this.actual + " to have been triggered with " + jasmine.pp(expectedArgs) + " but it was triggered with " + jasmine.pp(actualArgs),
559
+ "Expected event " + this.actual + " not to have been triggered with " + jasmine.pp(expectedArgs) + " but it was triggered with " + jasmine.pp(actualArgs)
560
+ ]
561
+ } else {
562
+ return [
563
+ "Expected event " + this.actual + " to have been triggered on " + selector,
564
+ "Expected event " + this.actual + " not to have been triggered on " + selector
565
+ ]
566
+ }
567
+ }
568
+
569
+ return wasTriggered && jasmine.JQuery.events.wasTriggeredWith(selector, this.actual, expectedArgs, this.env)
570
+ }
571
+ })
572
+ this.addMatchers({
573
+ toHaveBeenPreventedOn: function (selector) {
574
+ this.message = function () {
601
575
  return [
602
- "Expected event " + this.actual + " to have been triggered on " + selector,
603
- "Expected event " + this.actual + " not to have been triggered on " + selector
576
+ "Expected event " + this.actual + " to have been prevented on " + selector,
577
+ "Expected event " + this.actual + " not to have been prevented on " + selector
604
578
  ]
605
579
  }
580
+
581
+ return jasmine.JQuery.events.wasPrevented(selector, this.actual)
606
582
  }
607
- return wasTriggered && jasmine.JQuery.events.wasTriggeredWith(selector, this.actual, expectedArgs, this.env);
608
- }
609
- })
610
- this.addMatchers({
611
- toHaveBeenPreventedOn: function(selector) {
612
- this.message = function() {
613
- return [
614
- "Expected event " + this.actual + " to have been prevented on " + selector,
615
- "Expected event " + this.actual + " not to have been prevented on " + selector
616
- ]
583
+ })
584
+ this.addMatchers({
585
+ toHaveBeenPrevented: function () {
586
+ var eventName = this.actual.eventName
587
+ , selector = this.actual.selector
588
+ this.message = function () {
589
+ return [
590
+ "Expected event " + eventName + " to have been prevented on " + selector,
591
+ "Expected event " + eventName + " not to have been prevented on " + selector
592
+ ]
593
+ }
594
+
595
+ return jasmine.JQuery.events.wasPrevented(selector, eventName)
617
596
  }
618
- return jasmine.JQuery.events.wasPrevented(selector, this.actual)
619
- }
620
- })
621
- this.addMatchers({
622
- toHaveBeenPrevented: function() {
623
- var eventName = this.actual.eventName,
624
- selector = this.actual.selector
625
- this.message = function() {
626
- return [
627
- "Expected event " + eventName + " to have been prevented on " + selector,
628
- "Expected event " + eventName + " not to have been prevented on " + selector
629
- ]
597
+ })
598
+ this.addMatchers({
599
+ toHaveBeenStoppedOn: function (selector) {
600
+ this.message = function () {
601
+ return [
602
+ "Expected event " + this.actual + " to have been stopped on " + selector,
603
+ "Expected event " + this.actual + " not to have been stopped on " + selector
604
+ ]
605
+ }
606
+
607
+ return jasmine.JQuery.events.wasStopped(selector, this.actual)
630
608
  }
631
- return jasmine.JQuery.events.wasPrevented(selector, eventName)
632
- }
633
- })
634
- this.addMatchers({
635
- toHaveBeenStoppedOn: function(selector) {
636
- this.message = function() {
637
- return [
638
- "Expected event " + this.actual + " to have been stopped on " + selector,
639
- "Expected event " + this.actual + " not to have been stopped on " + selector
640
- ]
609
+ })
610
+ this.addMatchers({
611
+ toHaveBeenStopped: function () {
612
+ var eventName = this.actual.eventName
613
+ , selector = this.actual.selector
614
+ this.message = function () {
615
+ return [
616
+ "Expected event " + eventName + " to have been stopped on " + selector,
617
+ "Expected event " + eventName + " not to have been stopped on " + selector
618
+ ]
619
+ }
620
+ return jasmine.JQuery.events.wasStopped(selector, eventName)
641
621
  }
642
- return jasmine.JQuery.events.wasStopped(selector, this.actual)
643
- }
644
- })
645
- this.addMatchers({
646
- toHaveBeenStopped: function() {
647
- var eventName = this.actual.eventName,
648
- selector = this.actual.selector
649
- this.message = function() {
650
- return [
651
- "Expected event " + eventName + " to have been stopped on " + selector,
652
- "Expected event " + eventName + " not to have been stopped on " + selector
653
- ]
622
+ })
623
+ jasmine.getEnv().addEqualityTester(function (a, b) {
624
+ if(a instanceof jQuery && b instanceof jQuery) {
625
+ if(a.size() != b.size()) {
626
+ return jasmine.undefined
627
+ }
628
+ else if(a.is(b)) {
629
+ return true
630
+ }
654
631
  }
655
- return jasmine.JQuery.events.wasStopped(selector, eventName)
656
- }
632
+
633
+ return jasmine.undefined
634
+ })
635
+ })
636
+
637
+ afterEach(function () {
638
+ jasmine.getFixtures().cleanUp()
639
+ jasmine.getStyleFixtures().cleanUp()
640
+ jasmine.JQuery.events.cleanUp()
657
641
  })
658
- })
642
+ }(window.jasmine, window.jQuery)
643
+
644
+ +function (jasmine, global) { "use strict";
645
+
646
+ global.readFixtures = function () {
647
+ return jasmine.getFixtures().proxyCallTo_('read', arguments)
648
+ }
649
+
650
+ global.preloadFixtures = function () {
651
+ jasmine.getFixtures().proxyCallTo_('preload', arguments)
652
+ }
653
+
654
+ global.loadFixtures = function () {
655
+ jasmine.getFixtures().proxyCallTo_('load', arguments)
656
+ }
659
657
 
660
- afterEach(function() {
661
- jasmine.getFixtures().cleanUp()
662
- jasmine.getStyleFixtures().cleanUp()
663
- jasmine.JQuery.events.cleanUp()
664
- })
658
+ global.appendLoadFixtures = function () {
659
+ jasmine.getFixtures().proxyCallTo_('appendLoad', arguments)
660
+ }
661
+
662
+ global.setFixtures = function (html) {
663
+ return jasmine.getFixtures().proxyCallTo_('set', arguments)
664
+ }
665
+
666
+ global.appendSetFixtures = function () {
667
+ jasmine.getFixtures().proxyCallTo_('appendSet', arguments)
668
+ }
669
+
670
+ global.sandbox = function (attributes) {
671
+ return jasmine.getFixtures().sandbox(attributes)
672
+ }
673
+
674
+ global.spyOnEvent = function (selector, eventName) {
675
+ return jasmine.JQuery.events.spyOn(selector, eventName)
676
+ }
677
+
678
+ global.preloadStyleFixtures = function () {
679
+ jasmine.getStyleFixtures().proxyCallTo_('preload', arguments)
680
+ }
681
+
682
+ global.loadStyleFixtures = function () {
683
+ jasmine.getStyleFixtures().proxyCallTo_('load', arguments)
684
+ }
685
+
686
+ global.appendLoadStyleFixtures = function () {
687
+ jasmine.getStyleFixtures().proxyCallTo_('appendLoad', arguments)
688
+ }
689
+
690
+ global.setStyleFixtures = function (html) {
691
+ jasmine.getStyleFixtures().proxyCallTo_('set', arguments)
692
+ }
693
+
694
+ global.appendSetStyleFixtures = function (html) {
695
+ jasmine.getStyleFixtures().proxyCallTo_('appendSet', arguments)
696
+ }
697
+
698
+ global.loadJSONFixtures = function () {
699
+ return jasmine.getJSONFixtures().proxyCallTo_('load', arguments)
700
+ }
701
+
702
+ global.getJSONFixture = function (url) {
703
+ return jasmine.getJSONFixtures().proxyCallTo_('read', arguments)[url]
704
+ }
705
+ }(jasmine, window);
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jasmine-jquery-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.6
4
+ version: 1.5.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Travis Jeffery
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-07-31 00:00:00.000000000 Z
11
+ date: 2013-09-28 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description:
14
14
  email: