Mercurial > hg > OKFNAnnotator
annotate annotator_files/lib/vendor/jasmine-jquery.js @ 3:6356e78ccf5c
new version contains Annotator JS files to be used with FilesystemSite.
author | casties |
---|---|
date | Thu, 05 Apr 2012 19:37:27 +0200 |
parents | |
children |
rev | line source |
---|---|
3
6356e78ccf5c
new version contains Annotator JS files to be used with FilesystemSite.
casties
parents:
diff
changeset
|
1 var readFixtures = function() { |
6356e78ccf5c
new version contains Annotator JS files to be used with FilesystemSite.
casties
parents:
diff
changeset
|
2 return jasmine.getFixtures().proxyCallTo_('read', arguments); |
6356e78ccf5c
new version contains Annotator JS files to be used with FilesystemSite.
casties
parents:
diff
changeset
|
3 }; |
6356e78ccf5c
new version contains Annotator JS files to be used with FilesystemSite.
casties
parents:
diff
changeset
|
4 |
6356e78ccf5c
new version contains Annotator JS files to be used with FilesystemSite.
casties
parents:
diff
changeset
|
5 var loadFixtures = function() { |
6356e78ccf5c
new version contains Annotator JS files to be used with FilesystemSite.
casties
parents:
diff
changeset
|
6 jasmine.getFixtures().proxyCallTo_('load', arguments); |
6356e78ccf5c
new version contains Annotator JS files to be used with FilesystemSite.
casties
parents:
diff
changeset
|
7 }; |
6356e78ccf5c
new version contains Annotator JS files to be used with FilesystemSite.
casties
parents:
diff
changeset
|
8 |
6356e78ccf5c
new version contains Annotator JS files to be used with FilesystemSite.
casties
parents:
diff
changeset
|
9 var setFixtures = function(html) { |
6356e78ccf5c
new version contains Annotator JS files to be used with FilesystemSite.
casties
parents:
diff
changeset
|
10 jasmine.getFixtures().set(html); |
6356e78ccf5c
new version contains Annotator JS files to be used with FilesystemSite.
casties
parents:
diff
changeset
|
11 }; |
6356e78ccf5c
new version contains Annotator JS files to be used with FilesystemSite.
casties
parents:
diff
changeset
|
12 |
6356e78ccf5c
new version contains Annotator JS files to be used with FilesystemSite.
casties
parents:
diff
changeset
|
13 var sandbox = function(attributes) { |
6356e78ccf5c
new version contains Annotator JS files to be used with FilesystemSite.
casties
parents:
diff
changeset
|
14 return jasmine.getFixtures().sandbox(attributes); |
6356e78ccf5c
new version contains Annotator JS files to be used with FilesystemSite.
casties
parents:
diff
changeset
|
15 }; |
6356e78ccf5c
new version contains Annotator JS files to be used with FilesystemSite.
casties
parents:
diff
changeset
|
16 |
6356e78ccf5c
new version contains Annotator JS files to be used with FilesystemSite.
casties
parents:
diff
changeset
|
17 jasmine.getFixtures = function() { |
6356e78ccf5c
new version contains Annotator JS files to be used with FilesystemSite.
casties
parents:
diff
changeset
|
18 return jasmine.currentFixtures_ = jasmine.currentFixtures_ || new jasmine.Fixtures(); |
6356e78ccf5c
new version contains Annotator JS files to be used with FilesystemSite.
casties
parents:
diff
changeset
|
19 }; |
6356e78ccf5c
new version contains Annotator JS files to be used with FilesystemSite.
casties
parents:
diff
changeset
|
20 |
6356e78ccf5c
new version contains Annotator JS files to be used with FilesystemSite.
casties
parents:
diff
changeset
|
21 jasmine.Fixtures = function() { |
6356e78ccf5c
new version contains Annotator JS files to be used with FilesystemSite.
casties
parents:
diff
changeset
|
22 this.containerId = 'jasmine-fixtures'; |
6356e78ccf5c
new version contains Annotator JS files to be used with FilesystemSite.
casties
parents:
diff
changeset
|
23 this.fixturesCache_ = {}; |
6356e78ccf5c
new version contains Annotator JS files to be used with FilesystemSite.
casties
parents:
diff
changeset
|
24 this.fixturesPath = 'spec/javascripts/fixtures'; |
6356e78ccf5c
new version contains Annotator JS files to be used with FilesystemSite.
casties
parents:
diff
changeset
|
25 }; |
6356e78ccf5c
new version contains Annotator JS files to be used with FilesystemSite.
casties
parents:
diff
changeset
|
26 |
6356e78ccf5c
new version contains Annotator JS files to be used with FilesystemSite.
casties
parents:
diff
changeset
|
27 jasmine.Fixtures.prototype.set = function(html) { |
6356e78ccf5c
new version contains Annotator JS files to be used with FilesystemSite.
casties
parents:
diff
changeset
|
28 this.cleanUp(); |
6356e78ccf5c
new version contains Annotator JS files to be used with FilesystemSite.
casties
parents:
diff
changeset
|
29 this.createContainer_(html); |
6356e78ccf5c
new version contains Annotator JS files to be used with FilesystemSite.
casties
parents:
diff
changeset
|
30 }; |
6356e78ccf5c
new version contains Annotator JS files to be used with FilesystemSite.
casties
parents:
diff
changeset
|
31 |
6356e78ccf5c
new version contains Annotator JS files to be used with FilesystemSite.
casties
parents:
diff
changeset
|
32 jasmine.Fixtures.prototype.load = function() { |
6356e78ccf5c
new version contains Annotator JS files to be used with FilesystemSite.
casties
parents:
diff
changeset
|
33 this.cleanUp(); |
6356e78ccf5c
new version contains Annotator JS files to be used with FilesystemSite.
casties
parents:
diff
changeset
|
34 this.createContainer_(this.read.apply(this, arguments)); |
6356e78ccf5c
new version contains Annotator JS files to be used with FilesystemSite.
casties
parents:
diff
changeset
|
35 }; |
6356e78ccf5c
new version contains Annotator JS files to be used with FilesystemSite.
casties
parents:
diff
changeset
|
36 |
6356e78ccf5c
new version contains Annotator JS files to be used with FilesystemSite.
casties
parents:
diff
changeset
|
37 jasmine.Fixtures.prototype.read = function() { |
6356e78ccf5c
new version contains Annotator JS files to be used with FilesystemSite.
casties
parents:
diff
changeset
|
38 var htmlChunks = []; |
6356e78ccf5c
new version contains Annotator JS files to be used with FilesystemSite.
casties
parents:
diff
changeset
|
39 |
6356e78ccf5c
new version contains Annotator JS files to be used with FilesystemSite.
casties
parents:
diff
changeset
|
40 var fixtureUrls = arguments; |
6356e78ccf5c
new version contains Annotator JS files to be used with FilesystemSite.
casties
parents:
diff
changeset
|
41 for(var urlCount = fixtureUrls.length, urlIndex = 0; urlIndex < urlCount; urlIndex++) { |
6356e78ccf5c
new version contains Annotator JS files to be used with FilesystemSite.
casties
parents:
diff
changeset
|
42 htmlChunks.push(this.getFixtureHtml_(fixtureUrls[urlIndex])); |
6356e78ccf5c
new version contains Annotator JS files to be used with FilesystemSite.
casties
parents:
diff
changeset
|
43 } |
6356e78ccf5c
new version contains Annotator JS files to be used with FilesystemSite.
casties
parents:
diff
changeset
|
44 |
6356e78ccf5c
new version contains Annotator JS files to be used with FilesystemSite.
casties
parents:
diff
changeset
|
45 return htmlChunks.join(''); |
6356e78ccf5c
new version contains Annotator JS files to be used with FilesystemSite.
casties
parents:
diff
changeset
|
46 }; |
6356e78ccf5c
new version contains Annotator JS files to be used with FilesystemSite.
casties
parents:
diff
changeset
|
47 |
6356e78ccf5c
new version contains Annotator JS files to be used with FilesystemSite.
casties
parents:
diff
changeset
|
48 jasmine.Fixtures.prototype.clearCache = function() { |
6356e78ccf5c
new version contains Annotator JS files to be used with FilesystemSite.
casties
parents:
diff
changeset
|
49 this.fixturesCache_ = {}; |
6356e78ccf5c
new version contains Annotator JS files to be used with FilesystemSite.
casties
parents:
diff
changeset
|
50 }; |
6356e78ccf5c
new version contains Annotator JS files to be used with FilesystemSite.
casties
parents:
diff
changeset
|
51 |
6356e78ccf5c
new version contains Annotator JS files to be used with FilesystemSite.
casties
parents:
diff
changeset
|
52 jasmine.Fixtures.prototype.cleanUp = function() { |
6356e78ccf5c
new version contains Annotator JS files to be used with FilesystemSite.
casties
parents:
diff
changeset
|
53 $('#' + this.containerId).remove(); |
6356e78ccf5c
new version contains Annotator JS files to be used with FilesystemSite.
casties
parents:
diff
changeset
|
54 }; |
6356e78ccf5c
new version contains Annotator JS files to be used with FilesystemSite.
casties
parents:
diff
changeset
|
55 |
6356e78ccf5c
new version contains Annotator JS files to be used with FilesystemSite.
casties
parents:
diff
changeset
|
56 jasmine.Fixtures.prototype.sandbox = function(attributes) { |
6356e78ccf5c
new version contains Annotator JS files to be used with FilesystemSite.
casties
parents:
diff
changeset
|
57 var attributesToSet = attributes || {}; |
6356e78ccf5c
new version contains Annotator JS files to be used with FilesystemSite.
casties
parents:
diff
changeset
|
58 return $('<div id="sandbox" />').attr(attributesToSet); |
6356e78ccf5c
new version contains Annotator JS files to be used with FilesystemSite.
casties
parents:
diff
changeset
|
59 }; |
6356e78ccf5c
new version contains Annotator JS files to be used with FilesystemSite.
casties
parents:
diff
changeset
|
60 |
6356e78ccf5c
new version contains Annotator JS files to be used with FilesystemSite.
casties
parents:
diff
changeset
|
61 jasmine.Fixtures.prototype.createContainer_ = function(html) { |
6356e78ccf5c
new version contains Annotator JS files to be used with FilesystemSite.
casties
parents:
diff
changeset
|
62 var container = $('<div id="' + this.containerId + '" />'); |
6356e78ccf5c
new version contains Annotator JS files to be used with FilesystemSite.
casties
parents:
diff
changeset
|
63 container.html(html); |
6356e78ccf5c
new version contains Annotator JS files to be used with FilesystemSite.
casties
parents:
diff
changeset
|
64 $('body').append(container); |
6356e78ccf5c
new version contains Annotator JS files to be used with FilesystemSite.
casties
parents:
diff
changeset
|
65 }; |
6356e78ccf5c
new version contains Annotator JS files to be used with FilesystemSite.
casties
parents:
diff
changeset
|
66 |
6356e78ccf5c
new version contains Annotator JS files to be used with FilesystemSite.
casties
parents:
diff
changeset
|
67 jasmine.Fixtures.prototype.getFixtureHtml_ = function(url) { |
6356e78ccf5c
new version contains Annotator JS files to be used with FilesystemSite.
casties
parents:
diff
changeset
|
68 if (typeof this.fixturesCache_[url] == 'undefined') { |
6356e78ccf5c
new version contains Annotator JS files to be used with FilesystemSite.
casties
parents:
diff
changeset
|
69 this.loadFixtureIntoCache_(url); |
6356e78ccf5c
new version contains Annotator JS files to be used with FilesystemSite.
casties
parents:
diff
changeset
|
70 } |
6356e78ccf5c
new version contains Annotator JS files to be used with FilesystemSite.
casties
parents:
diff
changeset
|
71 return this.fixturesCache_[url]; |
6356e78ccf5c
new version contains Annotator JS files to be used with FilesystemSite.
casties
parents:
diff
changeset
|
72 }; |
6356e78ccf5c
new version contains Annotator JS files to be used with FilesystemSite.
casties
parents:
diff
changeset
|
73 |
6356e78ccf5c
new version contains Annotator JS files to be used with FilesystemSite.
casties
parents:
diff
changeset
|
74 jasmine.Fixtures.prototype.loadFixtureIntoCache_ = function(relativeUrl) { |
6356e78ccf5c
new version contains Annotator JS files to be used with FilesystemSite.
casties
parents:
diff
changeset
|
75 var self = this; |
6356e78ccf5c
new version contains Annotator JS files to be used with FilesystemSite.
casties
parents:
diff
changeset
|
76 var url = this.fixturesPath.match('/$') ? this.fixturesPath + relativeUrl : this.fixturesPath + '/' + relativeUrl; |
6356e78ccf5c
new version contains Annotator JS files to be used with FilesystemSite.
casties
parents:
diff
changeset
|
77 $.ajax({ |
6356e78ccf5c
new version contains Annotator JS files to be used with FilesystemSite.
casties
parents:
diff
changeset
|
78 async: false, // must be synchronous to guarantee that no tests are run before fixture is loaded |
6356e78ccf5c
new version contains Annotator JS files to be used with FilesystemSite.
casties
parents:
diff
changeset
|
79 cache: false, |
6356e78ccf5c
new version contains Annotator JS files to be used with FilesystemSite.
casties
parents:
diff
changeset
|
80 dataType: 'html', |
6356e78ccf5c
new version contains Annotator JS files to be used with FilesystemSite.
casties
parents:
diff
changeset
|
81 url: url, |
6356e78ccf5c
new version contains Annotator JS files to be used with FilesystemSite.
casties
parents:
diff
changeset
|
82 success: function(data) { |
6356e78ccf5c
new version contains Annotator JS files to be used with FilesystemSite.
casties
parents:
diff
changeset
|
83 self.fixturesCache_[relativeUrl] = data; |
6356e78ccf5c
new version contains Annotator JS files to be used with FilesystemSite.
casties
parents:
diff
changeset
|
84 } |
6356e78ccf5c
new version contains Annotator JS files to be used with FilesystemSite.
casties
parents:
diff
changeset
|
85 }); |
6356e78ccf5c
new version contains Annotator JS files to be used with FilesystemSite.
casties
parents:
diff
changeset
|
86 }; |
6356e78ccf5c
new version contains Annotator JS files to be used with FilesystemSite.
casties
parents:
diff
changeset
|
87 |
6356e78ccf5c
new version contains Annotator JS files to be used with FilesystemSite.
casties
parents:
diff
changeset
|
88 jasmine.Fixtures.prototype.proxyCallTo_ = function(methodName, passedArguments) { |
6356e78ccf5c
new version contains Annotator JS files to be used with FilesystemSite.
casties
parents:
diff
changeset
|
89 return this[methodName].apply(this, passedArguments); |
6356e78ccf5c
new version contains Annotator JS files to be used with FilesystemSite.
casties
parents:
diff
changeset
|
90 }; |
6356e78ccf5c
new version contains Annotator JS files to be used with FilesystemSite.
casties
parents:
diff
changeset
|
91 |
6356e78ccf5c
new version contains Annotator JS files to be used with FilesystemSite.
casties
parents:
diff
changeset
|
92 |
6356e78ccf5c
new version contains Annotator JS files to be used with FilesystemSite.
casties
parents:
diff
changeset
|
93 jasmine.JQuery = function() {}; |
6356e78ccf5c
new version contains Annotator JS files to be used with FilesystemSite.
casties
parents:
diff
changeset
|
94 |
6356e78ccf5c
new version contains Annotator JS files to be used with FilesystemSite.
casties
parents:
diff
changeset
|
95 jasmine.JQuery.browserTagCaseIndependentHtml = function(html) { |
6356e78ccf5c
new version contains Annotator JS files to be used with FilesystemSite.
casties
parents:
diff
changeset
|
96 return $('<div/>').append(html).html(); |
6356e78ccf5c
new version contains Annotator JS files to be used with FilesystemSite.
casties
parents:
diff
changeset
|
97 }; |
6356e78ccf5c
new version contains Annotator JS files to be used with FilesystemSite.
casties
parents:
diff
changeset
|
98 |
6356e78ccf5c
new version contains Annotator JS files to be used with FilesystemSite.
casties
parents:
diff
changeset
|
99 jasmine.JQuery.elementToString = function(element) { |
6356e78ccf5c
new version contains Annotator JS files to be used with FilesystemSite.
casties
parents:
diff
changeset
|
100 return $('<div />').append(element.clone()).html(); |
6356e78ccf5c
new version contains Annotator JS files to be used with FilesystemSite.
casties
parents:
diff
changeset
|
101 }; |
6356e78ccf5c
new version contains Annotator JS files to be used with FilesystemSite.
casties
parents:
diff
changeset
|
102 |
6356e78ccf5c
new version contains Annotator JS files to be used with FilesystemSite.
casties
parents:
diff
changeset
|
103 jasmine.JQuery.matchersClass = {}; |
6356e78ccf5c
new version contains Annotator JS files to be used with FilesystemSite.
casties
parents:
diff
changeset
|
104 |
6356e78ccf5c
new version contains Annotator JS files to be used with FilesystemSite.
casties
parents:
diff
changeset
|
105 |
6356e78ccf5c
new version contains Annotator JS files to be used with FilesystemSite.
casties
parents:
diff
changeset
|
106 (function(){ |
6356e78ccf5c
new version contains Annotator JS files to be used with FilesystemSite.
casties
parents:
diff
changeset
|
107 var jQueryMatchers = { |
6356e78ccf5c
new version contains Annotator JS files to be used with FilesystemSite.
casties
parents:
diff
changeset
|
108 toHaveClass: function(className) { |
6356e78ccf5c
new version contains Annotator JS files to be used with FilesystemSite.
casties
parents:
diff
changeset
|
109 return this.actual.hasClass(className); |
6356e78ccf5c
new version contains Annotator JS files to be used with FilesystemSite.
casties
parents:
diff
changeset
|
110 }, |
6356e78ccf5c
new version contains Annotator JS files to be used with FilesystemSite.
casties
parents:
diff
changeset
|
111 |
6356e78ccf5c
new version contains Annotator JS files to be used with FilesystemSite.
casties
parents:
diff
changeset
|
112 toBeVisible: function() { |
6356e78ccf5c
new version contains Annotator JS files to be used with FilesystemSite.
casties
parents:
diff
changeset
|
113 return this.actual.is(':visible'); |
6356e78ccf5c
new version contains Annotator JS files to be used with FilesystemSite.
casties
parents:
diff
changeset
|
114 }, |
6356e78ccf5c
new version contains Annotator JS files to be used with FilesystemSite.
casties
parents:
diff
changeset
|
115 |
6356e78ccf5c
new version contains Annotator JS files to be used with FilesystemSite.
casties
parents:
diff
changeset
|
116 toBeHidden: function() { |
6356e78ccf5c
new version contains Annotator JS files to be used with FilesystemSite.
casties
parents:
diff
changeset
|
117 return this.actual.is(':hidden'); |
6356e78ccf5c
new version contains Annotator JS files to be used with FilesystemSite.
casties
parents:
diff
changeset
|
118 }, |
6356e78ccf5c
new version contains Annotator JS files to be used with FilesystemSite.
casties
parents:
diff
changeset
|
119 |
6356e78ccf5c
new version contains Annotator JS files to be used with FilesystemSite.
casties
parents:
diff
changeset
|
120 toBeSelected: function() { |
6356e78ccf5c
new version contains Annotator JS files to be used with FilesystemSite.
casties
parents:
diff
changeset
|
121 return this.actual.is(':selected'); |
6356e78ccf5c
new version contains Annotator JS files to be used with FilesystemSite.
casties
parents:
diff
changeset
|
122 }, |
6356e78ccf5c
new version contains Annotator JS files to be used with FilesystemSite.
casties
parents:
diff
changeset
|
123 |
6356e78ccf5c
new version contains Annotator JS files to be used with FilesystemSite.
casties
parents:
diff
changeset
|
124 toBeChecked: function() { |
6356e78ccf5c
new version contains Annotator JS files to be used with FilesystemSite.
casties
parents:
diff
changeset
|
125 return this.actual.is(':checked'); |
6356e78ccf5c
new version contains Annotator JS files to be used with FilesystemSite.
casties
parents:
diff
changeset
|
126 }, |
6356e78ccf5c
new version contains Annotator JS files to be used with FilesystemSite.
casties
parents:
diff
changeset
|
127 |
6356e78ccf5c
new version contains Annotator JS files to be used with FilesystemSite.
casties
parents:
diff
changeset
|
128 toBeEmpty: function() { |
6356e78ccf5c
new version contains Annotator JS files to be used with FilesystemSite.
casties
parents:
diff
changeset
|
129 return this.actual.is(':empty'); |
6356e78ccf5c
new version contains Annotator JS files to be used with FilesystemSite.
casties
parents:
diff
changeset
|
130 }, |
6356e78ccf5c
new version contains Annotator JS files to be used with FilesystemSite.
casties
parents:
diff
changeset
|
131 |
6356e78ccf5c
new version contains Annotator JS files to be used with FilesystemSite.
casties
parents:
diff
changeset
|
132 toExist: function() { |
6356e78ccf5c
new version contains Annotator JS files to be used with FilesystemSite.
casties
parents:
diff
changeset
|
133 return this.actual.size() > 0; |
6356e78ccf5c
new version contains Annotator JS files to be used with FilesystemSite.
casties
parents:
diff
changeset
|
134 }, |
6356e78ccf5c
new version contains Annotator JS files to be used with FilesystemSite.
casties
parents:
diff
changeset
|
135 |
6356e78ccf5c
new version contains Annotator JS files to be used with FilesystemSite.
casties
parents:
diff
changeset
|
136 toHaveAttr: function(attributeName, expectedAttributeValue) { |
6356e78ccf5c
new version contains Annotator JS files to be used with FilesystemSite.
casties
parents:
diff
changeset
|
137 return hasProperty(this.actual.attr(attributeName), expectedAttributeValue); |
6356e78ccf5c
new version contains Annotator JS files to be used with FilesystemSite.
casties
parents:
diff
changeset
|
138 }, |
6356e78ccf5c
new version contains Annotator JS files to be used with FilesystemSite.
casties
parents:
diff
changeset
|
139 |
6356e78ccf5c
new version contains Annotator JS files to be used with FilesystemSite.
casties
parents:
diff
changeset
|
140 toHaveId: function(id) { |
6356e78ccf5c
new version contains Annotator JS files to be used with FilesystemSite.
casties
parents:
diff
changeset
|
141 return this.actual.attr('id') == id; |
6356e78ccf5c
new version contains Annotator JS files to be used with FilesystemSite.
casties
parents:
diff
changeset
|
142 }, |
6356e78ccf5c
new version contains Annotator JS files to be used with FilesystemSite.
casties
parents:
diff
changeset
|
143 |
6356e78ccf5c
new version contains Annotator JS files to be used with FilesystemSite.
casties
parents:
diff
changeset
|
144 toHaveHtml: function(html) { |
6356e78ccf5c
new version contains Annotator JS files to be used with FilesystemSite.
casties
parents:
diff
changeset
|
145 return this.actual.html() == jasmine.JQuery.browserTagCaseIndependentHtml(html); |
6356e78ccf5c
new version contains Annotator JS files to be used with FilesystemSite.
casties
parents:
diff
changeset
|
146 }, |
6356e78ccf5c
new version contains Annotator JS files to be used with FilesystemSite.
casties
parents:
diff
changeset
|
147 |
6356e78ccf5c
new version contains Annotator JS files to be used with FilesystemSite.
casties
parents:
diff
changeset
|
148 toHaveText: function(text) { |
6356e78ccf5c
new version contains Annotator JS files to be used with FilesystemSite.
casties
parents:
diff
changeset
|
149 return this.actual.text() == text; |
6356e78ccf5c
new version contains Annotator JS files to be used with FilesystemSite.
casties
parents:
diff
changeset
|
150 }, |
6356e78ccf5c
new version contains Annotator JS files to be used with FilesystemSite.
casties
parents:
diff
changeset
|
151 |
6356e78ccf5c
new version contains Annotator JS files to be used with FilesystemSite.
casties
parents:
diff
changeset
|
152 toHaveValue: function(value) { |
6356e78ccf5c
new version contains Annotator JS files to be used with FilesystemSite.
casties
parents:
diff
changeset
|
153 return this.actual.val() == value; |
6356e78ccf5c
new version contains Annotator JS files to be used with FilesystemSite.
casties
parents:
diff
changeset
|
154 }, |
6356e78ccf5c
new version contains Annotator JS files to be used with FilesystemSite.
casties
parents:
diff
changeset
|
155 |
6356e78ccf5c
new version contains Annotator JS files to be used with FilesystemSite.
casties
parents:
diff
changeset
|
156 toHaveData: function(key, expectedValue) { |
6356e78ccf5c
new version contains Annotator JS files to be used with FilesystemSite.
casties
parents:
diff
changeset
|
157 return hasProperty(this.actual.data(key), expectedValue); |
6356e78ccf5c
new version contains Annotator JS files to be used with FilesystemSite.
casties
parents:
diff
changeset
|
158 }, |
6356e78ccf5c
new version contains Annotator JS files to be used with FilesystemSite.
casties
parents:
diff
changeset
|
159 |
6356e78ccf5c
new version contains Annotator JS files to be used with FilesystemSite.
casties
parents:
diff
changeset
|
160 toBe: function(selector) { |
6356e78ccf5c
new version contains Annotator JS files to be used with FilesystemSite.
casties
parents:
diff
changeset
|
161 return this.actual.is(selector); |
6356e78ccf5c
new version contains Annotator JS files to be used with FilesystemSite.
casties
parents:
diff
changeset
|
162 }, |
6356e78ccf5c
new version contains Annotator JS files to be used with FilesystemSite.
casties
parents:
diff
changeset
|
163 |
6356e78ccf5c
new version contains Annotator JS files to be used with FilesystemSite.
casties
parents:
diff
changeset
|
164 toContain: function(selector) { |
6356e78ccf5c
new version contains Annotator JS files to be used with FilesystemSite.
casties
parents:
diff
changeset
|
165 return this.actual.find(selector).size() > 0; |
6356e78ccf5c
new version contains Annotator JS files to be used with FilesystemSite.
casties
parents:
diff
changeset
|
166 } |
6356e78ccf5c
new version contains Annotator JS files to be used with FilesystemSite.
casties
parents:
diff
changeset
|
167 }; |
6356e78ccf5c
new version contains Annotator JS files to be used with FilesystemSite.
casties
parents:
diff
changeset
|
168 |
6356e78ccf5c
new version contains Annotator JS files to be used with FilesystemSite.
casties
parents:
diff
changeset
|
169 var hasProperty = function(actualValue, expectedValue) { |
6356e78ccf5c
new version contains Annotator JS files to be used with FilesystemSite.
casties
parents:
diff
changeset
|
170 if (expectedValue === undefined) { |
6356e78ccf5c
new version contains Annotator JS files to be used with FilesystemSite.
casties
parents:
diff
changeset
|
171 return actualValue !== undefined; |
6356e78ccf5c
new version contains Annotator JS files to be used with FilesystemSite.
casties
parents:
diff
changeset
|
172 } |
6356e78ccf5c
new version contains Annotator JS files to be used with FilesystemSite.
casties
parents:
diff
changeset
|
173 return actualValue == expectedValue; |
6356e78ccf5c
new version contains Annotator JS files to be used with FilesystemSite.
casties
parents:
diff
changeset
|
174 }; |
6356e78ccf5c
new version contains Annotator JS files to be used with FilesystemSite.
casties
parents:
diff
changeset
|
175 |
6356e78ccf5c
new version contains Annotator JS files to be used with FilesystemSite.
casties
parents:
diff
changeset
|
176 var bindMatcher = function(methodName) { |
6356e78ccf5c
new version contains Annotator JS files to be used with FilesystemSite.
casties
parents:
diff
changeset
|
177 var builtInMatcher = jasmine.Matchers.prototype[methodName]; |
6356e78ccf5c
new version contains Annotator JS files to be used with FilesystemSite.
casties
parents:
diff
changeset
|
178 |
6356e78ccf5c
new version contains Annotator JS files to be used with FilesystemSite.
casties
parents:
diff
changeset
|
179 jasmine.JQuery.matchersClass[methodName] = function() { |
6356e78ccf5c
new version contains Annotator JS files to be used with FilesystemSite.
casties
parents:
diff
changeset
|
180 if (this.actual instanceof jQuery) { |
6356e78ccf5c
new version contains Annotator JS files to be used with FilesystemSite.
casties
parents:
diff
changeset
|
181 var result = jQueryMatchers[methodName].apply(this, arguments); |
6356e78ccf5c
new version contains Annotator JS files to be used with FilesystemSite.
casties
parents:
diff
changeset
|
182 this.actual = jasmine.JQuery.elementToString(this.actual); |
6356e78ccf5c
new version contains Annotator JS files to be used with FilesystemSite.
casties
parents:
diff
changeset
|
183 return result; |
6356e78ccf5c
new version contains Annotator JS files to be used with FilesystemSite.
casties
parents:
diff
changeset
|
184 } |
6356e78ccf5c
new version contains Annotator JS files to be used with FilesystemSite.
casties
parents:
diff
changeset
|
185 |
6356e78ccf5c
new version contains Annotator JS files to be used with FilesystemSite.
casties
parents:
diff
changeset
|
186 if (builtInMatcher) { |
6356e78ccf5c
new version contains Annotator JS files to be used with FilesystemSite.
casties
parents:
diff
changeset
|
187 return builtInMatcher.apply(this, arguments); |
6356e78ccf5c
new version contains Annotator JS files to be used with FilesystemSite.
casties
parents:
diff
changeset
|
188 } |
6356e78ccf5c
new version contains Annotator JS files to be used with FilesystemSite.
casties
parents:
diff
changeset
|
189 |
6356e78ccf5c
new version contains Annotator JS files to be used with FilesystemSite.
casties
parents:
diff
changeset
|
190 return false; |
6356e78ccf5c
new version contains Annotator JS files to be used with FilesystemSite.
casties
parents:
diff
changeset
|
191 }; |
6356e78ccf5c
new version contains Annotator JS files to be used with FilesystemSite.
casties
parents:
diff
changeset
|
192 }; |
6356e78ccf5c
new version contains Annotator JS files to be used with FilesystemSite.
casties
parents:
diff
changeset
|
193 |
6356e78ccf5c
new version contains Annotator JS files to be used with FilesystemSite.
casties
parents:
diff
changeset
|
194 for(var methodName in jQueryMatchers) { |
6356e78ccf5c
new version contains Annotator JS files to be used with FilesystemSite.
casties
parents:
diff
changeset
|
195 bindMatcher(methodName); |
6356e78ccf5c
new version contains Annotator JS files to be used with FilesystemSite.
casties
parents:
diff
changeset
|
196 } |
6356e78ccf5c
new version contains Annotator JS files to be used with FilesystemSite.
casties
parents:
diff
changeset
|
197 })(); |
6356e78ccf5c
new version contains Annotator JS files to be used with FilesystemSite.
casties
parents:
diff
changeset
|
198 |
6356e78ccf5c
new version contains Annotator JS files to be used with FilesystemSite.
casties
parents:
diff
changeset
|
199 beforeEach(function() { |
6356e78ccf5c
new version contains Annotator JS files to be used with FilesystemSite.
casties
parents:
diff
changeset
|
200 this.addMatchers(jasmine.JQuery.matchersClass); |
6356e78ccf5c
new version contains Annotator JS files to be used with FilesystemSite.
casties
parents:
diff
changeset
|
201 }); |
6356e78ccf5c
new version contains Annotator JS files to be used with FilesystemSite.
casties
parents:
diff
changeset
|
202 |