robeaux 0.3.0 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (99) hide show
  1. checksums.yaml +4 -4
  2. data/README.markdown +41 -61
  3. data/css/application.css +2 -0
  4. data/css/application.css.map +7 -0
  5. data/index.html +5 -39
  6. data/js/script.js +7 -0
  7. data/robeaux.gemspec +16 -8
  8. metadata +11 -104
  9. data/.gitignore +0 -1
  10. data/Gruntfile.js +0 -43
  11. data/Makefile +0 -22
  12. data/css/fonts.css +0 -59
  13. data/css/main.css +0 -1
  14. data/css/normalize.css +0 -425
  15. data/css/style.css +0 -558
  16. data/css/themes/artoo.css +0 -3
  17. data/css/themes/blackboard.css +0 -1
  18. data/css/themes/cylon.css +0 -3
  19. data/css/themes/dark.css +0 -1
  20. data/css/themes/gobot.css +0 -3
  21. data/css/themes/gray.css +0 -1
  22. data/css/themes/whiteboard.css +0 -1
  23. data/js/app.js +0 -1
  24. data/js/controllers/device_commands_ctrl.js +0 -81
  25. data/js/controllers/device_events_ctrl.js +0 -31
  26. data/js/controllers/index_ctrl.js +0 -9
  27. data/js/controllers/nav_ctrl.js +0 -5
  28. data/js/controllers/robot_commands_ctrl.js +0 -33
  29. data/js/controllers/robot_ctrl.js +0 -25
  30. data/js/controllers/themes_ctrl.js +0 -36
  31. data/js/controllers/widget_editor_ctrl.js +0 -44
  32. data/js/controllers/widgets_ctrl.js +0 -40
  33. data/js/directives/widget.js +0 -50
  34. data/js/router.js +0 -27
  35. data/js/services/themes.js +0 -90
  36. data/js/services/widgets.js +0 -86
  37. data/js/vendor/angular-route.min.js +0 -13
  38. data/js/vendor/angular.min.js +0 -212
  39. data/js/widgets/attitude.html +0 -32
  40. data/js/widgets/attitude.js +0 -27
  41. data/js/widgets/mindwave.html +0 -51
  42. data/js/widgets/mindwave.js +0 -23
  43. data/less/app.less +0 -21
  44. data/less/objects/buttons.less +0 -32
  45. data/less/objects/connections.less +0 -28
  46. data/less/objects/device.less +0 -30
  47. data/less/objects/forms.less +0 -29
  48. data/less/objects/list.less +0 -27
  49. data/less/objects/nav.less +0 -33
  50. data/less/objects/robot.less +0 -43
  51. data/less/objects/themes.less +0 -18
  52. data/less/objects/widgets.less +0 -85
  53. data/less/support/buttons.less +0 -39
  54. data/less/support/container.less +0 -9
  55. data/less/support/forms.less +0 -18
  56. data/less/support/mixins.less +0 -3
  57. data/less/themes/blackboard.less +0 -158
  58. data/less/themes/dark.less +0 -148
  59. data/less/themes/default.less +0 -52
  60. data/less/themes/gray.less +0 -121
  61. data/less/themes/whiteboard.less +0 -152
  62. data/less/vendor/elements.less +0 -156
  63. data/less/vendor/normalize.less +0 -425
  64. data/less/vendor/semantic-grid.less +0 -67
  65. data/less/views/devices.less +0 -47
  66. data/less/views/robots.less +0 -132
  67. data/less/views/themes.less +0 -31
  68. data/less/views/widgets.less +0 -50
  69. data/package.json +0 -21
  70. data/partials/device.html +0 -76
  71. data/partials/index.html +0 -17
  72. data/partials/robot.html +0 -127
  73. data/partials/themes.html +0 -42
  74. data/partials/widget_editor.html +0 -68
  75. data/test/controllers/device_commands_ctrl.js +0 -129
  76. data/test/controllers/device_events_ctrl.js +0 -82
  77. data/test/controllers/index_ctrl.js +0 -48
  78. data/test/controllers/nav_ctrl.js +0 -40
  79. data/test/controllers/robot_commands_ctrl.js +0 -127
  80. data/test/controllers/robot_ctrl.js +0 -62
  81. data/test/controllers/themes_ctrl.js +0 -96
  82. data/test/controllers/widget_editor_ctrl.js +0 -111
  83. data/test/controllers/widgets_ctrl.js +0 -74
  84. data/test/functions/functions.js +0 -30
  85. data/test/karma.conf.js +0 -76
  86. data/test/karma_test_all.conf.js +0 -23
  87. data/test/karma_test_controllers.conf.js +0 -19
  88. data/test/karma_test_functions.conf.js +0 -14
  89. data/test/karma_test_services.conf.js +0 -17
  90. data/test/services/themes.js +0 -122
  91. data/test/services/widgets.js +0 -104
  92. data/test/support/myDevice.json +0 -15
  93. data/test/support/myRobot.json +0 -31
  94. data/test/support/robots.json +0 -33
  95. data/test/support/themes.json +0 -9
  96. data/test/support/widgets.json +0 -18
  97. data/test/vendor/angular-mocks.js +0 -2163
  98. data/test/vendor/jasmine-jquery.js +0 -704
  99. data/test/vendor/jquery.js +0 -8755
