jasmine-jquery-rails 1.5.6 → 1.5.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/jasmine-jquery-rails/version.rb +1 -1
- data/vendor/assets/javascripts/jasmine-jquery.js +596 -555
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: da4c21bea3d761fbf0cfb01e25af8ae03005a893
|
4
|
+
data.tar.gz: dda8eabbc7b390904a555042905dd24b0522a454
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2446540a0e916a16cbc29db9b086df18e6733b4406d32452675e06bf25a26d63a38d84bd64bece3f74075047f36e9f8e74073d3aacef33dec37eb9bcb878a995
|
7
|
+
data.tar.gz: fbe32b410456ac91663d3ef6055702a0c73bc55052a578833aa404d3e43999e0fd3fee33b16ad05b99123ab337cad03bdcb18f43d93ae3fb79eaab3935c1919b
|
@@ -1,664 +1,705 @@
|
|
1
1
|
/*!
|
2
|
-
|
2
|
+
Jasmine-jQuery: a set of jQuery helpers for Jasmine tests.
|
3
3
|
|
4
|
-
|
4
|
+
Version 1.5.9
|
5
5
|
|
6
|
-
|
6
|
+
https://github.com/velesin/jasmine-jquery
|
7
7
|
|
8
|
-
|
8
|
+
Copyright (c) 2010-2013 Wojciech Zawistowski, Travis Jeffery
|
9
9
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
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
|
-
|
19
|
-
|
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
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
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
|
-
|
38
|
-
jasmine.getFixtures().proxyCallTo_('load', arguments)
|
39
|
-
}
|
30
|
+
+function (jasmine, $) { "use strict";
|
40
31
|
|
41
|
-
|
42
|
-
|
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
|
-
|
46
|
-
|
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
|
-
|
50
|
-
|
51
|
-
|
50
|
+
jasmine.Fixtures.prototype.set = function (html) {
|
51
|
+
this.cleanUp()
|
52
|
+
return this.createContainer_(html)
|
53
|
+
}
|
52
54
|
|
53
|
-
|
54
|
-
|
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
|
-
|
133
|
-
|
134
|
-
htmlChunks.push(this.getFixtureHtml_(fixtureUrls[urlIndex]))
|
59
|
+
jasmine.Fixtures.prototype.preload = function () {
|
60
|
+
this.read.apply(this, arguments)
|
135
61
|
}
|
136
62
|
|
137
|
-
|
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.
|
141
|
-
|
142
|
-
}
|
68
|
+
jasmine.Fixtures.prototype.appendLoad = function () {
|
69
|
+
this.addToContainer_(this.read.apply(this, arguments))
|
70
|
+
}
|
143
71
|
|
144
|
-
jasmine.Fixtures.prototype.
|
145
|
-
|
146
|
-
|
72
|
+
jasmine.Fixtures.prototype.read = function () {
|
73
|
+
var htmlChunks = []
|
74
|
+
, fixtureUrls = arguments
|
147
75
|
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
}
|
76
|
+
for(var urlCount = fixtureUrls.length, urlIndex = 0; urlIndex < urlCount; urlIndex++) {
|
77
|
+
htmlChunks.push(this.getFixtureHtml_(fixtureUrls[urlIndex]))
|
78
|
+
}
|
152
79
|
|
153
|
-
|
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.
|
165
|
-
|
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.
|
172
|
-
|
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.
|
179
|
-
|
180
|
-
|
181
|
-
|
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.
|
189
|
-
|
190
|
-
|
96
|
+
jasmine.Fixtures.prototype.createContainer_ = function (html) {
|
97
|
+
var container = $('<div>')
|
98
|
+
.attr('id', this.containerId)
|
99
|
+
.html(html)
|
191
100
|
|
192
|
-
|
193
|
-
|
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.
|
198
|
-
|
199
|
-
|
200
|
-
|
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.
|
204
|
-
|
205
|
-
|
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.
|
209
|
-
|
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
|
217
|
-
|
218
|
-
|
219
|
-
|
144
|
+
jasmine.StyleFixtures = function () {
|
145
|
+
this.fixturesCache_ = {}
|
146
|
+
this.fixturesNodes_ = []
|
147
|
+
this.fixturesPath = 'spec/javascripts/fixtures'
|
148
|
+
}
|
220
149
|
|
221
|
-
jasmine.StyleFixtures.prototype.
|
222
|
-
|
223
|
-
|
150
|
+
jasmine.StyleFixtures.prototype.set = function (css) {
|
151
|
+
this.cleanUp()
|
152
|
+
this.createStyle_(css)
|
153
|
+
}
|
224
154
|
|
225
|
-
jasmine.StyleFixtures.prototype.
|
226
|
-
|
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.
|
232
|
-
|
233
|
-
|
159
|
+
jasmine.StyleFixtures.prototype.preload = function () {
|
160
|
+
this.read_.apply(this, arguments)
|
161
|
+
}
|
234
162
|
|
235
|
-
|
163
|
+
jasmine.StyleFixtures.prototype.load = function () {
|
164
|
+
this.cleanUp()
|
165
|
+
this.createStyle_(this.read_.apply(this, arguments))
|
166
|
+
}
|
236
167
|
|
237
|
-
|
238
|
-
|
168
|
+
jasmine.StyleFixtures.prototype.appendLoad = function () {
|
169
|
+
this.createStyle_(this.read_.apply(this, arguments))
|
170
|
+
}
|
239
171
|
|
240
|
-
jasmine.StyleFixtures.prototype.
|
172
|
+
jasmine.StyleFixtures.prototype.cleanUp = function () {
|
173
|
+
while(this.fixturesNodes_.length) {
|
174
|
+
this.fixturesNodes_.pop().remove()
|
175
|
+
}
|
176
|
+
}
|
241
177
|
|
242
|
-
jasmine.StyleFixtures.prototype.
|
178
|
+
jasmine.StyleFixtures.prototype.createStyle_ = function (html) {
|
179
|
+
var styleText = $('<div></div>').html(html).text()
|
180
|
+
, style = $('<style>' + styleText + '</style>')
|
243
181
|
|
244
|
-
|
182
|
+
this.fixturesNodes_.push(style)
|
183
|
+
$('head').append(style)
|
184
|
+
}
|
245
185
|
|
246
|
-
jasmine.StyleFixtures.prototype.
|
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.
|
193
|
+
jasmine.getJSONFixtures = function () {
|
194
|
+
return jasmine.currentJSONFixtures_ = jasmine.currentJSONFixtures_ || new jasmine.JSONFixtures()
|
195
|
+
}
|
249
196
|
|
250
|
-
jasmine.
|
197
|
+
jasmine.JSONFixtures = function () {
|
198
|
+
this.fixturesCache_ = {}
|
199
|
+
this.fixturesPath = 'spec/javascripts/fixtures/json'
|
200
|
+
}
|
251
201
|
|
252
|
-
jasmine.
|
253
|
-
|
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
|
-
|
258
|
-
this.fixturesPath = 'spec/javascripts/fixtures/json'
|
259
|
-
}
|
207
|
+
jasmine.JSONFixtures.prototype.read = function () {
|
208
|
+
var fixtureUrls = arguments
|
260
209
|
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
}
|
210
|
+
for(var urlCount = fixtureUrls.length, urlIndex = 0; urlIndex < urlCount; urlIndex++) {
|
211
|
+
this.getFixtureData_(fixtureUrls[urlIndex])
|
212
|
+
}
|
265
213
|
|
266
|
-
|
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.
|
279
|
-
|
280
|
-
|
281
|
-
}
|
217
|
+
jasmine.JSONFixtures.prototype.clearCache = function () {
|
218
|
+
this.fixturesCache_ = {}
|
219
|
+
}
|
282
220
|
|
283
|
-
jasmine.JSONFixtures.prototype.
|
284
|
-
|
285
|
-
|
286
|
-
|
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.
|
301
|
-
|
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.
|
244
|
+
jasmine.JSONFixtures.prototype.proxyCallTo_ = function (methodName, passedArguments) {
|
245
|
+
return this[methodName].apply(this, passedArguments)
|
246
|
+
}
|
305
247
|
|
306
|
-
jasmine.JQuery
|
307
|
-
return $('<div/>').append(html).html()
|
308
|
-
}
|
248
|
+
jasmine.JQuery = function () {}
|
309
249
|
|
310
|
-
jasmine.JQuery.
|
311
|
-
|
312
|
-
|
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.
|
254
|
+
jasmine.JQuery.elementToString = function (element) {
|
255
|
+
var domEl = $(element).get(0)
|
319
256
|
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
|
257
|
+
if (domEl === undefined || domEl.cloneNode)
|
258
|
+
return $('<div />').append($(element).clone()).html()
|
259
|
+
else
|
260
|
+
return element.toString()
|
324
261
|
}
|
325
262
|
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
handler
|
337
|
-
|
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
|
-
|
344
|
-
|
277
|
+
$(selector).on(eventName, handler)
|
278
|
+
data.handlers.push(handler)
|
345
279
|
|
346
|
-
|
347
|
-
|
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
|
-
|
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
|
-
|
354
|
-
|
355
|
-
|
300
|
+
wasTriggered: function (selector, eventName) {
|
301
|
+
return !!(data.spiedEvents[jasmine.spiedEventsKey(selector, eventName)])
|
302
|
+
},
|
356
303
|
|
357
|
-
|
358
|
-
|
359
|
-
|
360
|
-
|
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
|
-
|
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
|
-
|
385
|
-
|
386
|
-
|
387
|
-
return this.actual.hasClass(className)
|
388
|
-
},
|
348
|
+
toBeVisible: function () {
|
349
|
+
return this.actual.is(':visible')
|
350
|
+
},
|
389
351
|
|
390
|
-
|
391
|
-
|
392
|
-
|
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
|
-
|
466
|
-
|
467
|
-
|
356
|
+
toBeSelected: function () {
|
357
|
+
return this.actual.is(':selected')
|
358
|
+
},
|
468
359
|
|
469
|
-
|
470
|
-
|
471
|
-
|
360
|
+
toBeChecked: function () {
|
361
|
+
return this.actual.is(':checked')
|
362
|
+
},
|
472
363
|
|
473
|
-
|
474
|
-
|
475
|
-
|
364
|
+
toBeEmpty: function () {
|
365
|
+
return this.actual.is(':empty')
|
366
|
+
},
|
476
367
|
|
477
|
-
|
478
|
-
|
479
|
-
|
368
|
+
toExist: function () {
|
369
|
+
return this.actual.length
|
370
|
+
},
|
480
371
|
|
481
|
-
|
482
|
-
|
483
|
-
|
372
|
+
toHaveLength: function (length) {
|
373
|
+
return this.actual.length === length
|
374
|
+
},
|
484
375
|
|
485
|
-
|
486
|
-
|
487
|
-
|
376
|
+
toHaveAttr: function (attributeName, expectedAttributeValue) {
|
377
|
+
return hasProperty(this.actual.attr(attributeName), expectedAttributeValue)
|
378
|
+
},
|
488
379
|
|
489
|
-
|
490
|
-
|
491
|
-
|
380
|
+
toHaveProp: function (propertyName, expectedPropertyValue) {
|
381
|
+
return hasProperty(this.actual.prop(propertyName), expectedPropertyValue)
|
382
|
+
},
|
492
383
|
|
493
|
-
|
384
|
+
toHaveId: function (id) {
|
385
|
+
return this.actual.attr('id') == id
|
386
|
+
},
|
494
387
|
|
495
|
-
|
388
|
+
toHaveHtml: function (html) {
|
389
|
+
return this.actual.html() == jasmine.JQuery.browserTagCaseIndependentHtml(html)
|
390
|
+
},
|
496
391
|
|
497
|
-
|
498
|
-
|
499
|
-
|
392
|
+
toContainHtml: function (html){
|
393
|
+
var actualHtml = this.actual.html()
|
394
|
+
, expectedHtml = jasmine.JQuery.browserTagCaseIndependentHtml(html)
|
500
395
|
|
501
|
-
|
502
|
-
|
503
|
-
var sortedNamespaces = namespaces.slice(0).sort()
|
504
|
-
var namespaceRegExp = new RegExp("(^|\\.)" + sortedNamespaces.join("\\.(?:.*\\.)?") + "(\\.|$)")
|
396
|
+
return (actualHtml.indexOf(expectedHtml) >= 0)
|
397
|
+
},
|
505
398
|
|
506
|
-
|
507
|
-
|
508
|
-
|
509
|
-
|
510
|
-
|
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
|
-
}
|
514
|
-
|
515
|
-
|
516
|
-
|
517
|
-
|
518
|
-
|
519
|
-
|
520
|
-
|
521
|
-
|
522
|
-
|
523
|
-
|
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
|
-
|
530
|
-
|
531
|
-
return actualValue == expectedValue
|
532
|
-
}
|
484
|
+
var hasProperty = function (actualValue, expectedValue) {
|
485
|
+
if (expectedValue === undefined) return actualValue !== undefined
|
533
486
|
|
534
|
-
|
535
|
-
|
487
|
+
return actualValue == expectedValue
|
488
|
+
}
|
536
489
|
|
537
|
-
|
538
|
-
|
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
|
-
|
550
|
-
|
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
|
-
|
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
|
-
|
558
|
-
|
559
|
-
|
560
|
-
|
504
|
+
return result
|
505
|
+
}
|
506
|
+
|
507
|
+
if (builtInMatcher) {
|
508
|
+
return builtInMatcher.apply(this, arguments)
|
509
|
+
}
|
561
510
|
|
562
|
-
|
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
|
-
|
576
|
-
|
577
|
-
|
578
|
-
|
579
|
-
|
580
|
-
|
581
|
-
|
582
|
-
|
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
|
-
|
586
|
-
|
587
|
-
|
588
|
-
|
589
|
-
|
590
|
-
|
591
|
-
|
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 " +
|
598
|
-
"Expected event " +
|
540
|
+
"Expected event " + eventName + " to have been triggered on " + selector,
|
541
|
+
"Expected event " + eventName + " not to have been triggered on " + selector
|
599
542
|
]
|
600
|
-
}
|
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
|
603
|
-
"Expected event " + this.actual + " not to have been
|
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
|
-
|
608
|
-
|
609
|
-
|
610
|
-
|
611
|
-
|
612
|
-
|
613
|
-
|
614
|
-
|
615
|
-
|
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
|
-
|
619
|
-
|
620
|
-
|
621
|
-
|
622
|
-
|
623
|
-
|
624
|
-
|
625
|
-
|
626
|
-
|
627
|
-
|
628
|
-
|
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
|
-
|
632
|
-
|
633
|
-
|
634
|
-
|
635
|
-
|
636
|
-
|
637
|
-
|
638
|
-
|
639
|
-
|
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
|
-
|
643
|
-
|
644
|
-
|
645
|
-
|
646
|
-
|
647
|
-
|
648
|
-
|
649
|
-
|
650
|
-
|
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
|
-
|
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
|
-
|
661
|
-
|
662
|
-
|
663
|
-
|
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.
|
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-
|
11
|
+
date: 2013-09-28 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description:
|
14
14
|
email:
|