@@ -1,704 +0,0 @@
1
- /*!
2
- Jasmine-jQuery: a set of jQuery helpers for Jasmine tests.
3
-
4
- Version 1.7.0
5
-
6
- https://github.com/velesin/jasmine-jquery
7
-
8
- Copyright (c) 2010-2013 Wojciech Zawistowski, Travis Jeffery
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:
17
-
18
- The above copyright notice and this permission notice shall be
19
- included in all copies or substantial portions of the Software.
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.
28
- */
29
-
30
- +function (jasmine, $) { "use strict";
31
-
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
- }
39
-
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
- }
49
-
50
- jasmine.Fixtures.prototype.set = function (html) {
51
- this.cleanUp()
52
- return this.createContainer_(html)
53
- }
54
-
55
- jasmine.Fixtures.prototype.appendSet= function (html) {
56
- this.addToContainer_(html)
57
- }
58
-
59
- jasmine.Fixtures.prototype.preload = function () {
60
- this.read.apply(this, arguments)
61
- }
62
-
63
- jasmine.Fixtures.prototype.load = function () {
64
- this.cleanUp()
65
- this.createContainer_(this.read.apply(this, arguments))
66
- }
67
-
68
- jasmine.Fixtures.prototype.appendLoad = function () {
69
- this.addToContainer_(this.read.apply(this, arguments))
70
- }
71
-
72
- jasmine.Fixtures.prototype.read = function () {
73
- var htmlChunks = []
74
- , fixtureUrls = arguments
75
-
76
- for(var urlCount = fixtureUrls.length, urlIndex = 0; urlIndex < urlCount; urlIndex++) {
77
- htmlChunks.push(this.getFixtureHtml_(fixtureUrls[urlIndex]))
78
- }
79
-
80
- return htmlChunks.join('')
81
- }
82
-
83
- jasmine.Fixtures.prototype.clearCache = function () {
84
- this.fixturesCache_ = {}
85
- }
86
-
87
- jasmine.Fixtures.prototype.cleanUp = function () {
88
- $('#' + this.containerId).remove()
89
- }
90
-
91
- jasmine.Fixtures.prototype.sandbox = function (attributes) {
92
- var attributesToSet = attributes || {}
93
- return $('<div id="sandbox" />').attr(attributesToSet)
94
- }
95
-
96
- jasmine.Fixtures.prototype.createContainer_ = function (html) {
97
- var container = $('<div>')
98
- .attr('id', this.containerId)
99
- .html(html)
100
-
101
- $(document.body).append(container)
102
- return container
103
- }
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
- }
111
-
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
- }
118
-
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
- }
138
-
139
- jasmine.Fixtures.prototype.proxyCallTo_ = function (methodName, passedArguments) {
140
- return this[methodName].apply(this, passedArguments)
141
- }
142
-
143
-
144
- jasmine.StyleFixtures = function () {
145
- this.fixturesCache_ = {}
146
- this.fixturesNodes_ = []
147
- this.fixturesPath = 'spec/javascripts/fixtures'
148
- }
149
-
150
- jasmine.StyleFixtures.prototype.set = function (css) {
151
- this.cleanUp()
152
- this.createStyle_(css)
153
- }
154
-
155
- jasmine.StyleFixtures.prototype.appendSet = function (css) {
156
- this.createStyle_(css)
157
- }
158
-
159
- jasmine.StyleFixtures.prototype.preload = function () {
160
- this.read_.apply(this, arguments)
161
- }
162
-
163
- jasmine.StyleFixtures.prototype.load = function () {
164
- this.cleanUp()
165
- this.createStyle_(this.read_.apply(this, arguments))
166
- }
167
-
168
- jasmine.StyleFixtures.prototype.appendLoad = function () {
169
- this.createStyle_(this.read_.apply(this, arguments))
170
- }
171
-
172
- jasmine.StyleFixtures.prototype.cleanUp = function () {
173
- while(this.fixturesNodes_.length) {
174
- this.fixturesNodes_.pop().remove()
175
- }
176
- }
177
-
178
- jasmine.StyleFixtures.prototype.createStyle_ = function (html) {
179
- var styleText = $('<div></div>').html(html).text()
180
- , style = $('<style>' + styleText + '</style>')
181
-
182
- this.fixturesNodes_.push(style)
183
- $('head').append(style)
184
- }
185
-
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_
192
-
193
- jasmine.getJSONFixtures = function () {
194
- return jasmine.currentJSONFixtures_ = jasmine.currentJSONFixtures_ || new jasmine.JSONFixtures()
195
- }
196
-
197
- jasmine.JSONFixtures = function () {
198
- this.fixturesCache_ = {}
199
- this.fixturesPath = 'spec/javascripts/fixtures/json'
200
- }
201
-
202
- jasmine.JSONFixtures.prototype.load = function () {
203
- this.read.apply(this, arguments)
204
- return this.fixturesCache_
205
- }
206
-
207
- jasmine.JSONFixtures.prototype.read = function () {
208
- var fixtureUrls = arguments
209
-
210
- for(var urlCount = fixtureUrls.length, urlIndex = 0; urlIndex < urlCount; urlIndex++) {
211
- this.getFixtureData_(fixtureUrls[urlIndex])
212
- }
213
-
214
- return this.fixturesCache_
215
- }
216
-
217
- jasmine.JSONFixtures.prototype.clearCache = function () {
218
- this.fixturesCache_ = {}
219
- }
220
-
221
- jasmine.JSONFixtures.prototype.getFixtureData_ = function (url) {
222
- if (!this.fixturesCache_[url]) this.loadFixtureIntoCache_(url)
223
- return this.fixturesCache_[url]
224
- }
225
-
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
- }
243
-
244
- jasmine.JSONFixtures.prototype.proxyCallTo_ = function (methodName, passedArguments) {
245
- return this[methodName].apply(this, passedArguments)
246
- }
247
-
248
- jasmine.jQuery = function () {}
249
-
250
- jasmine.jQuery.browserTagCaseIndependentHtml = function (html) {
251
- return $('<div/>').append(html).html()
252
- }
253
-
254
- jasmine.jQuery.elementToString = function (element) {
255
- return $(element).map(function () { return this.outerHTML; }).toArray().join(', ')
256
- }
257
-
258
- jasmine.jQuery.matchersClass = {}
259
-
260
- var data = {
261
- spiedEvents: {}
262
- , handlers: []
263
- }
264
-
265
- jasmine.jQuery.events = {
266
- spyOn: function (selector, eventName) {
267
- var handler = function (e) {
268
- data.spiedEvents[jasmine.spiedEventsKey(selector, eventName)] = jasmine.util.argsToArray(arguments)
269
- }
270
-
271
- $(selector).on(eventName, handler)
272
- data.handlers.push(handler)
273
-
274
- return {
275
- selector: selector,
276
- eventName: eventName,
277
- handler: handler,
278
- reset: function (){
279
- delete data.spiedEvents[jasmine.spiedEventsKey(selector, eventName)]
280
- }
281
- }
282
- },
283
-
284
- args: function (selector, eventName) {
285
- var actualArgs = data.spiedEvents[jasmine.spiedEventsKey(selector, eventName)]
286
-
287
- if (!actualArgs) {
288
- throw "There is no spy for " + eventName + " on " + selector.toString() + ". Make sure to create a spy using spyOnEvent."
289
- }
290
-
291
- return actualArgs
292
- },
293
-
294
- wasTriggered: function (selector, eventName) {
295
- return !!(data.spiedEvents[jasmine.spiedEventsKey(selector, eventName)])
296
- },
297
-
298
- wasTriggeredWith: function (selector, eventName, expectedArgs, env) {
299
- var actualArgs = jasmine.jQuery.events.args(selector, eventName).slice(1)
300
- if (Object.prototype.toString.call(expectedArgs) !== '[object Array]') {
301
- actualArgs = actualArgs[0]
302
- }
303
- return env.equals_(expectedArgs, actualArgs)
304
- },
305
-
306
- wasPrevented: function (selector, eventName) {
307
- var args = data.spiedEvents[jasmine.spiedEventsKey(selector, eventName)]
308
- , e = args ? args[0] : undefined
309
-
310
- return e && e.isDefaultPrevented()
311
- },
312
-
313
- wasStopped: function (selector, eventName) {
314
- var args = data.spiedEvents[jasmine.spiedEventsKey(selector, eventName)]
315
- , e = args ? args[0] : undefined
316
- return e && e.isPropagationStopped()
317
- },
318
-
319
- cleanUp: function () {
320
- data.spiedEvents = {}
321
- data.handlers = []
322
- }
323
- }
324
-
325
- var jQueryMatchers = {
326
- toHaveClass: function (className) {
327
- return this.actual.hasClass(className)
328
- },
329
-
330
- toHaveCss: function (css){
331
- for (var prop in css){
332
- var value = css[prop]
333
- // see issue #147 on gh
334
- ;if (value === 'auto' && this.actual.get(0).style[prop] === 'auto') continue
335
- if (this.actual.css(prop) !== value) return false
336
- }
337
- return true
338
- },
339
-
340
- toBeVisible: function () {
341
- return this.actual.is(':visible')
342
- },
343
-
344
- toBeHidden: function () {
345
- return this.actual.is(':hidden')
346
- },
347
-
348
- toBeSelected: function () {
349
- return this.actual.is(':selected')
350
- },
351
-
352
- toBeChecked: function () {
353
- return this.actual.is(':checked')
354
- },
355
-
356
- toBeEmpty: function () {
357
- return this.actual.is(':empty')
358
- },
359
-
360
- toBeInDOM: function () {
361
- return $.contains(document.documentElement, this.actual[0])
362
- },
363
-
364
- toExist: function () {
365
- return this.actual.length
366
- },
367
-
368
- toHaveLength: function (length) {
369
- return this.actual.length === length
370
- },
371
-
372
- toHaveAttr: function (attributeName, expectedAttributeValue) {
373
- return hasProperty(this.actual.attr(attributeName), expectedAttributeValue)
374
- },
375
-
376
- toHaveProp: function (propertyName, expectedPropertyValue) {
377
- return hasProperty(this.actual.prop(propertyName), expectedPropertyValue)
378
- },
379
-
380
- toHaveId: function (id) {
381
- return this.actual.attr('id') == id
382
- },
383
-
384
- toHaveHtml: function (html) {
385
- return this.actual.html() == jasmine.jQuery.browserTagCaseIndependentHtml(html)
386
- },
387
-
388
- toContainHtml: function (html){
389
- var actualHtml = this.actual.html()
390
- , expectedHtml = jasmine.jQuery.browserTagCaseIndependentHtml(html)
391
-
392
- return (actualHtml.indexOf(expectedHtml) >= 0)
393
- },
394
-
395
- toHaveText: function (text) {
396
- var trimmedText = $.trim(this.actual.text())
397
-
398
- if (text && $.isFunction(text.test)) {
399
- return text.test(trimmedText)
400
- } else {
401
- return trimmedText == text
402
- }
403
- },
404
-
405
- toContainText: function (text) {
406
- var trimmedText = $.trim(this.actual.text())
407
-
408
- if (text && $.isFunction(text.test)) {
409
- return text.test(trimmedText)
410
- } else {
411
- return trimmedText.indexOf(text) != -1
412
- }
413
- },
414
-
415
- toHaveValue: function (value) {
416
- return this.actual.val() === value
417
- },
418
-
419
- toHaveData: function (key, expectedValue) {
420
- return hasProperty(this.actual.data(key), expectedValue)
421
- },
422
-
423
- toBe: function (selector) {
424
- return this.actual.is(selector)
425
- },
426
-
427
- toContain: function (selector) {
428
- return this.actual.find(selector).length
429
- },
430
-
431
- toBeMatchedBy: function (selector) {
432
- return this.actual.filter(selector).length
433
- },
434
-
435
- toBeDisabled: function (selector){
436
- return this.actual.is(':disabled')
437
- },
438
-
439
- toBeFocused: function (selector) {
440
- return this.actual[0] === this.actual[0].ownerDocument.activeElement
441
- },
442
-
443
- toHandle: function (event) {
444
- var events = $._data(this.actual.get(0), "events")
445
-
446
- if(!events || !event || typeof event !== "string") {
447
- return false
448
- }
449
-
450
- var namespaces = event.split(".")
451
- , eventType = namespaces.shift()
452
- , sortedNamespaces = namespaces.slice(0).sort()
453
- , namespaceRegExp = new RegExp("(^|\\.)" + sortedNamespaces.join("\\.(?:.*\\.)?") + "(\\.|$)")
454
-
455
- if(events[eventType] && namespaces.length) {
456
- for(var i = 0; i < events[eventType].length; i++) {
457
- var namespace = events[eventType][i].namespace
458
-
459
- if(namespaceRegExp.test(namespace)) {
460
- return true
461
- }
462
- }
463
- } else {
464
- return events[eventType] && events[eventType].length > 0
465
- }
466
- },
467
-
468
- toHandleWith: function (eventName, eventHandler) {
469
- var normalizedEventName = eventName.split('.')[0]
470
- , stack = $._data(this.actual.get(0), "events")[normalizedEventName]
471
-
472
- for (var i = 0; i < stack.length; i++) {
473
- if (stack[i].handler == eventHandler) return true
474
- }
475
-
476
- return false
477
- }
478
- }
479
-
480
- var hasProperty = function (actualValue, expectedValue) {
481
- if (expectedValue === undefined) return actualValue !== undefined
482
-
483
- return actualValue === expectedValue
484
- }
485
-
486
- var bindMatcher = function (methodName) {
487
- var builtInMatcher = jasmine.Matchers.prototype[methodName]
488
-
489
- jasmine.jQuery.matchersClass[methodName] = function () {
490
- if (this.actual
491
- && (this.actual instanceof $
492
- || jasmine.isDomNode(this.actual))) {
493
- this.actual = $(this.actual)
494
- var result = jQueryMatchers[methodName].apply(this, arguments)
495
- , element
496
-
497
- if (this.actual.get && (element = this.actual.get()[0]) && !$.isWindow(element) && element.tagName !== "HTML")
498
- this.actual = jasmine.jQuery.elementToString(this.actual)
499
-
500
- return result
501
- }
502
-
503
- if (builtInMatcher) {
504
- return builtInMatcher.apply(this, arguments)
505
- }
506
-
507
- return false
508
- }
509
- }
510
-
511
- for(var methodName in jQueryMatchers) {
512
- bindMatcher(methodName)
513
- }
514
-
515
- beforeEach(function () {
516
- this.addMatchers(jasmine.jQuery.matchersClass)
517
- this.addMatchers({
518
- toHaveBeenTriggeredOn: function (selector) {
519
- this.message = function () {
520
- return [
521
- "Expected event " + this.actual + " to have been triggered on " + selector,
522
- "Expected event " + this.actual + " not to have been triggered on " + selector
523
- ]
524
- }
525
- return jasmine.jQuery.events.wasTriggered(selector, this.actual)
526
- }
527
- })
528
-
529
- this.addMatchers({
530
- toHaveBeenTriggered: function (){
531
- var eventName = this.actual.eventName
532
- , selector = this.actual.selector
533
-
534
- this.message = function () {
535
- return [
536
- "Expected event " + eventName + " to have been triggered on " + selector,
537
- "Expected event " + eventName + " not to have been triggered on " + selector
538
- ]
539
- }
540
-
541
- return jasmine.jQuery.events.wasTriggered(selector, eventName)
542
- }
543
- })
544
-
545
- this.addMatchers({
546
- toHaveBeenTriggeredOnAndWith: function () {
547
- var selector = arguments[0]
548
- , expectedArgs = arguments[1]
549
- , wasTriggered = jasmine.jQuery.events.wasTriggered(selector, this.actual)
550
-
551
- this.message = function () {
552
- if (wasTriggered) {
553
- var actualArgs = jasmine.jQuery.events.args(selector, this.actual, expectedArgs)[1]
554
- return [
555
- "Expected event " + this.actual + " to have been triggered with " + jasmine.pp(expectedArgs) + " but it was triggered with " + jasmine.pp(actualArgs),
556
- "Expected event " + this.actual + " not to have been triggered with " + jasmine.pp(expectedArgs) + " but it was triggered with " + jasmine.pp(actualArgs)
557
- ]
558
- } else {
559
- return [
560
- "Expected event " + this.actual + " to have been triggered on " + selector,
561
- "Expected event " + this.actual + " not to have been triggered on " + selector
562
- ]
563
- }
564
- }
565
-
566
- return wasTriggered && jasmine.jQuery.events.wasTriggeredWith(selector, this.actual, expectedArgs, this.env)
567
- }
568
- })
569
-
570
- this.addMatchers({
571
- toHaveBeenPreventedOn: function (selector) {
572
- this.message = function () {
573
- return [
574
- "Expected event " + this.actual + " to have been prevented on " + selector,
575
- "Expected event " + this.actual + " not to have been prevented on " + selector
576
- ]
577
- }
578
-
579
- return jasmine.jQuery.events.wasPrevented(selector, this.actual)
580
- }
581
- })
582
-
583
- this.addMatchers({
584
- toHaveBeenPrevented: function () {
585
- var eventName = this.actual.eventName
586
- , selector = this.actual.selector
587
- this.message = function () {
588
- return [
589
- "Expected event " + eventName + " to have been prevented on " + selector,
590
- "Expected event " + eventName + " not to have been prevented on " + selector
591
- ]
592
- }
593
-
594
- return jasmine.jQuery.events.wasPrevented(selector, eventName)
595
- }
596
- })
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)
608
- }
609
- })
610
-
611
- this.addMatchers({
612
- toHaveBeenStopped: function () {
613
- var eventName = this.actual.eventName
614
- , selector = this.actual.selector
615
- this.message = function () {
616
- return [
617
- "Expected event " + eventName + " to have been stopped on " + selector,
618
- "Expected event " + eventName + " not to have been stopped on " + selector
619
- ]
620
- }
621
- return jasmine.jQuery.events.wasStopped(selector, eventName)
622
- }
623
- })
624
-
625
- jasmine.getEnv().addEqualityTester(function (a, b) {
626
- if(a instanceof $ && b instanceof $) {
627
- if(a.size() != b.size()) {
628
- return jasmine.undefined
629
- }
630
- else if(a.is(b)) {
631
- return true
632
- }
633
- }
634
-
635
- return jasmine.undefined
636
- })
637
- })
638
-
639
- afterEach(function () {
640
- jasmine.getFixtures().cleanUp()
641
- jasmine.getStyleFixtures().cleanUp()
642
- jasmine.jQuery.events.cleanUp()
643
- })
644
-
645
- window.readFixtures = function () {
646
- return jasmine.getFixtures().proxyCallTo_('read', arguments)
647
- }
648
-
649
- window.preloadFixtures = function () {
650
- jasmine.getFixtures().proxyCallTo_('preload', arguments)
651
- }
652
-
653
- window.loadFixtures = function () {
654
- jasmine.getFixtures().proxyCallTo_('load', arguments)
655
- }
656
-
657
- window.appendLoadFixtures = function () {
658
- jasmine.getFixtures().proxyCallTo_('appendLoad', arguments)
659
- }
660
-
661
- window.setFixtures = function (html) {
662
- return jasmine.getFixtures().proxyCallTo_('set', arguments)
663
- }
664
-
665
- window.appendSetFixtures = function () {
666
- jasmine.getFixtures().proxyCallTo_('appendSet', arguments)
667
- }
668
-
669
- window.sandbox = function (attributes) {
670
- return jasmine.getFixtures().sandbox(attributes)
671
- }
672
-
673
- window.spyOnEvent = function (selector, eventName) {
674
- return jasmine.jQuery.events.spyOn(selector, eventName)
675
- }
676
-
677
- window.preloadStyleFixtures = function () {
678
- jasmine.getStyleFixtures().proxyCallTo_('preload', arguments)
679
- }
680
-
681
- window.loadStyleFixtures = function () {
682
- jasmine.getStyleFixtures().proxyCallTo_('load', arguments)
683
- }
684
-
685
- window.appendLoadStyleFixtures = function () {
686
- jasmine.getStyleFixtures().proxyCallTo_('appendLoad', arguments)
687
- }
688
-
689
- window.setStyleFixtures = function (html) {
690
- jasmine.getStyleFixtures().proxyCallTo_('set', arguments)
691
- }
692
-
693
- window.appendSetStyleFixtures = function (html) {
694
- jasmine.getStyleFixtures().proxyCallTo_('appendSet', arguments)
695
- }
696
-
697
- window.loadJSONFixtures = function () {
698
- return jasmine.getJSONFixtures().proxyCallTo_('load', arguments)
699
- }
700
-
701
- window.getJSONFixture = function (url) {
702
- return jasmine.getJSONFixtures().proxyCallTo_('read', arguments)[url]
703
- }
704
- }(window.jasmine, window.jQuery);