├── .gitignore ├── CODEOWNERS ├── 04.DOM_manipulation ├── src │ └── domManipulation.js ├── runner.html └── spec │ └── domManipulation.js ├── 07.learnQuery ├── src │ └── learnQuery.js ├── runner.html └── spec │ └── learnQuery.js ├── 02.CSS_manipulation ├── src │ └── cssProp.js ├── runner.html └── spec │ └── cssProp.js ├── 05.AJAX_Request ├── src │ └── ajaxRequest.js ├── runner.html └── spec │ └── ajaxRequest.js ├── 01.dom_selector ├── src │ └── selector.js ├── runner.html └── spec │ └── selector.js ├── 06.event_listeners ├── src │ └── eventListeners.js ├── runner.html └── spec │ └── eventListeners.js ├── lib ├── jasmine-2.1.3 │ ├── jasmine_favicon.png │ ├── boot.js │ ├── console.js │ ├── jasmine-html.js │ ├── jasmine.css │ └── jasmine.js ├── mock-ajax.js └── jasmine-fixture.js ├── 03.CSS_class_manipulation ├── src │ └── cssClassManipulation.js ├── runner.html └── spec │ └── cssClassManipulation.js ├── 00.example ├── spec │ └── example.js ├── runner.html └── src │ └── example.js ├── LICENSE └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | .DS_Store -------------------------------------------------------------------------------- /CODEOWNERS: -------------------------------------------------------------------------------- 1 | * @darrac @nives113 @thabalija @fvoska @safo6m @DarkoKukovec -------------------------------------------------------------------------------- /04.DOM_manipulation/src/domManipulation.js: -------------------------------------------------------------------------------- 1 | var dom = function(){ 2 | // code goes here 3 | }; -------------------------------------------------------------------------------- /07.learnQuery/src/learnQuery.js: -------------------------------------------------------------------------------- 1 | function learnQuery(elementsSelector) { 2 | //code goes here 3 | } -------------------------------------------------------------------------------- /02.CSS_manipulation/src/cssProp.js: -------------------------------------------------------------------------------- 1 | function cssProp() { 2 | 'use strict'; 3 | 4 | //code goes here 5 | } -------------------------------------------------------------------------------- /05.AJAX_Request/src/ajaxRequest.js: -------------------------------------------------------------------------------- 1 | function ajaxReq() { 2 | 'use strict'; 3 | // code goes here 4 | } -------------------------------------------------------------------------------- /01.dom_selector/src/selector.js: -------------------------------------------------------------------------------- 1 | var domSelector = function(selectors) { 2 | 'use strict'; 3 | 4 | //code goes here 5 | }; -------------------------------------------------------------------------------- /06.event_listeners/src/eventListeners.js: -------------------------------------------------------------------------------- 1 | var eventListener = (function() { 2 | 'use strict'; 3 | //code goes here 4 | })(); -------------------------------------------------------------------------------- /lib/jasmine-2.1.3/jasmine_favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/infinum/learnQuery/HEAD/lib/jasmine-2.1.3/jasmine_favicon.png -------------------------------------------------------------------------------- /03.CSS_class_manipulation/src/cssClassManipulation.js: -------------------------------------------------------------------------------- 1 | var cssClass = (function() { 2 | 'use strict'; 3 | 4 | // code goes here 5 | })(); -------------------------------------------------------------------------------- /00.example/spec/example.js: -------------------------------------------------------------------------------- 1 | describe('Fibonacci calculator', function() { 2 | 'use strict'; 3 | 4 | var fibonacciCalculator; 5 | var song; 6 | 7 | beforeEach(function() { 8 | fibonacciCalculator = new Fibonacci(); 9 | }); 10 | 11 | it('should cover small numbers', function() { 12 | expect(fibonacciCalculator.compute(0)).toBe(1); 13 | expect(fibonacciCalculator.compute(1)).toBe(1); 14 | }); 15 | 16 | it('should cover bigger numbers', function() { 17 | expect(fibonacciCalculator.compute(27)).toBe(317811); 18 | }); 19 | 20 | it('should cover negative numbers', function() { 21 | expect(function() { 22 | fibonacciCalculator.compute(-1); 23 | }).toThrowError('Number must be positive'); 24 | }); 25 | 26 | it('should cover invalid values', function() { 27 | expect(function() { 28 | fibonacciCalculator.compute('the answer to life the universe and everything'); 29 | }).toThrowError('Parameter must be a number'); 30 | }); 31 | }); -------------------------------------------------------------------------------- /00.example/runner.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 |
270 |
--------------------------------------------------------------------------------
/06.event_listeners/spec/eventListeners.js:
--------------------------------------------------------------------------------
1 | /*global affix*/
2 | /*global eventListener*/
3 |
4 | describe('EventListeners', function() {
5 | 'use strict';
6 |
7 | var $selectedElement, selectedElement, methods;
8 |
9 | beforeEach(function() {
10 | affix('.learn-query-testing #toddler .hidden.toy+h1[class="title"]+span[class="subtitle"]+span[class="subtitle"]+input[name="toyName"][value="cuddle bunny"]+input[class="creature"][value="unicorn"]+.hidden+.infinum[value="awesome cool"]');
11 |
12 | methods = {
13 | showLove: function() {
14 | console.log('<3 JavaScript <3');
15 | },
16 |
17 | giveLove: function() {
18 | console.log('==> JavaScript ==>');
19 | return '==> JavaScript ==>';
20 | }
21 | };
22 |
23 | spyOn(methods, 'showLove');
24 | spyOn(methods, 'giveLove');
25 |
26 | $selectedElement = $('#toddler');
27 | selectedElement = $selectedElement[0];
28 | });
29 |
30 | it('should be able to add a click event to an HTML element', function() {
31 | eventListener.on(selectedElement, 'click', methods.showLove);
32 |
33 | var eClick = createNewClickEvent();
34 | selectedElement.dispatchEvent(eClick);
35 |
36 | expect(methods.showLove).toHaveBeenCalled();
37 | });
38 |
39 | it('should be able to add the same event+callback two times to an HTML element', function() {
40 | eventListener.on(selectedElement, 'click', methods.showLove);
41 | eventListener.on(selectedElement, 'click', methods.showLove);
42 |
43 | var eClick = createNewClickEvent();
44 | selectedElement.dispatchEvent(eClick);
45 |
46 | expect(methods.showLove.calls.count()).toEqual(2);
47 | });
48 |
49 |
50 | it('should be able to add the same callback for two different events to an HTML element', function() {
51 | eventListener.on(selectedElement, 'click', methods.showLove);
52 | eventListener.on(selectedElement, 'hover', methods.showLove);
53 |
54 | var eClick = createNewClickEvent();
55 | selectedElement.dispatchEvent(eClick);
56 |
57 | var eHover = new Event('hover');
58 | selectedElement.dispatchEvent(eHover);
59 |
60 | expect(methods.showLove.calls.count()).toEqual(2);
61 | });
62 |
63 | it('should be able to add two different callbacks for same event to an HTML element', function() {
64 | eventListener.on(selectedElement, 'click', methods.showLove);
65 | eventListener.on(selectedElement, 'click', methods.giveLove);
66 |
67 | var eClick = createNewClickEvent();
68 | selectedElement.dispatchEvent(eClick);
69 |
70 | expect(methods.showLove.calls.count()).toEqual(1);
71 | expect(methods.giveLove.calls.count()).toEqual(1);
72 | });
73 |
74 | it('should be able to remove one event handler of an HTML element', function() {
75 | $selectedElement.off();
76 |
77 | eventListener.on(selectedElement, 'click', methods.showLove);
78 | eventListener.on(selectedElement, 'click', methods.giveLove);
79 | eventListener.off(selectedElement, 'click', methods.showLove);
80 |
81 | var eClick = createNewClickEvent();
82 | selectedElement.dispatchEvent(eClick);
83 |
84 | expect(methods.showLove.calls.count()).toEqual(0);
85 | expect(methods.giveLove.calls.count()).toEqual(1);
86 | });
87 |
88 | it('should be able to remove all click events of a HTML element', function() {
89 | $selectedElement.off();
90 |
91 | eventListener.on(selectedElement, 'click', methods.showLove);
92 | eventListener.on(selectedElement, 'click', methods.giveLove);
93 | eventListener.on(selectedElement, 'hover', methods.showLove);
94 |
95 | eventListener.off(selectedElement, 'click');
96 |
97 | var eClick = createNewClickEvent();
98 | selectedElement.dispatchEvent(eClick);
99 |
100 | var eHover = new Event('hover');
101 | selectedElement.dispatchEvent(eHover);
102 |
103 | expect(methods.showLove.calls.count()).toEqual(1);
104 | expect(methods.giveLove).not.toHaveBeenCalled();
105 | });
106 |
107 | it('should be able to remove all events of a HTML element', function() {
108 | $selectedElement.off();
109 |
110 | eventListener.on(selectedElement, 'click', methods.showLove);
111 | eventListener.on(selectedElement, 'click', methods.giveLove);
112 | eventListener.on(selectedElement, 'hover', methods.showLove);
113 |
114 | eventListener.off(selectedElement);
115 |
116 | var eClick = createNewClickEvent();
117 | selectedElement.dispatchEvent(eClick);
118 |
119 | var eHover = new Event('hover');
120 | selectedElement.dispatchEvent(eHover);
121 |
122 | expect(methods.showLove).not.toHaveBeenCalled();
123 | expect(methods.giveLove).not.toHaveBeenCalled();
124 | });
125 |
126 | it('should trigger a click event on a HTML element', function() {
127 | $selectedElement.off();
128 | $selectedElement.on('click', methods.showLove);
129 |
130 | eventListener.trigger(selectedElement, 'click');
131 |
132 | expect(methods.showLove.calls.count()).toBe(1);
133 | });
134 |
135 | it('should delegate an event to elements with a given css class name', function() {
136 | eventListener.delegate(selectedElement, 'title', 'click', methods.showLove);
137 | var titleEl = document.querySelector('h1.title');
138 |
139 | var eClick = createNewClickEvent();
140 | titleEl.dispatchEvent(eClick);
141 |
142 | expect(methods.showLove.calls.count()).toEqual(1);
143 | });
144 |
145 | it('should not delegate an event to elements without a given css class name', function() {
146 | eventListener.delegate(selectedElement, 'title', 'click', methods.showLove);
147 | var titleEl = document.querySelector('h1.title');
148 | var subtitleEl = document.querySelector('.subtitle');
149 |
150 | var eClickTitle = createNewClickEvent();
151 | var eClickSubtitle = createNewClickEvent();
152 | titleEl.dispatchEvent(eClickTitle);
153 | subtitleEl.dispatchEvent(eClickSubtitle);
154 |
155 | expect(methods.showLove.calls.count()).toEqual(1);
156 | });
157 |
158 | it('should delegate an event to elements that are added to the DOM to after delegate call', function() {
159 | eventListener.delegate(selectedElement, 'new-element-class', 'click', methods.showLove);
160 |
161 | var newElement = document.createElement('div');
162 | newElement.className = 'new-element-class';
163 | $selectedElement.append(newElement);
164 |
165 | var eClick = createNewClickEvent();
166 | newElement.dispatchEvent(eClick);
167 |
168 | expect(methods.showLove.calls.count()).toEqual(1);
169 | });
170 |
171 | it('should trigger delegated event handler when clicked on an element inside a targeted element', function() {
172 | eventListener.delegate(selectedElement, 'title', 'click', methods.showLove);
173 |
174 | var newElement = document.createElement('div');
175 | newElement.className = 'new-element-class';
176 | $selectedElement.append(newElement);
177 |
178 | $('h1.title').append(newElement);
179 |
180 | var eClick = createNewClickEvent();
181 | newElement.dispatchEvent(eClick);
182 |
183 | expect(methods.showLove.calls.count()).toEqual(1);
184 | });
185 |
186 | it('should not trigger delegated event handler if clicked on container of delegator', function() {
187 | var $targetElement = $('');
188 | $selectedElement.append($targetElement);
189 |
190 | eventListener.delegate(selectedElement, 'target', 'click', methods.showLove);
191 |
192 | var eClick = createNewClickEvent();
193 | selectedElement.dispatchEvent(eClick);
194 |
195 | expect(methods.showLove.calls.count()).toEqual(0);
196 | });
197 |
198 | it('should trigger delegated event handler multiple times if event happens on multiple elements', function() {
199 | eventListener.delegate(selectedElement, 'subtitle', 'click', methods.showLove);
200 | var subtitleEls = document.querySelectorAll('.subtitle');
201 | subtitleEls.forEach(e => e.dispatchEvent(createNewClickEvent()));
202 |
203 | expect(methods.showLove.calls.count()).toEqual(2);
204 | });
205 |
206 | it('should not trigger method registered on element A when event id triggered on element B', function() {
207 | var elementA = document.createElement('div');
208 | var elementB = document.createElement('div');
209 | $selectedElement.append(elementA);
210 | $selectedElement.append(elementB);
211 |
212 | eventListener.on(elementA, 'click', methods.showLove);
213 | eventListener.on(elementB, 'click', methods.giveLove);
214 |
215 | var eClick = createNewClickEvent();
216 | elementA.dispatchEvent(eClick);
217 |
218 | expect(methods.showLove).toHaveBeenCalled();
219 | expect(methods.giveLove).not.toHaveBeenCalled();
220 | });
221 | });
222 |
223 | function createNewClickEvent(){
224 | return new MouseEvent('click', {
225 | 'bubbles': true,
226 | 'cancelable': true
227 | });
228 | }
229 |
--------------------------------------------------------------------------------
/lib/mock-ajax.js:
--------------------------------------------------------------------------------
1 | /*
2 |
3 | Jasmine-Ajax : a set of helpers for testing AJAX requests under the Jasmine
4 | BDD framework for JavaScript.
5 |
6 | http://github.com/pivotal/jasmine-ajax
7 |
8 | Jasmine Home page: http://pivotal.github.com/jasmine
9 |
10 | Copyright (c) 2008-2013 Pivotal Labs
11 |
12 | Permission is hereby granted, free of charge, to any person obtaining
13 | a copy of this software and associated documentation files (the
14 | "Software"), to deal in the Software without restriction, including
15 | without limitation the rights to use, copy, modify, merge, publish,
16 | distribute, sublicense, and/or sell copies of the Software, and to
17 | permit persons to whom the Software is furnished to do so, subject to
18 | the following conditions:
19 |
20 | The above copyright notice and this permission notice shall be
21 | included in all copies or substantial portions of the Software.
22 |
23 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
24 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
25 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
26 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
27 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
28 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
29 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
30 |
31 | */
32 |
33 | (function() {
34 | function extend(destination, source, propertiesToSkip) {
35 | propertiesToSkip = propertiesToSkip || [];
36 | for (var property in source) {
37 | if (!arrayContains(propertiesToSkip, property)) {
38 | destination[property] = source[property];
39 | }
40 | }
41 | return destination;
42 | }
43 |
44 | function arrayContains(arr, item) {
45 | for (var i = 0; i < arr.length; i++) {
46 | if (arr[i] === item) {
47 | return true;
48 | }
49 | }
50 | return false;
51 | }
52 |
53 | function MockAjax(global) {
54 | var requestTracker = new RequestTracker(),
55 | stubTracker = new StubTracker(),
56 | paramParser = new ParamParser(),
57 | realAjaxFunction = global.XMLHttpRequest,
58 | mockAjaxFunction = fakeRequest(requestTracker, stubTracker, paramParser);
59 |
60 | this.install = function() {
61 | global.XMLHttpRequest = mockAjaxFunction;
62 | };
63 |
64 | this.uninstall = function() {
65 | global.XMLHttpRequest = realAjaxFunction;
66 |
67 | this.stubs.reset();
68 | this.requests.reset();
69 | paramParser.reset();
70 | };
71 |
72 | this.stubRequest = function(url, data, method) {
73 | var stub = new RequestStub(url, data, method);
74 | stubTracker.addStub(stub);
75 | return stub;
76 | };
77 |
78 | this.withMock = function(closure) {
79 | this.install();
80 | try {
81 | closure();
82 | } finally {
83 | this.uninstall();
84 | }
85 | };
86 |
87 | this.addCustomParamParser = function(parser) {
88 | paramParser.add(parser);
89 | };
90 |
91 | this.requests = requestTracker;
92 | this.stubs = stubTracker;
93 | }
94 |
95 | function StubTracker() {
96 | var stubs = [];
97 |
98 | this.addStub = function(stub) {
99 | stubs.push(stub);
100 | };
101 |
102 | this.reset = function() {
103 | stubs = [];
104 | };
105 |
106 | this.findStub = function(url, data, method) {
107 | for (var i = stubs.length - 1; i >= 0; i--) {
108 | var stub = stubs[i];
109 | if (stub.matches(url, data, method)) {
110 | return stub;
111 | }
112 | }
113 | };
114 | }
115 |
116 | function ParamParser() {
117 | var defaults = [
118 | {
119 | test: function(xhr) {
120 | return /^application\/json/.test(xhr.contentType());
121 | },
122 | parse: function jsonParser(paramString) {
123 | return JSON.parse(paramString);
124 | }
125 | },
126 | {
127 | test: function(xhr) {
128 | return true;
129 | },
130 | parse: function naiveParser(paramString) {
131 | var data = {};
132 | var params = paramString.split('&');
133 |
134 | for (var i = 0; i < params.length; ++i) {
135 | var kv = params[i].replace(/\+/g, ' ').split('=');
136 | var key = decodeURIComponent(kv[0]);
137 | data[key] = data[key] || [];
138 | data[key].push(decodeURIComponent(kv[1]));
139 | }
140 | return data;
141 | }
142 | }
143 | ];
144 | var paramParsers = [];
145 |
146 | this.add = function(parser) {
147 | paramParsers.unshift(parser);
148 | };
149 |
150 | this.findParser = function(xhr) {
151 | for(var i in paramParsers) {
152 | var parser = paramParsers[i];
153 | if (parser.test(xhr)) {
154 | return parser;
155 | }
156 | }
157 | };
158 |
159 | this.reset = function() {
160 | paramParsers = [];
161 | for(var i in defaults) {
162 | paramParsers.push(defaults[i]);
163 | }
164 | };
165 |
166 | this.reset();
167 | }
168 |
169 | function fakeRequest(requestTracker, stubTracker, paramParser) {
170 | function FakeXMLHttpRequest() {
171 | requestTracker.track(this);
172 | this.requestHeaders = {};
173 | }
174 |
175 | var iePropertiesThatCannotBeCopied = ['responseBody', 'responseText', 'responseXML', 'status', 'statusText', 'responseTimeout'];
176 | extend(FakeXMLHttpRequest.prototype, new window.XMLHttpRequest(), iePropertiesThatCannotBeCopied);
177 | extend(FakeXMLHttpRequest.prototype, {
178 | open: function() {
179 | this.method = arguments[0];
180 | this.url = arguments[1];
181 | this.username = arguments[3];
182 | this.password = arguments[4];
183 | this.readyState = 1;
184 | this.onreadystatechange();
185 | },
186 |
187 | setRequestHeader: function(header, value) {
188 | this.requestHeaders[header] = value;
189 | },
190 |
191 | abort: function() {
192 | this.readyState = 0;
193 | this.status = 0;
194 | this.statusText = "abort";
195 | this.onreadystatechange();
196 | },
197 |
198 | readyState: 0,
199 |
200 | onload: function() {
201 | },
202 |
203 | onreadystatechange: function(isTimeout) {
204 | },
205 |
206 | status: null,
207 |
208 | send: function(data) {
209 | this.params = data;
210 | this.readyState = 2;
211 | this.onreadystatechange();
212 |
213 | var stub = stubTracker.findStub(this.url, data, this.method);
214 | if (stub) {
215 | this.response(stub);
216 | }
217 | },
218 |
219 | contentType: function() {
220 | for (var header in this.requestHeaders) {
221 | if (header.toLowerCase() === 'content-type') {
222 | return this.requestHeaders[header];
223 | }
224 | }
225 | },
226 |
227 | data: function() {
228 | if (!this.params) {
229 | return {};
230 | }
231 |
232 | return paramParser.findParser(this).parse(this.params);
233 | },
234 |
235 | getResponseHeader: function(name) {
236 | return this.responseHeaders[name];
237 | },
238 |
239 | getAllResponseHeaders: function() {
240 | var responseHeaders = [];
241 | for (var i in this.responseHeaders) {
242 | if (this.responseHeaders.hasOwnProperty(i)) {
243 | responseHeaders.push(i + ': ' + this.responseHeaders[i]);
244 | }
245 | }
246 | return responseHeaders.join('\r\n');
247 | },
248 |
249 | responseText: null,
250 |
251 | response: function(response) {
252 | if (this.readyState === 4) {
253 | throw new Error("FakeXMLHttpRequest already completed");
254 | }
255 | this.status = response.status;
256 | this.statusText = response.statusText || "";
257 | this.responseText = response.responseText || "";
258 | this.readyState = 4;
259 | this.responseHeaders = response.responseHeaders ||
260 | {"Content-Type": response.contentType || "application/json" };
261 |
262 | this.onload();
263 | this.onreadystatechange();
264 | },
265 |
266 | responseTimeout: function() {
267 | if (this.readyState === 4) {
268 | throw new Error("FakeXMLHttpRequest already completed");
269 | }
270 | this.readyState = 4;
271 | jasmine.clock().tick(30000);
272 | this.onreadystatechange('timeout');
273 | }
274 | });
275 |
276 | return FakeXMLHttpRequest;
277 | }
278 |
279 | function RequestTracker() {
280 | var requests = [];
281 |
282 | this.track = function(request) {
283 | requests.push(request);
284 | };
285 |
286 | this.first = function() {
287 | return requests[0];
288 | };
289 |
290 | this.count = function() {
291 | return requests.length;
292 | };
293 |
294 | this.reset = function() {
295 | requests = [];
296 | };
297 |
298 | this.mostRecent = function() {
299 | return requests[requests.length - 1];
300 | };
301 |
302 | this.at = function(index) {
303 | return requests[index];
304 | };
305 |
306 | this.filter = function(url_to_match) {
307 | if (requests.length == 0) return [];
308 | var matching_requests = [];
309 |
310 | for (var i = 0; i < requests.length; i++) {
311 | if (url_to_match instanceof RegExp &&
312 | url_to_match.test(requests[i].url)) {
313 | matching_requests.push(requests[i]);
314 | } else if (url_to_match instanceof Function &&
315 | url_to_match(requests[i])) {
316 | matching_requests.push(requests[i]);
317 | } else {
318 | if (requests[i].url == url_to_match) {
319 | matching_requests.push(requests[i]);
320 | }
321 | }
322 | }
323 |
324 | return matching_requests;
325 | };
326 | }
327 |
328 | function RequestStub(url, stubData, method) {
329 | var normalizeQuery = function(query) {
330 | return query ? query.split('&').sort().join('&') : undefined;
331 | };
332 |
333 | if (url instanceof RegExp) {
334 | this.url = url;
335 | this.query = undefined;
336 | } else {
337 | var split = url.split('?');
338 | this.url = split[0];
339 | this.query = split.length > 1 ? normalizeQuery(split[1]) : undefined;
340 | }
341 |
342 | this.data = normalizeQuery(stubData);
343 | this.method = method;
344 |
345 | this.andReturn = function(options) {
346 | this.status = options.status || 200;
347 |
348 | this.contentType = options.contentType;
349 | this.responseText = options.responseText;
350 | };
351 |
352 | this.matches = function(fullUrl, data, method) {
353 | var matches = false;
354 | fullUrl = fullUrl.toString();
355 | if (this.url instanceof RegExp) {
356 | matches = this.url.test(fullUrl);
357 | } else {
358 | var urlSplit = fullUrl.split('?'),
359 | url = urlSplit[0],
360 | query = urlSplit[1];
361 | matches = this.url === url && this.query === normalizeQuery(query);
362 | }
363 | return matches && (!this.data || this.data === normalizeQuery(data)) && (!this.method || this.method === method);
364 | };
365 | }
366 |
367 | if (typeof window === "undefined" && typeof exports === "object") {
368 | exports.MockAjax = MockAjax;
369 | jasmine.Ajax = new MockAjax(exports);
370 | } else {
371 | window.MockAjax = MockAjax;
372 | jasmine.Ajax = new MockAjax(window);
373 | }
374 | }());
--------------------------------------------------------------------------------
/lib/jasmine-2.1.3/jasmine-html.js:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2008-2014 Pivotal Labs
3 |
4 | Permission is hereby granted, free of charge, to any person obtaining
5 | a copy of this software and associated documentation files (the
6 | "Software"), to deal in the Software without restriction, including
7 | without limitation the rights to use, copy, modify, merge, publish,
8 | distribute, sublicense, and/or sell copies of the Software, and to
9 | permit persons to whom the Software is furnished to do so, subject to
10 | the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be
13 | included in all copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
19 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
20 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22 | */
23 | jasmineRequire.html = function(j$) {
24 | j$.ResultsNode = jasmineRequire.ResultsNode();
25 | j$.HtmlReporter = jasmineRequire.HtmlReporter(j$);
26 | j$.QueryString = jasmineRequire.QueryString();
27 | j$.HtmlSpecFilter = jasmineRequire.HtmlSpecFilter();
28 | };
29 |
30 | jasmineRequire.HtmlReporter = function(j$) {
31 |
32 | var noopTimer = {
33 | start: function() {},
34 | elapsed: function() { return 0; }
35 | };
36 |
37 | function HtmlReporter(options) {
38 | var env = options.env || {},
39 | getContainer = options.getContainer,
40 | createElement = options.createElement,
41 | createTextNode = options.createTextNode,
42 | onRaiseExceptionsClick = options.onRaiseExceptionsClick || function() {},
43 | timer = options.timer || noopTimer,
44 | results = [],
45 | specsExecuted = 0,
46 | failureCount = 0,
47 | pendingSpecCount = 0,
48 | htmlReporterMain,
49 | symbols,
50 | failedSuites = [];
51 |
52 | this.initialize = function() {
53 | clearPrior();
54 | htmlReporterMain = createDom('div', {className: 'jasmine_html-reporter'},
55 | createDom('div', {className: 'banner'},
56 | createDom('a', {className: 'title', href: 'http://jasmine.github.io/', target: '_blank'}),
57 | createDom('span', {className: 'version'}, j$.version)
58 | ),
59 | createDom('ul', {className: 'symbol-summary'}),
60 | createDom('div', {className: 'alert'}),
61 | createDom('div', {className: 'results'},
62 | createDom('div', {className: 'failures'})
63 | )
64 | );
65 | getContainer().appendChild(htmlReporterMain);
66 |
67 | symbols = find('.symbol-summary');
68 | };
69 |
70 | var totalSpecsDefined;
71 | this.jasmineStarted = function(options) {
72 | totalSpecsDefined = options.totalSpecsDefined || 0;
73 | timer.start();
74 | };
75 |
76 | var summary = createDom('div', {className: 'summary'});
77 |
78 | var topResults = new j$.ResultsNode({}, '', null),
79 | currentParent = topResults;
80 |
81 | this.suiteStarted = function(result) {
82 | currentParent.addChild(result, 'suite');
83 | currentParent = currentParent.last();
84 | };
85 |
86 | this.suiteDone = function(result) {
87 | if (result.status == 'failed') {
88 | failedSuites.push(result);
89 | }
90 |
91 | if (currentParent == topResults) {
92 | return;
93 | }
94 |
95 | currentParent = currentParent.parent;
96 | };
97 |
98 | this.specStarted = function(result) {
99 | currentParent.addChild(result, 'spec');
100 | };
101 |
102 | var failures = [];
103 | this.specDone = function(result) {
104 | if(noExpectations(result) && typeof console !== 'undefined' && typeof console.error !== 'undefined') {
105 | console.error('Spec \'' + result.fullName + '\' has no expectations.');
106 | }
107 |
108 | if (result.status != 'disabled') {
109 | specsExecuted++;
110 | }
111 |
112 | symbols.appendChild(createDom('li', {
113 | className: noExpectations(result) ? 'empty' : result.status,
114 | id: 'spec_' + result.id,
115 | title: result.fullName
116 | }
117 | ));
118 |
119 | if (result.status == 'failed') {
120 | failureCount++;
121 |
122 | var failure =
123 | createDom('div', {className: 'spec-detail failed'},
124 | createDom('div', {className: 'description'},
125 | createDom('a', {title: result.fullName, href: specHref(result)}, result.fullName)
126 | ),
127 | createDom('div', {className: 'messages'})
128 | );
129 | var messages = failure.childNodes[1];
130 |
131 | for (var i = 0; i < result.failedExpectations.length; i++) {
132 | var expectation = result.failedExpectations[i];
133 | messages.appendChild(createDom('div', {className: 'result-message'}, expectation.message));
134 | messages.appendChild(createDom('div', {className: 'stack-trace'}, expectation.stack));
135 | }
136 |
137 | failures.push(failure);
138 | }
139 |
140 | if (result.status == 'pending') {
141 | pendingSpecCount++;
142 | }
143 | };
144 |
145 | this.jasmineDone = function() {
146 | var banner = find('.banner');
147 | banner.appendChild(createDom('span', {className: 'duration'}, 'finished in ' + timer.elapsed() / 1000 + 's'));
148 |
149 | var alert = find('.alert');
150 |
151 | alert.appendChild(createDom('span', { className: 'exceptions' },
152 | createDom('label', { className: 'label', 'for': 'raise-exceptions' }, 'raise exceptions'),
153 | createDom('input', {
154 | className: 'raise',
155 | id: 'raise-exceptions',
156 | type: 'checkbox'
157 | })
158 | ));
159 | var checkbox = find('#raise-exceptions');
160 |
161 | checkbox.checked = !env.catchingExceptions();
162 | checkbox.onclick = onRaiseExceptionsClick;
163 |
164 | if (specsExecuted < totalSpecsDefined) {
165 | var skippedMessage = 'Ran ' + specsExecuted + ' of ' + totalSpecsDefined + ' specs - run all';
166 | alert.appendChild(
167 | createDom('span', {className: 'bar skipped'},
168 | createDom('a', {href: '?', title: 'Run all specs'}, skippedMessage)
169 | )
170 | );
171 | }
172 | var statusBarMessage = '';
173 | var statusBarClassName = 'bar ';
174 |
175 | if (totalSpecsDefined > 0) {
176 | statusBarMessage += pluralize('spec', specsExecuted) + ', ' + pluralize('failure', failureCount);
177 | if (pendingSpecCount) { statusBarMessage += ', ' + pluralize('pending spec', pendingSpecCount); }
178 | statusBarClassName += (failureCount > 0) ? 'failed' : 'passed';
179 | } else {
180 | statusBarClassName += 'skipped';
181 | statusBarMessage += 'No specs found';
182 | }
183 |
184 | alert.appendChild(createDom('span', {className: statusBarClassName}, statusBarMessage));
185 |
186 | for(i = 0; i < failedSuites.length; i++) {
187 | var failedSuite = failedSuites[i];
188 | for(var j = 0; j < failedSuite.failedExpectations.length; j++) {
189 | var errorBarMessage = 'AfterAll ' + failedSuite.failedExpectations[j].message;
190 | var errorBarClassName = 'bar errored';
191 | alert.appendChild(createDom('span', {className: errorBarClassName}, errorBarMessage));
192 | }
193 | }
194 |
195 | var results = find('.results');
196 | results.appendChild(summary);
197 |
198 | summaryList(topResults, summary);
199 |
200 | function summaryList(resultsTree, domParent) {
201 | var specListNode;
202 | for (var i = 0; i < resultsTree.children.length; i++) {
203 | var resultNode = resultsTree.children[i];
204 | if (resultNode.type == 'suite') {
205 | var suiteListNode = createDom('ul', {className: 'suite', id: 'suite-' + resultNode.result.id},
206 | createDom('li', {className: 'suite-detail'},
207 | createDom('a', {href: specHref(resultNode.result)}, resultNode.result.description)
208 | )
209 | );
210 |
211 | summaryList(resultNode, suiteListNode);
212 | domParent.appendChild(suiteListNode);
213 | }
214 | if (resultNode.type == 'spec') {
215 | if (domParent.getAttribute('class') != 'specs') {
216 | specListNode = createDom('ul', {className: 'specs'});
217 | domParent.appendChild(specListNode);
218 | }
219 | var specDescription = resultNode.result.description;
220 | if(noExpectations(resultNode.result)) {
221 | specDescription = 'SPEC HAS NO EXPECTATIONS ' + specDescription;
222 | }
223 | specListNode.appendChild(
224 | createDom('li', {
225 | className: resultNode.result.status,
226 | id: 'spec-' + resultNode.result.id
227 | },
228 | createDom('a', {href: specHref(resultNode.result)}, specDescription)
229 | )
230 | );
231 | }
232 | }
233 | }
234 |
235 | if (failures.length) {
236 | alert.appendChild(
237 | createDom('span', {className: 'menu bar spec-list'},
238 | createDom('span', {}, 'Spec List | '),
239 | createDom('a', {className: 'failures-menu', href: '#'}, 'Failures')));
240 | alert.appendChild(
241 | createDom('span', {className: 'menu bar failure-list'},
242 | createDom('a', {className: 'spec-list-menu', href: '#'}, 'Spec List'),
243 | createDom('span', {}, ' | Failures ')));
244 |
245 | find('.failures-menu').onclick = function() {
246 | setMenuModeTo('failure-list');
247 | };
248 | find('.spec-list-menu').onclick = function() {
249 | setMenuModeTo('spec-list');
250 | };
251 |
252 | setMenuModeTo('failure-list');
253 |
254 | var failureNode = find('.failures');
255 | for (var i = 0; i < failures.length; i++) {
256 | failureNode.appendChild(failures[i]);
257 | }
258 | }
259 | };
260 |
261 | return this;
262 |
263 | function find(selector) {
264 | return getContainer().querySelector('.jasmine_html-reporter ' + selector);
265 | }
266 |
267 | function clearPrior() {
268 | // return the reporter
269 | var oldReporter = find('');
270 |
271 | if(oldReporter) {
272 | getContainer().removeChild(oldReporter);
273 | }
274 | }
275 |
276 | function createDom(type, attrs, childrenVarArgs) {
277 | var el = createElement(type);
278 |
279 | for (var i = 2; i < arguments.length; i++) {
280 | var child = arguments[i];
281 |
282 | if (typeof child === 'string') {
283 | el.appendChild(createTextNode(child));
284 | } else {
285 | if (child) {
286 | el.appendChild(child);
287 | }
288 | }
289 | }
290 |
291 | for (var attr in attrs) {
292 | if (attr == 'className') {
293 | el[attr] = attrs[attr];
294 | } else {
295 | el.setAttribute(attr, attrs[attr]);
296 | }
297 | }
298 |
299 | return el;
300 | }
301 |
302 | function pluralize(singular, count) {
303 | var word = (count == 1 ? singular : singular + 's');
304 |
305 | return '' + count + ' ' + word;
306 | }
307 |
308 | function specHref(result) {
309 | return '?spec=' + encodeURIComponent(result.fullName);
310 | }
311 |
312 | function setMenuModeTo(mode) {
313 | htmlReporterMain.setAttribute('class', 'jasmine_html-reporter ' + mode);
314 | }
315 |
316 | function noExpectations(result) {
317 | return (result.failedExpectations.length + result.passedExpectations.length) === 0 &&
318 | result.status === 'passed';
319 | }
320 | }
321 |
322 | return HtmlReporter;
323 | };
324 |
325 | jasmineRequire.HtmlSpecFilter = function() {
326 | function HtmlSpecFilter(options) {
327 | var filterString = options && options.filterString() && options.filterString().replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&');
328 | var filterPattern = new RegExp(filterString);
329 |
330 | this.matches = function(specName) {
331 | return filterPattern.test(specName);
332 | };
333 | }
334 |
335 | return HtmlSpecFilter;
336 | };
337 |
338 | jasmineRequire.ResultsNode = function() {
339 | function ResultsNode(result, type, parent) {
340 | this.result = result;
341 | this.type = type;
342 | this.parent = parent;
343 |
344 | this.children = [];
345 |
346 | this.addChild = function(result, type) {
347 | this.children.push(new ResultsNode(result, type, this));
348 | };
349 |
350 | this.last = function() {
351 | return this.children[this.children.length - 1];
352 | };
353 | }
354 |
355 | return ResultsNode;
356 | };
357 |
358 | jasmineRequire.QueryString = function() {
359 | function QueryString(options) {
360 |
361 | this.setParam = function(key, value) {
362 | var paramMap = queryStringToParamMap();
363 | paramMap[key] = value;
364 | options.getWindowLocation().search = toQueryString(paramMap);
365 | };
366 |
367 | this.getParam = function(key) {
368 | return queryStringToParamMap()[key];
369 | };
370 |
371 | return this;
372 |
373 | function toQueryString(paramMap) {
374 | var qStrPairs = [];
375 | for (var prop in paramMap) {
376 | qStrPairs.push(encodeURIComponent(prop) + '=' + encodeURIComponent(paramMap[prop]));
377 | }
378 | return '?' + qStrPairs.join('&');
379 | }
380 |
381 | function queryStringToParamMap() {
382 | var paramStr = options.getWindowLocation().search.substring(1),
383 | params = [],
384 | paramMap = {};
385 |
386 | if (paramStr.length > 0) {
387 | params = paramStr.split('&');
388 | for (var i = 0; i < params.length; i++) {
389 | var p = params[i].split('=');
390 | var value = decodeURIComponent(p[1]);
391 | if (value === 'true' || value === 'false') {
392 | value = JSON.parse(value);
393 | }
394 | paramMap[decodeURIComponent(p[0])] = value;
395 | }
396 | }
397 |
398 | return paramMap;
399 | }
400 |
401 | }
402 |
403 | return QueryString;
404 | };
405 |
--------------------------------------------------------------------------------
/lib/jasmine-fixture.js:
--------------------------------------------------------------------------------
1 | /* jasmine-fixture - 1.2.2
2 | * Makes injecting HTML snippets into the DOM easy & clean!
3 | * https://github.com/searls/jasmine-fixture
4 | */
5 | (function() {
6 | var createHTMLBlock,
7 | __slice = [].slice;
8 |
9 | (function($) {
10 | var ewwSideEffects, jasmineFixture, originalAffix, originalJasmineDotFixture, originalJasmineFixture, root, _, _ref;
11 | root = this;
12 | originalJasmineFixture = root.jasmineFixture;
13 | originalJasmineDotFixture = (_ref = root.jasmine) != null ? _ref.fixture : void 0;
14 | originalAffix = root.affix;
15 | _ = function(list) {
16 | return {
17 | inject: function(iterator, memo) {
18 | var item, _i, _len, _results;
19 | _results = [];
20 | for (_i = 0, _len = list.length; _i < _len; _i++) {
21 | item = list[_i];
22 | _results.push(memo = iterator(memo, item));
23 | }
24 | return _results;
25 | }
26 | };
27 | };
28 | root.jasmineFixture = function($) {
29 | var $whatsTheRootOf, affix, create, jasmineFixture, noConflict;
30 | affix = function(selectorOptions) {
31 | return create.call(this, selectorOptions, true);
32 | };
33 | create = function(selectorOptions, attach) {
34 | var $top;
35 | $top = null;
36 | _(selectorOptions.split(/[ ](?=[^\]]*?(?:\[|$))/)).inject(function($parent, elementSelector) {
37 | var $el;
38 | if (elementSelector === ">") {
39 | return $parent;
40 | }
41 | $el = createHTMLBlock($, elementSelector);
42 | if (attach || $top) {
43 | $el.appendTo($parent);
44 | }
45 | $top || ($top = $el);
46 | return $el;
47 | }, $whatsTheRootOf(this));
48 | return $top;
49 | };
50 | noConflict = function() {
51 | var currentJasmineFixture, _ref1;
52 | currentJasmineFixture = jasmine.fixture;
53 | root.jasmineFixture = originalJasmineFixture;
54 | if ((_ref1 = root.jasmine) != null) {
55 | _ref1.fixture = originalJasmineDotFixture;
56 | }
57 | root.affix = originalAffix;
58 | return currentJasmineFixture;
59 | };
60 | $whatsTheRootOf = function(that) {
61 | if (that.jquery != null) {
62 | return that;
63 | } else if ($('#jasmine_content').length > 0) {
64 | return $('#jasmine_content');
65 | } else {
66 | return $('').appendTo('body');
67 | }
68 | };
69 | jasmineFixture = {
70 | affix: affix,
71 | create: create,
72 | noConflict: noConflict
73 | };
74 | ewwSideEffects(jasmineFixture);
75 | return jasmineFixture;
76 | };
77 | ewwSideEffects = function(jasmineFixture) {
78 | var _ref1;
79 | if ((_ref1 = root.jasmine) != null) {
80 | _ref1.fixture = jasmineFixture;
81 | }
82 | $.fn.affix = root.affix = jasmineFixture.affix;
83 | return afterEach(function() {
84 | return $('#jasmine_content').remove();
85 | });
86 | };
87 | if ($) {
88 | return jasmineFixture = root.jasmineFixture($);
89 | } else {
90 | return root.affix = function() {
91 | var nowJQueryExists;
92 | nowJQueryExists = window.jQuery || window.$;
93 | if (nowJQueryExists != null) {
94 | jasmineFixture = root.jasmineFixture(nowJQueryExists);
95 | return affix.call.apply(affix, [this].concat(__slice.call(arguments)));
96 | } else {
97 | throw new Error("jasmine-fixture requires jQuery to be defined at window.jQuery or window.$");
98 | }
99 | };
100 | }
101 | })(window.jQuery || window.$);
102 |
103 | createHTMLBlock = (function() {
104 | var bindData, bindEvents, parseAttributes, parseClasses, parseContents, parseEnclosure, parseReferences, parseVariableScope, regAttr, regAttrDfn, regAttrs, regCBrace, regClass, regClasses, regData, regDatas, regEvent, regEvents, regExclamation, regId, regReference, regTag, regTagNotContent, regZenTagDfn;
105 | createHTMLBlock = function($, ZenObject, data, functions, indexes) {
106 | var ZenCode, arr, block, blockAttrs, blockClasses, blockHTML, blockId, blockTag, blocks, el, el2, els, forScope, indexName, inner, len, obj, origZenCode, paren, result, ret, zc, zo;
107 | if ($.isPlainObject(ZenObject)) {
108 | ZenCode = ZenObject.main;
109 | } else {
110 | ZenCode = ZenObject;
111 | ZenObject = {
112 | main: ZenCode
113 | };
114 | }
115 | origZenCode = ZenCode;
116 | if (indexes === undefined) {
117 | indexes = {};
118 | }
119 | if (ZenCode.charAt(0) === "!" || $.isArray(data)) {
120 | if ($.isArray(data)) {
121 | forScope = ZenCode;
122 | } else {
123 | obj = parseEnclosure(ZenCode, "!");
124 | obj = obj.substring(obj.indexOf(":") + 1, obj.length - 1);
125 | forScope = parseVariableScope(ZenCode);
126 | }
127 | while (forScope.charAt(0) === "@") {
128 | forScope = parseVariableScope("!for:!" + parseReferences(forScope, ZenObject));
129 | }
130 | zo = ZenObject;
131 | zo.main = forScope;
132 | el = $();
133 | if (ZenCode.substring(0, 5) === "!for:" || $.isArray(data)) {
134 | if (!$.isArray(data) && obj.indexOf(":") > 0) {
135 | indexName = obj.substring(0, obj.indexOf(":"));
136 | obj = obj.substr(obj.indexOf(":") + 1);
137 | }
138 | arr = ($.isArray(data) ? data : data[obj]);
139 | zc = zo.main;
140 | if ($.isArray(arr) || $.isPlainObject(arr)) {
141 | $.map(arr, function(value, index) {
142 | var next;
143 | zo.main = zc;
144 | if (indexName !== undefined) {
145 | indexes[indexName] = index;
146 | }
147 | if (!$.isPlainObject(value)) {
148 | value = {
149 | value: value
150 | };
151 | }
152 | next = createHTMLBlock($, zo, value, functions, indexes);
153 | if (el.length !== 0) {
154 | return $.each(next, function(index, value) {
155 | return el.push(value);
156 | });
157 | }
158 | });
159 | }
160 | if (!$.isArray(data)) {
161 | ZenCode = ZenCode.substr(obj.length + 6 + forScope.length);
162 | } else {
163 | ZenCode = "";
164 | }
165 | } else if (ZenCode.substring(0, 4) === "!if:") {
166 | result = parseContents("!" + obj + "!", data, indexes);
167 | if (result !== "undefined" || result !== "false" || result !== "") {
168 | el = createHTMLBlock($, zo, data, functions, indexes);
169 | }
170 | ZenCode = ZenCode.substr(obj.length + 5 + forScope.length);
171 | }
172 | ZenObject.main = ZenCode;
173 | } else if (ZenCode.charAt(0) === "(") {
174 | paren = parseEnclosure(ZenCode, "(", ")");
175 | inner = paren.substring(1, paren.length - 1);
176 | ZenCode = ZenCode.substr(paren.length);
177 | zo = ZenObject;
178 | zo.main = inner;
179 | el = createHTMLBlock($, zo, data, functions, indexes);
180 | } else {
181 | blocks = ZenCode.match(regZenTagDfn);
182 | block = blocks[0];
183 | if (block.length === 0) {
184 | return "";
185 | }
186 | if (block.indexOf("@") >= 0) {
187 | ZenCode = parseReferences(ZenCode, ZenObject);
188 | zo = ZenObject;
189 | zo.main = ZenCode;
190 | return createHTMLBlock($, zo, data, functions, indexes);
191 | }
192 | block = parseContents(block, data, indexes);
193 | blockClasses = parseClasses($, block);
194 | if (regId.test(block)) {
195 | blockId = regId.exec(block)[1];
196 | }
197 | blockAttrs = parseAttributes(block, data);
198 | blockTag = (block.charAt(0) === "{" ? "span" : "div");
199 | if (ZenCode.charAt(0) !== "#" && ZenCode.charAt(0) !== "." && ZenCode.charAt(0) !== "{") {
200 | blockTag = regTag.exec(block)[1];
201 | }
202 | if (block.search(regCBrace) !== -1) {
203 | blockHTML = block.match(regCBrace)[1];
204 | }
205 | blockAttrs = $.extend(blockAttrs, {
206 | id: blockId,
207 | "class": blockClasses,
208 | html: blockHTML
209 | });
210 | el = $("<" + blockTag + ">", blockAttrs);
211 | el.attr(blockAttrs);
212 | el = bindEvents(block, el, functions);
213 | el = bindData(block, el, data);
214 | ZenCode = ZenCode.substr(blocks[0].length);
215 | ZenObject.main = ZenCode;
216 | }
217 | if (ZenCode.length > 0) {
218 | if (ZenCode.charAt(0) === ">") {
219 | if (ZenCode.charAt(1) === "(") {
220 | zc = parseEnclosure(ZenCode.substr(1), "(", ")");
221 | ZenCode = ZenCode.substr(zc.length + 1);
222 | } else if (ZenCode.charAt(1) === "!") {
223 | obj = parseEnclosure(ZenCode.substr(1), "!");
224 | forScope = parseVariableScope(ZenCode.substr(1));
225 | zc = obj + forScope;
226 | ZenCode = ZenCode.substr(zc.length + 1);
227 | } else {
228 | len = Math.max(ZenCode.indexOf("+"), ZenCode.length);
229 | zc = ZenCode.substring(1, len);
230 | ZenCode = ZenCode.substr(len);
231 | }
232 | zo = ZenObject;
233 | zo.main = zc;
234 | els = $(createHTMLBlock($, zo, data, functions, indexes));
235 | els.appendTo(el);
236 | }
237 | if (ZenCode.charAt(0) === "+") {
238 | zo = ZenObject;
239 | zo.main = ZenCode.substr(1);
240 | el2 = createHTMLBlock($, zo, data, functions, indexes);
241 | $.each(el2, function(index, value) {
242 | return el.push(value);
243 | });
244 | }
245 | }
246 | ret = el;
247 | return ret;
248 | };
249 | bindData = function(ZenCode, el, data) {
250 | var datas, i, split;
251 | if (ZenCode.search(regDatas) === 0) {
252 | return el;
253 | }
254 | datas = ZenCode.match(regDatas);
255 | if (datas === null) {
256 | return el;
257 | }
258 | i = 0;
259 | while (i < datas.length) {
260 | split = regData.exec(datas[i]);
261 | if (split[3] === undefined) {
262 | $(el).data(split[1], data[split[1]]);
263 | } else {
264 | $(el).data(split[1], data[split[3]]);
265 | }
266 | i++;
267 | }
268 | return el;
269 | };
270 | bindEvents = function(ZenCode, el, functions) {
271 | var bindings, fn, i, split;
272 | if (ZenCode.search(regEvents) === 0) {
273 | return el;
274 | }
275 | bindings = ZenCode.match(regEvents);
276 | if (bindings === null) {
277 | return el;
278 | }
279 | i = 0;
280 | while (i < bindings.length) {
281 | split = regEvent.exec(bindings[i]);
282 | if (split[2] === undefined) {
283 | fn = functions[split[1]];
284 | } else {
285 | fn = functions[split[2]];
286 | }
287 | $(el).bind(split[1], fn);
288 | i++;
289 | }
290 | return el;
291 | };
292 | parseAttributes = function(ZenBlock, data) {
293 | var attrStrs, attrs, i, parts;
294 | if (ZenBlock.search(regAttrDfn) === -1) {
295 | return undefined;
296 | }
297 | attrStrs = ZenBlock.match(regAttrDfn);
298 | attrs = {};
299 | i = 0;
300 | while (i < attrStrs.length) {
301 | parts = regAttr.exec(attrStrs[i]);
302 | attrs[parts[1]] = "";
303 | if (parts[3] !== undefined) {
304 | attrs[parts[1]] = parseContents(parts[3], data);
305 | }
306 | i++;
307 | }
308 | return attrs;
309 | };
310 | parseClasses = function($, ZenBlock) {
311 | var classes, clsString, i;
312 | ZenBlock = ZenBlock.match(regTagNotContent)[0];
313 | if (ZenBlock.search(regClasses) === -1) {
314 | return undefined;
315 | }
316 | classes = ZenBlock.match(regClasses);
317 | clsString = "";
318 | i = 0;
319 | while (i < classes.length) {
320 | clsString += " " + regClass.exec(classes[i])[1];
321 | i++;
322 | }
323 | return $.trim(clsString);
324 | };
325 | parseContents = function(ZenBlock, data, indexes) {
326 | var html;
327 | if (indexes === undefined) {
328 | indexes = {};
329 | }
330 | html = ZenBlock;
331 | if (data === undefined) {
332 | return html;
333 | }
334 | while (regExclamation.test(html)) {
335 | html = html.replace(regExclamation, function(str, str2) {
336 | var begChar, fn, val;
337 | begChar = "";
338 | if (str.indexOf("!for:") > 0 || str.indexOf("!if:") > 0) {
339 | return str;
340 | }
341 | if (str.charAt(0) !== "!") {
342 | begChar = str.charAt(0);
343 | str = str.substring(2, str.length - 1);
344 | }
345 | fn = new Function("data", "indexes", "var r=undefined;" + "with(data){try{r=" + str + ";}catch(e){}}" + "with(indexes){try{if(r===undefined)r=" + str + ";}catch(e){}}" + "return r;");
346 | val = unescape(fn(data, indexes));
347 | return begChar + val;
348 | });
349 | }
350 | html = html.replace(/\\./g, function(str) {
351 | return str.charAt(1);
352 | });
353 | return unescape(html);
354 | };
355 | parseEnclosure = function(ZenCode, open, close, count) {
356 | var index, ret;
357 | if (close === undefined) {
358 | close = open;
359 | }
360 | index = 1;
361 | if (count === undefined) {
362 | count = (ZenCode.charAt(0) === open ? 1 : 0);
363 | }
364 | if (count === 0) {
365 | return;
366 | }
367 | while (count > 0 && index < ZenCode.length) {
368 | if (ZenCode.charAt(index) === close && ZenCode.charAt(index - 1) !== "\\") {
369 | count--;
370 | } else {
371 | if (ZenCode.charAt(index) === open && ZenCode.charAt(index - 1) !== "\\") {
372 | count++;
373 | }
374 | }
375 | index++;
376 | }
377 | ret = ZenCode.substring(0, index);
378 | return ret;
379 | };
380 | parseReferences = function(ZenCode, ZenObject) {
381 | ZenCode = ZenCode.replace(regReference, function(str) {
382 | var fn;
383 | str = str.substr(1);
384 | fn = new Function("objs", "var r=\"\";" + "with(objs){try{" + "r=" + str + ";" + "}catch(e){}}" + "return r;");
385 | return fn(ZenObject, parseReferences);
386 | });
387 | return ZenCode;
388 | };
389 | parseVariableScope = function(ZenCode) {
390 | var forCode, rest, tag;
391 | if (ZenCode.substring(0, 5) !== "!for:" && ZenCode.substring(0, 4) !== "!if:") {
392 | return undefined;
393 | }
394 | forCode = parseEnclosure(ZenCode, "!");
395 | ZenCode = ZenCode.substr(forCode.length);
396 | if (ZenCode.charAt(0) === "(") {
397 | return parseEnclosure(ZenCode, "(", ")");
398 | }
399 | tag = ZenCode.match(regZenTagDfn)[0];
400 | ZenCode = ZenCode.substr(tag.length);
401 | if (ZenCode.length === 0 || ZenCode.charAt(0) === "+") {
402 | return tag;
403 | } else if (ZenCode.charAt(0) === ">") {
404 | rest = "";
405 | rest = parseEnclosure(ZenCode.substr(1), "(", ")", 1);
406 | return tag + ">" + rest;
407 | }
408 | return undefined;
409 | };
410 | regZenTagDfn = /([#\.\@]?[\w-]+|\[([\w-!?=:"']+(="([^"]|\\")+")? {0,})+\]|\~[\w$]+=[\w$]+|&[\w$]+(=[\w$]+)?|[#\.\@]?!([^!]|\\!)+!){0,}(\{([^\}]|\\\})+\})?/i;
411 | regTag = /(\w+)/i;
412 | regId = /(?:^|\b)#([\w-!]+)/i;
413 | regTagNotContent = /((([#\.]?[\w-]+)?(\[([\w!]+(="([^"]|\\")+")? {0,})+\])?)+)/i;
414 | /*
415 | See lookahead syntax (?!) at https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp
416 | */
417 |
418 | regClasses = /(\.[\w-]+)(?!["\w])/g;
419 | regClass = /\.([\w-]+)/i;
420 | regReference = /(@[\w$_][\w$_\d]+)/i;
421 | regAttrDfn = /(\[([\w-!]+(="?([^"]|\\")+"?)? {0,})+\])/ig;
422 | regAttrs = /([\w-!]+(="([^"]|\\")+")?)/g;
423 | regAttr = /([\w-!]+)(="?((([\w]+(\[.*?\])+)|[^"\]]|\\")+)"?)?/i;
424 | regCBrace = /\{(([^\}]|\\\})+)\}/i;
425 | regExclamation = /(?:([^\\]|^))!([^!]|\\!)+!/g;
426 | regEvents = /\~[\w$]+(=[\w$]+)?/g;
427 | regEvent = /\~([\w$]+)=([\w$]+)/i;
428 | regDatas = /&[\w$]+(=[\w$]+)?/g;
429 | regData = /&([\w$]+)(=([\w$]+))?/i;
430 | return createHTMLBlock;
431 | })();
432 |
433 | }).call(this);
434 |
--------------------------------------------------------------------------------
/lib/jasmine-2.1.3/jasmine.css:
--------------------------------------------------------------------------------
1 | body { overflow-y: scroll; }
2 |
3 | .jasmine_html-reporter { background-color: #eeeeee; padding: 5px; margin: -8px; font-size: 11px; font-family: Monaco, "Lucida Console", monospace; line-height: 14px; color: #333333; }
4 | .jasmine_html-reporter a { text-decoration: none; }
5 | .jasmine_html-reporter a:hover { text-decoration: underline; }
6 | .jasmine_html-reporter p, .jasmine_html-reporter h1, .jasmine_html-reporter h2, .jasmine_html-reporter h3, .jasmine_html-reporter h4, .jasmine_html-reporter h5, .jasmine_html-reporter h6 { margin: 0; line-height: 14px; }
7 | .jasmine_html-reporter .banner, .jasmine_html-reporter .symbol-summary, .jasmine_html-reporter .summary, .jasmine_html-reporter .result-message, .jasmine_html-reporter .spec .description, .jasmine_html-reporter .spec-detail .description, .jasmine_html-reporter .alert .bar, .jasmine_html-reporter .stack-trace { padding-left: 9px; padding-right: 9px; }
8 | .jasmine_html-reporter .banner { position: relative; }
9 | .jasmine_html-reporter .banner .title { background: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFoAAAAZCAMAAACGusnyAAACdlBMVEX/////AP+AgICqVaqAQICZM5mAVYCSSZKAQICOOY6ATYCLRouAQICJO4mSSYCIRIiPQICHPIeOR4CGQ4aMQICGPYaLRoCFQ4WKQICPPYWJRYCOQoSJQICNPoSIRICMQoSHQICHRICKQoOHQICKPoOJO4OJQYOMQICMQ4CIQYKLQICIPoKLQ4CKQICNPoKJQISMQ4KJQoSLQYKJQISL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gNjA3LjQ2NSw5MDMuNDQ1IgogICAgICAgICAgICAgaW5rc2NhcGU6Y29ubmVjdG9yLWN1cnZhdHVyZT0iMCIKICAgICAgICAgICAgIGlkPSJwYXRoNTIiCiAgICAgICAgICAgICBzdHlsZT0iZmlsbDojOGE0MTgyO2ZpbGwtb3BhY2l0eToxO2ZpbGwtcnVsZTpub256ZXJvO3N0cm9rZTpub25lIiAvPjxwYXRoCiAgICAgICAgICAgICBkPSJtIDM4MC42ODgsNjIyLjEyOSAtMTEuNjI2LDM1LjgwMSAxNzUuNzU4LDU3LjA5IDExLjYyMSwtMzUuODAxIC0xNzUuNzUzLC01Ny4wOSIKICAgICAgICAgICAgIGlua3NjYXBlOmNvbm5lY3Rvci1jdXJ2YXR1cmU9IjAiCiAgICAgICAgICAgICBpZD0icGF0aDU0IgogICAgICAgICAgICAgc3R5bGU9ImZpbGw6IzhhNDE4MjtmaWxsLW9wYWNpdHk6MTtmaWxsLXJ1bGU6bm9uemVybztzdHJva2U6bm9uZSIgLz48cGF0aAogICAgICAgICAgICAgZD0ibSA3MTYuMjg5LDM3Ni41OSAzNy42NDA2LDAgMCwxODQuODE2IC0zNy42NDA2LDAgMCwtMTg0LjgxNiB6IgogICAgICAgICAgICAgaW5rc2NhcGU6Y29ubmVjdG9yLWN1cnZhdHVyZT0iMCIKICAgICAgICAgICAgIGlkPSJwYXRoNTYiCiAgICAgICAgICAgICBzdHlsZT0iZmlsbDojOGE0MTgyO2ZpbGwtb3BhY2l0eToxO2ZpbGwtcnVsZTpub256ZXJvO3N0cm9rZTpub25lIiAvPjwvZz48L2c+PC9nPjwvZz48L3N2Zz4=') no-repeat, none; -webkit-background-size: 100%; -moz-background-size: 100%; -o-background-size: 100%; background-size: 100%; display: block; float: left; width: 90px; height: 25px; }
10 | .jasmine_html-reporter .banner .version { margin-left: 14px; position: relative; top: 6px; }
11 | .jasmine_html-reporter .banner .duration { position: absolute; right: 14px; top: 6px; }
12 | .jasmine_html-reporter #jasmine_content { position: fixed; right: 100%; }
13 | .jasmine_html-reporter .version { color: #aaaaaa; }
14 | .jasmine_html-reporter .banner { margin-top: 14px; }
15 | .jasmine_html-reporter .duration { color: #aaaaaa; float: right; }
16 | .jasmine_html-reporter .symbol-summary { overflow: hidden; *zoom: 1; margin: 14px 0; }
17 | .jasmine_html-reporter .symbol-summary li { display: inline-block; height: 8px; width: 14px; font-size: 16px; }
18 | .jasmine_html-reporter .symbol-summary li.passed { font-size: 14px; }
19 | .jasmine_html-reporter .symbol-summary li.passed:before { color: #007069; content: "\02022"; }
20 | .jasmine_html-reporter .symbol-summary li.failed { line-height: 9px; }
21 | .jasmine_html-reporter .symbol-summary li.failed:before { color: #ca3a11; content: "\d7"; font-weight: bold; margin-left: -1px; }
22 | .jasmine_html-reporter .symbol-summary li.disabled { font-size: 14px; }
23 | .jasmine_html-reporter .symbol-summary li.disabled:before { color: #bababa; content: "\02022"; }
24 | .jasmine_html-reporter .symbol-summary li.pending { line-height: 17px; }
25 | .jasmine_html-reporter .symbol-summary li.pending:before { color: #ba9d37; content: "*"; }
26 | .jasmine_html-reporter .symbol-summary li.empty { font-size: 14px; }
27 | .jasmine_html-reporter .symbol-summary li.empty:before { color: #ba9d37; content: "\02022"; }
28 | .jasmine_html-reporter .exceptions { color: #fff; float: right; margin-top: 5px; margin-right: 5px; }
29 | .jasmine_html-reporter .bar { line-height: 28px; font-size: 14px; display: block; color: #eee; }
30 | .jasmine_html-reporter .bar.failed { background-color: #ca3a11; }
31 | .jasmine_html-reporter .bar.passed { background-color: #007069; }
32 | .jasmine_html-reporter .bar.skipped { background-color: #bababa; }
33 | .jasmine_html-reporter .bar.errored { background-color: #ca3a11; }
34 | .jasmine_html-reporter .bar.menu { background-color: #fff; color: #aaaaaa; }
35 | .jasmine_html-reporter .bar.menu a { color: #333333; }
36 | .jasmine_html-reporter .bar a { color: white; }
37 | .jasmine_html-reporter.spec-list .bar.menu.failure-list, .jasmine_html-reporter.spec-list .results .failures { display: none; }
38 | .jasmine_html-reporter.failure-list .bar.menu.spec-list, .jasmine_html-reporter.failure-list .summary { display: none; }
39 | .jasmine_html-reporter .running-alert { background-color: #666666; }
40 | .jasmine_html-reporter .results { margin-top: 14px; }
41 | .jasmine_html-reporter.showDetails .summaryMenuItem { font-weight: normal; text-decoration: inherit; }
42 | .jasmine_html-reporter.showDetails .summaryMenuItem:hover { text-decoration: underline; }
43 | .jasmine_html-reporter.showDetails .detailsMenuItem { font-weight: bold; text-decoration: underline; }
44 | .jasmine_html-reporter.showDetails .summary { display: none; }
45 | .jasmine_html-reporter.showDetails #details { display: block; }
46 | .jasmine_html-reporter .summaryMenuItem { font-weight: bold; text-decoration: underline; }
47 | .jasmine_html-reporter .summary { margin-top: 14px; }
48 | .jasmine_html-reporter .summary ul { list-style-type: none; margin-left: 14px; padding-top: 0; padding-left: 0; }
49 | .jasmine_html-reporter .summary ul.suite { margin-top: 7px; margin-bottom: 7px; }
50 | .jasmine_html-reporter .summary li.passed a { color: #007069; }
51 | .jasmine_html-reporter .summary li.failed a { color: #ca3a11; }
52 | .jasmine_html-reporter .summary li.empty a { color: #ba9d37; }
53 | .jasmine_html-reporter .summary li.pending a { color: #ba9d37; }
54 | .jasmine_html-reporter .description + .suite { margin-top: 0; }
55 | .jasmine_html-reporter .suite { margin-top: 14px; }
56 | .jasmine_html-reporter .suite a { color: #333333; }
57 | .jasmine_html-reporter .failures .spec-detail { margin-bottom: 28px; }
58 | .jasmine_html-reporter .failures .spec-detail .description { background-color: #ca3a11; }
59 | .jasmine_html-reporter .failures .spec-detail .description a { color: white; }
60 | .jasmine_html-reporter .result-message { padding-top: 14px; color: #333333; white-space: pre; }
61 | .jasmine_html-reporter .result-message span.result { display: block; }
62 | .jasmine_html-reporter .stack-trace { margin: 5px 0 0 0; max-height: 224px; overflow: auto; line-height: 18px; color: #666666; border: 1px solid #ddd; background: white; white-space: pre; }
63 |
--------------------------------------------------------------------------------
/lib/jasmine-2.1.3/jasmine.js:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2008-2014 Pivotal Labs
3 |
4 | Permission is hereby granted, free of charge, to any person obtaining
5 | a copy of this software and associated documentation files (the
6 | "Software"), to deal in the Software without restriction, including
7 | without limitation the rights to use, copy, modify, merge, publish,
8 | distribute, sublicense, and/or sell copies of the Software, and to
9 | permit persons to whom the Software is furnished to do so, subject to
10 | the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be
13 | included in all copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
19 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
20 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22 | */
23 | getJasmineRequireObj = (function (jasmineGlobal) {
24 | var jasmineRequire;
25 |
26 | if (typeof module !== 'undefined' && module.exports) {
27 | jasmineGlobal = global;
28 | jasmineRequire = exports;
29 | } else {
30 | jasmineRequire = jasmineGlobal.jasmineRequire = jasmineGlobal.jasmineRequire || {};
31 | }
32 |
33 | function getJasmineRequire() {
34 | return jasmineRequire;
35 | }
36 |
37 | getJasmineRequire().core = function(jRequire) {
38 | var j$ = {};
39 |
40 | jRequire.base(j$, jasmineGlobal);
41 | j$.util = jRequire.util();
42 | j$.Any = jRequire.Any();
43 | j$.CallTracker = jRequire.CallTracker();
44 | j$.MockDate = jRequire.MockDate();
45 | j$.Clock = jRequire.Clock();
46 | j$.DelayedFunctionScheduler = jRequire.DelayedFunctionScheduler();
47 | j$.Env = jRequire.Env(j$);
48 | j$.ExceptionFormatter = jRequire.ExceptionFormatter();
49 | j$.Expectation = jRequire.Expectation();
50 | j$.buildExpectationResult = jRequire.buildExpectationResult();
51 | j$.JsApiReporter = jRequire.JsApiReporter();
52 | j$.matchersUtil = jRequire.matchersUtil(j$);
53 | j$.ObjectContaining = jRequire.ObjectContaining(j$);
54 | j$.pp = jRequire.pp(j$);
55 | j$.QueueRunner = jRequire.QueueRunner(j$);
56 | j$.ReportDispatcher = jRequire.ReportDispatcher();
57 | j$.Spec = jRequire.Spec(j$);
58 | j$.SpyRegistry = jRequire.SpyRegistry(j$);
59 | j$.SpyStrategy = jRequire.SpyStrategy();
60 | j$.Suite = jRequire.Suite();
61 | j$.Timer = jRequire.Timer();
62 | j$.version = jRequire.version();
63 |
64 | j$.matchers = jRequire.requireMatchers(jRequire, j$);
65 |
66 | return j$;
67 | };
68 |
69 | return getJasmineRequire;
70 | })(this);
71 |
72 | getJasmineRequireObj().requireMatchers = function(jRequire, j$) {
73 | var availableMatchers = [
74 | 'toBe',
75 | 'toBeCloseTo',
76 | 'toBeDefined',
77 | 'toBeFalsy',
78 | 'toBeGreaterThan',
79 | 'toBeLessThan',
80 | 'toBeNaN',
81 | 'toBeNull',
82 | 'toBeTruthy',
83 | 'toBeUndefined',
84 | 'toContain',
85 | 'toEqual',
86 | 'toHaveBeenCalled',
87 | 'toHaveBeenCalledWith',
88 | 'toMatch',
89 | 'toThrow',
90 | 'toThrowError'
91 | ],
92 | matchers = {};
93 |
94 | for (var i = 0; i < availableMatchers.length; i++) {
95 | var name = availableMatchers[i];
96 | matchers[name] = jRequire[name](j$);
97 | }
98 |
99 | return matchers;
100 | };
101 |
102 | getJasmineRequireObj().base = function(j$, jasmineGlobal) {
103 | j$.unimplementedMethod_ = function() {
104 | throw new Error('unimplemented method');
105 | };
106 |
107 | j$.MAX_PRETTY_PRINT_DEPTH = 40;
108 | j$.MAX_PRETTY_PRINT_ARRAY_LENGTH = 100;
109 | j$.DEFAULT_TIMEOUT_INTERVAL = 5000;
110 |
111 | j$.getGlobal = function() {
112 | return jasmineGlobal;
113 | };
114 |
115 | j$.getEnv = function(options) {
116 | var env = j$.currentEnv_ = j$.currentEnv_ || new j$.Env(options);
117 | //jasmine. singletons in here (setTimeout blah blah).
118 | return env;
119 | };
120 |
121 | j$.isArray_ = function(value) {
122 | return j$.isA_('Array', value);
123 | };
124 |
125 | j$.isString_ = function(value) {
126 | return j$.isA_('String', value);
127 | };
128 |
129 | j$.isNumber_ = function(value) {
130 | return j$.isA_('Number', value);
131 | };
132 |
133 | j$.isA_ = function(typeName, value) {
134 | return Object.prototype.toString.apply(value) === '[object ' + typeName + ']';
135 | };
136 |
137 | j$.isDomNode = function(obj) {
138 | return obj.nodeType > 0;
139 | };
140 |
141 | j$.any = function(clazz) {
142 | return new j$.Any(clazz);
143 | };
144 |
145 | j$.objectContaining = function(sample) {
146 | return new j$.ObjectContaining(sample);
147 | };
148 |
149 | j$.createSpy = function(name, originalFn) {
150 |
151 | var spyStrategy = new j$.SpyStrategy({
152 | name: name,
153 | fn: originalFn,
154 | getSpy: function() { return spy; }
155 | }),
156 | callTracker = new j$.CallTracker(),
157 | spy = function() {
158 | var callData = {
159 | object: this,
160 | args: Array.prototype.slice.apply(arguments)
161 | };
162 |
163 | callTracker.track(callData);
164 | var returnValue = spyStrategy.exec.apply(this, arguments);
165 | callData.returnValue = returnValue;
166 |
167 | return returnValue;
168 | };
169 |
170 | for (var prop in originalFn) {
171 | if (prop === 'and' || prop === 'calls') {
172 | throw new Error('Jasmine spies would overwrite the \'and\' and \'calls\' properties on the object being spied upon');
173 | }
174 |
175 | spy[prop] = originalFn[prop];
176 | }
177 |
178 | spy.and = spyStrategy;
179 | spy.calls = callTracker;
180 |
181 | return spy;
182 | };
183 |
184 | j$.isSpy = function(putativeSpy) {
185 | if (!putativeSpy) {
186 | return false;
187 | }
188 | return putativeSpy.and instanceof j$.SpyStrategy &&
189 | putativeSpy.calls instanceof j$.CallTracker;
190 | };
191 |
192 | j$.createSpyObj = function(baseName, methodNames) {
193 | if (!j$.isArray_(methodNames) || methodNames.length === 0) {
194 | throw 'createSpyObj requires a non-empty array of method names to create spies for';
195 | }
196 | var obj = {};
197 | for (var i = 0; i < methodNames.length; i++) {
198 | obj[methodNames[i]] = j$.createSpy(baseName + '.' + methodNames[i]);
199 | }
200 | return obj;
201 | };
202 | };
203 |
204 | getJasmineRequireObj().util = function() {
205 |
206 | var util = {};
207 |
208 | util.inherit = function(childClass, parentClass) {
209 | var Subclass = function() {
210 | };
211 | Subclass.prototype = parentClass.prototype;
212 | childClass.prototype = new Subclass();
213 | };
214 |
215 | util.htmlEscape = function(str) {
216 | if (!str) {
217 | return str;
218 | }
219 | return str.replace(/&/g, '&')
220 | .replace(//g, '>');
222 | };
223 |
224 | util.argsToArray = function(args) {
225 | var arrayOfArgs = [];
226 | for (var i = 0; i < args.length; i++) {
227 | arrayOfArgs.push(args[i]);
228 | }
229 | return arrayOfArgs;
230 | };
231 |
232 | util.isUndefined = function(obj) {
233 | return obj === void 0;
234 | };
235 |
236 | util.arrayContains = function(array, search) {
237 | var i = array.length;
238 | while (i--) {
239 | if (array[i] === search) {
240 | return true;
241 | }
242 | }
243 | return false;
244 | };
245 |
246 | util.clone = function(obj) {
247 | if (Object.prototype.toString.apply(obj) === '[object Array]') {
248 | return obj.slice();
249 | }
250 |
251 | var cloned = {};
252 | for (var prop in obj) {
253 | if (obj.hasOwnProperty(prop)) {
254 | cloned[prop] = obj[prop];
255 | }
256 | }
257 |
258 | return cloned;
259 | };
260 |
261 | return util;
262 | };
263 |
264 | getJasmineRequireObj().Spec = function(j$) {
265 | function Spec(attrs) {
266 | this.expectationFactory = attrs.expectationFactory;
267 | this.resultCallback = attrs.resultCallback || function() {};
268 | this.id = attrs.id;
269 | this.description = attrs.description || '';
270 | this.queueableFn = attrs.queueableFn;
271 | this.beforeAndAfterFns = attrs.beforeAndAfterFns || function() { return {befores: [], afters: []}; };
272 | this.userContext = attrs.userContext || function() { return {}; };
273 | this.onStart = attrs.onStart || function() {};
274 | this.getSpecName = attrs.getSpecName || function() { return ''; };
275 | this.expectationResultFactory = attrs.expectationResultFactory || function() { };
276 | this.queueRunnerFactory = attrs.queueRunnerFactory || function() {};
277 | this.catchingExceptions = attrs.catchingExceptions || function() { return true; };
278 |
279 | if (!this.queueableFn.fn) {
280 | this.pend();
281 | }
282 |
283 | this.result = {
284 | id: this.id,
285 | description: this.description,
286 | fullName: this.getFullName(),
287 | failedExpectations: [],
288 | passedExpectations: []
289 | };
290 | }
291 |
292 | Spec.prototype.addExpectationResult = function(passed, data) {
293 | var expectationResult = this.expectationResultFactory(data);
294 | if (passed) {
295 | this.result.passedExpectations.push(expectationResult);
296 | } else {
297 | this.result.failedExpectations.push(expectationResult);
298 | }
299 | };
300 |
301 | Spec.prototype.expect = function(actual) {
302 | return this.expectationFactory(actual, this);
303 | };
304 |
305 | Spec.prototype.execute = function(onComplete) {
306 | var self = this;
307 |
308 | this.onStart(this);
309 |
310 | if (this.markedPending || this.disabled) {
311 | complete();
312 | return;
313 | }
314 |
315 | var fns = this.beforeAndAfterFns();
316 | var allFns = fns.befores.concat(this.queueableFn).concat(fns.afters);
317 |
318 | this.queueRunnerFactory({
319 | queueableFns: allFns,
320 | onException: function() { self.onException.apply(self, arguments); },
321 | onComplete: complete,
322 | userContext: this.userContext()
323 | });
324 |
325 | function complete() {
326 | self.result.status = self.status();
327 | self.resultCallback(self.result);
328 |
329 | if (onComplete) {
330 | onComplete();
331 | }
332 | }
333 | };
334 |
335 | Spec.prototype.onException = function onException(e) {
336 | if (Spec.isPendingSpecException(e)) {
337 | this.pend();
338 | return;
339 | }
340 |
341 | this.addExpectationResult(false, {
342 | matcherName: '',
343 | passed: false,
344 | expected: '',
345 | actual: '',
346 | error: e
347 | });
348 | };
349 |
350 | Spec.prototype.disable = function() {
351 | this.disabled = true;
352 | };
353 |
354 | Spec.prototype.pend = function() {
355 | this.markedPending = true;
356 | };
357 |
358 | Spec.prototype.status = function() {
359 | if (this.disabled) {
360 | return 'disabled';
361 | }
362 |
363 | if (this.markedPending) {
364 | return 'pending';
365 | }
366 |
367 | if (this.result.failedExpectations.length > 0) {
368 | return 'failed';
369 | } else {
370 | return 'passed';
371 | }
372 | };
373 |
374 | Spec.prototype.isExecutable = function() {
375 | return !this.disabled && !this.markedPending;
376 | };
377 |
378 | Spec.prototype.getFullName = function() {
379 | return this.getSpecName(this);
380 | };
381 |
382 | Spec.pendingSpecExceptionMessage = '=> marked Pending';
383 |
384 | Spec.isPendingSpecException = function(e) {
385 | return !!(e && e.toString && e.toString().indexOf(Spec.pendingSpecExceptionMessage) !== -1);
386 | };
387 |
388 | return Spec;
389 | };
390 |
391 | if (typeof window == void 0 && typeof exports == 'object') {
392 | exports.Spec = jasmineRequire.Spec;
393 | }
394 |
395 | getJasmineRequireObj().Env = function(j$) {
396 | function Env(options) {
397 | options = options || {};
398 |
399 | var self = this;
400 | var global = options.global || j$.getGlobal();
401 |
402 | var totalSpecsDefined = 0;
403 |
404 | var catchExceptions = true;
405 |
406 | var realSetTimeout = j$.getGlobal().setTimeout;
407 | var realClearTimeout = j$.getGlobal().clearTimeout;
408 | this.clock = new j$.Clock(global, new j$.DelayedFunctionScheduler(), new j$.MockDate(global));
409 |
410 | var runnableLookupTable = {};
411 | var runnableResources = {};
412 |
413 | var currentSpec = null;
414 | var currentlyExecutingSuites = [];
415 | var currentDeclarationSuite = null;
416 |
417 | var currentSuite = function() {
418 | return currentlyExecutingSuites[currentlyExecutingSuites.length - 1];
419 | };
420 |
421 | var currentRunnable = function() {
422 | return currentSpec || currentSuite();
423 | };
424 |
425 | var reporter = new j$.ReportDispatcher([
426 | 'jasmineStarted',
427 | 'jasmineDone',
428 | 'suiteStarted',
429 | 'suiteDone',
430 | 'specStarted',
431 | 'specDone'
432 | ]);
433 |
434 | this.specFilter = function() {
435 | return true;
436 | };
437 |
438 | this.addCustomEqualityTester = function(tester) {
439 | if(!currentRunnable()) {
440 | throw new Error('Custom Equalities must be added in a before function or a spec');
441 | }
442 | runnableResources[currentRunnable().id].customEqualityTesters.push(tester);
443 | };
444 |
445 | this.addMatchers = function(matchersToAdd) {
446 | if(!currentRunnable()) {
447 | throw new Error('Matchers must be added in a before function or a spec');
448 | }
449 | var customMatchers = runnableResources[currentRunnable().id].customMatchers;
450 | for (var matcherName in matchersToAdd) {
451 | customMatchers[matcherName] = matchersToAdd[matcherName];
452 | }
453 | };
454 |
455 | j$.Expectation.addCoreMatchers(j$.matchers);
456 |
457 | var nextSpecId = 0;
458 | var getNextSpecId = function() {
459 | return 'spec' + nextSpecId++;
460 | };
461 |
462 | var nextSuiteId = 0;
463 | var getNextSuiteId = function() {
464 | return 'suite' + nextSuiteId++;
465 | };
466 |
467 | var expectationFactory = function(actual, spec) {
468 | return j$.Expectation.Factory({
469 | util: j$.matchersUtil,
470 | customEqualityTesters: runnableResources[spec.id].customEqualityTesters,
471 | customMatchers: runnableResources[spec.id].customMatchers,
472 | actual: actual,
473 | addExpectationResult: addExpectationResult
474 | });
475 |
476 | function addExpectationResult(passed, result) {
477 | return spec.addExpectationResult(passed, result);
478 | }
479 | };
480 |
481 | var defaultResourcesForRunnable = function(id, parentRunnableId) {
482 | var resources = {spies: [], customEqualityTesters: [], customMatchers: {}};
483 |
484 | if(runnableResources[parentRunnableId]){
485 | resources.customEqualityTesters = j$.util.clone(runnableResources[parentRunnableId].customEqualityTesters);
486 | resources.customMatchers = j$.util.clone(runnableResources[parentRunnableId].customMatchers);
487 | }
488 |
489 | runnableResources[id] = resources;
490 | };
491 |
492 | var clearResourcesForRunnable = function(id) {
493 | spyRegistry.clearSpies();
494 | delete runnableResources[id];
495 | };
496 |
497 | var beforeAndAfterFns = function(suite, runnablesExplictlySet) {
498 | return function() {
499 | var befores = [],
500 | afters = [],
501 | beforeAlls = [],
502 | afterAlls = [];
503 |
504 | while(suite) {
505 | befores = befores.concat(suite.beforeFns);
506 | afters = afters.concat(suite.afterFns);
507 |
508 | if (runnablesExplictlySet()) {
509 | beforeAlls = beforeAlls.concat(suite.beforeAllFns);
510 | afterAlls = afterAlls.concat(suite.afterAllFns);
511 | }
512 |
513 | suite = suite.parentSuite;
514 | }
515 | return {
516 | befores: beforeAlls.reverse().concat(befores.reverse()),
517 | afters: afters.concat(afterAlls)
518 | };
519 | };
520 | };
521 |
522 | var getSpecName = function(spec, suite) {
523 | return suite.getFullName() + ' ' + spec.description;
524 | };
525 |
526 | // TODO: we may just be able to pass in the fn instead of wrapping here
527 | var buildExpectationResult = j$.buildExpectationResult,
528 | exceptionFormatter = new j$.ExceptionFormatter(),
529 | expectationResultFactory = function(attrs) {
530 | attrs.messageFormatter = exceptionFormatter.message;
531 | attrs.stackFormatter = exceptionFormatter.stack;
532 |
533 | return buildExpectationResult(attrs);
534 | };
535 |
536 | // TODO: fix this naming, and here's where the value comes in
537 | this.catchExceptions = function(value) {
538 | catchExceptions = !!value;
539 | return catchExceptions;
540 | };
541 |
542 | this.catchingExceptions = function() {
543 | return catchExceptions;
544 | };
545 |
546 | var maximumSpecCallbackDepth = 20;
547 | var currentSpecCallbackDepth = 0;
548 |
549 | function clearStack(fn) {
550 | currentSpecCallbackDepth++;
551 | if (currentSpecCallbackDepth >= maximumSpecCallbackDepth) {
552 | currentSpecCallbackDepth = 0;
553 | realSetTimeout(fn, 0);
554 | } else {
555 | fn();
556 | }
557 | }
558 |
559 | var catchException = function(e) {
560 | return j$.Spec.isPendingSpecException(e) || catchExceptions;
561 | };
562 |
563 | var queueRunnerFactory = function(options) {
564 | options.catchException = catchException;
565 | options.clearStack = options.clearStack || clearStack;
566 | options.timer = {setTimeout: realSetTimeout, clearTimeout: realClearTimeout};
567 | options.fail = self.fail;
568 |
569 | new j$.QueueRunner(options).execute();
570 | };
571 |
572 | var topSuite = new j$.Suite({
573 | env: this,
574 | id: getNextSuiteId(),
575 | description: 'Jasmine__TopLevel__Suite',
576 | queueRunner: queueRunnerFactory
577 | });
578 | runnableLookupTable[topSuite.id] = topSuite;
579 | defaultResourcesForRunnable(topSuite.id);
580 | currentDeclarationSuite = topSuite;
581 |
582 | this.topSuite = function() {
583 | return topSuite;
584 | };
585 |
586 | this.execute = function(runnablesToRun) {
587 | if(runnablesToRun) {
588 | runnablesExplictlySet = true;
589 | } else if (focusedRunnables.length) {
590 | runnablesExplictlySet = true;
591 | runnablesToRun = focusedRunnables;
592 | } else {
593 | runnablesToRun = [topSuite.id];
594 | }
595 |
596 | var allFns = [];
597 | for(var i = 0; i < runnablesToRun.length; i++) {
598 | var runnable = runnableLookupTable[runnablesToRun[i]];
599 | allFns.push((function(runnable) { return { fn: function(done) { runnable.execute(done); } }; })(runnable));
600 | }
601 |
602 | reporter.jasmineStarted({
603 | totalSpecsDefined: totalSpecsDefined
604 | });
605 |
606 | queueRunnerFactory({queueableFns: allFns, onComplete: reporter.jasmineDone});
607 | };
608 |
609 | this.addReporter = function(reporterToAdd) {
610 | reporter.addReporter(reporterToAdd);
611 | };
612 |
613 | var spyRegistry = new j$.SpyRegistry({currentSpies: function() {
614 | if(!currentRunnable()) {
615 | throw new Error('Spies must be created in a before function or a spec');
616 | }
617 | return runnableResources[currentRunnable().id].spies;
618 | }});
619 |
620 | this.spyOn = function() {
621 | return spyRegistry.spyOn.apply(spyRegistry, arguments);
622 | };
623 |
624 | var suiteFactory = function(description) {
625 | var suite = new j$.Suite({
626 | env: self,
627 | id: getNextSuiteId(),
628 | description: description,
629 | parentSuite: currentDeclarationSuite,
630 | queueRunner: queueRunnerFactory,
631 | onStart: suiteStarted,
632 | expectationFactory: expectationFactory,
633 | expectationResultFactory: expectationResultFactory,
634 | resultCallback: function(attrs) {
635 | if (!suite.disabled) {
636 | clearResourcesForRunnable(suite.id);
637 | currentlyExecutingSuites.pop();
638 | }
639 | reporter.suiteDone(attrs);
640 | }
641 | });
642 |
643 | runnableLookupTable[suite.id] = suite;
644 | return suite;
645 |
646 | function suiteStarted(suite) {
647 | currentlyExecutingSuites.push(suite);
648 | defaultResourcesForRunnable(suite.id, suite.parentSuite.id);
649 | reporter.suiteStarted(suite.result);
650 | }
651 | };
652 |
653 | this.describe = function(description, specDefinitions) {
654 | var suite = suiteFactory(description);
655 | addSpecsToSuite(suite, specDefinitions);
656 | return suite;
657 | };
658 |
659 | this.xdescribe = function(description, specDefinitions) {
660 | var suite = this.describe(description, specDefinitions);
661 | suite.disable();
662 | return suite;
663 | };
664 |
665 | var focusedRunnables = [];
666 |
667 | this.fdescribe = function(description, specDefinitions) {
668 | var suite = suiteFactory(description);
669 | suite.isFocused = true;
670 |
671 | focusedRunnables.push(suite.id);
672 | unfocusAncestor();
673 | addSpecsToSuite(suite, specDefinitions);
674 |
675 | return suite;
676 | };
677 |
678 | function addSpecsToSuite(suite, specDefinitions) {
679 | var parentSuite = currentDeclarationSuite;
680 | parentSuite.addChild(suite);
681 | currentDeclarationSuite = suite;
682 |
683 | var declarationError = null;
684 | try {
685 | specDefinitions.call(suite);
686 | } catch (e) {
687 | declarationError = e;
688 | }
689 |
690 | if (declarationError) {
691 | self.it('encountered a declaration exception', function() {
692 | throw declarationError;
693 | });
694 | }
695 |
696 | currentDeclarationSuite = parentSuite;
697 | }
698 |
699 | function findFocusedAncestor(suite) {
700 | while (suite) {
701 | if (suite.isFocused) {
702 | return suite.id;
703 | }
704 | suite = suite.parentSuite;
705 | }
706 |
707 | return null;
708 | }
709 |
710 | function unfocusAncestor() {
711 | var focusedAncestor = findFocusedAncestor(currentDeclarationSuite);
712 | if (focusedAncestor) {
713 | for (var i = 0; i < focusedRunnables.length; i++) {
714 | if (focusedRunnables[i] === focusedAncestor) {
715 | focusedRunnables.splice(i, 1);
716 | break;
717 | }
718 | }
719 | }
720 | }
721 |
722 | var runnablesExplictlySet = false;
723 |
724 | var runnablesExplictlySetGetter = function(){
725 | return runnablesExplictlySet;
726 | };
727 |
728 | var specFactory = function(description, fn, suite, timeout) {
729 | totalSpecsDefined++;
730 | var spec = new j$.Spec({
731 | id: getNextSpecId(),
732 | beforeAndAfterFns: beforeAndAfterFns(suite, runnablesExplictlySetGetter),
733 | expectationFactory: expectationFactory,
734 | resultCallback: specResultCallback,
735 | getSpecName: function(spec) {
736 | return getSpecName(spec, suite);
737 | },
738 | onStart: specStarted,
739 | description: description,
740 | expectationResultFactory: expectationResultFactory,
741 | queueRunnerFactory: queueRunnerFactory,
742 | userContext: function() { return suite.clonedSharedUserContext(); },
743 | queueableFn: {
744 | fn: fn,
745 | timeout: function() { return timeout || j$.DEFAULT_TIMEOUT_INTERVAL; }
746 | }
747 | });
748 |
749 | runnableLookupTable[spec.id] = spec;
750 |
751 | if (!self.specFilter(spec)) {
752 | spec.disable();
753 | }
754 |
755 | return spec;
756 |
757 | function specResultCallback(result) {
758 | clearResourcesForRunnable(spec.id);
759 | currentSpec = null;
760 | reporter.specDone(result);
761 | }
762 |
763 | function specStarted(spec) {
764 | currentSpec = spec;
765 | defaultResourcesForRunnable(spec.id, suite.id);
766 | reporter.specStarted(spec.result);
767 | }
768 | };
769 |
770 | this.it = function(description, fn, timeout) {
771 | var spec = specFactory(description, fn, currentDeclarationSuite, timeout);
772 | currentDeclarationSuite.addChild(spec);
773 | return spec;
774 | };
775 |
776 | this.xit = function() {
777 | var spec = this.it.apply(this, arguments);
778 | spec.pend();
779 | return spec;
780 | };
781 |
782 | this.fit = function(){
783 | var spec = this.it.apply(this, arguments);
784 |
785 | focusedRunnables.push(spec.id);
786 | unfocusAncestor();
787 | return spec;
788 | };
789 |
790 | this.expect = function(actual) {
791 | if (!currentRunnable()) {
792 | throw new Error('\'expect\' was used when there was no current spec, this could be because an asynchronous test timed out');
793 | }
794 |
795 | return currentRunnable().expect(actual);
796 | };
797 |
798 | this.beforeEach = function(beforeEachFunction, timeout) {
799 | currentDeclarationSuite.beforeEach({
800 | fn: beforeEachFunction,
801 | timeout: function() { return timeout || j$.DEFAULT_TIMEOUT_INTERVAL; }
802 | });
803 | };
804 |
805 | this.beforeAll = function(beforeAllFunction, timeout) {
806 | currentDeclarationSuite.beforeAll({
807 | fn: beforeAllFunction,
808 | timeout: function() { return timeout || j$.DEFAULT_TIMEOUT_INTERVAL; }
809 | });
810 | };
811 |
812 | this.afterEach = function(afterEachFunction, timeout) {
813 | currentDeclarationSuite.afterEach({
814 | fn: afterEachFunction,
815 | timeout: function() { return timeout || j$.DEFAULT_TIMEOUT_INTERVAL; }
816 | });
817 | };
818 |
819 | this.afterAll = function(afterAllFunction, timeout) {
820 | currentDeclarationSuite.afterAll({
821 | fn: afterAllFunction,
822 | timeout: function() { return timeout || j$.DEFAULT_TIMEOUT_INTERVAL; }
823 | });
824 | };
825 |
826 | this.pending = function() {
827 | throw j$.Spec.pendingSpecExceptionMessage;
828 | };
829 |
830 | this.fail = function(error) {
831 | var message = 'Failed';
832 | if (error) {
833 | message += ': ';
834 | message += error.message || error;
835 | }
836 |
837 | currentRunnable().addExpectationResult(false, {
838 | matcherName: '',
839 | passed: false,
840 | expected: '',
841 | actual: '',
842 | message: message
843 | });
844 | };
845 | }
846 |
847 | return Env;
848 | };
849 |
850 | getJasmineRequireObj().JsApiReporter = function() {
851 |
852 | var noopTimer = {
853 | start: function(){},
854 | elapsed: function(){ return 0; }
855 | };
856 |
857 | function JsApiReporter(options) {
858 | var timer = options.timer || noopTimer,
859 | status = 'loaded';
860 |
861 | this.started = false;
862 | this.finished = false;
863 |
864 | this.jasmineStarted = function() {
865 | this.started = true;
866 | status = 'started';
867 | timer.start();
868 | };
869 |
870 | var executionTime;
871 |
872 | this.jasmineDone = function() {
873 | this.finished = true;
874 | executionTime = timer.elapsed();
875 | status = 'done';
876 | };
877 |
878 | this.status = function() {
879 | return status;
880 | };
881 |
882 | var suites = [],
883 | suites_hash = {};
884 |
885 | this.suiteStarted = function(result) {
886 | suites_hash[result.id] = result;
887 | };
888 |
889 | this.suiteDone = function(result) {
890 | storeSuite(result);
891 | };
892 |
893 | this.suiteResults = function(index, length) {
894 | return suites.slice(index, index + length);
895 | };
896 |
897 | function storeSuite(result) {
898 | suites.push(result);
899 | suites_hash[result.id] = result;
900 | }
901 |
902 | this.suites = function() {
903 | return suites_hash;
904 | };
905 |
906 | var specs = [];
907 |
908 | this.specDone = function(result) {
909 | specs.push(result);
910 | };
911 |
912 | this.specResults = function(index, length) {
913 | return specs.slice(index, index + length);
914 | };
915 |
916 | this.specs = function() {
917 | return specs;
918 | };
919 |
920 | this.executionTime = function() {
921 | return executionTime;
922 | };
923 |
924 | }
925 |
926 | return JsApiReporter;
927 | };
928 |
929 | getJasmineRequireObj().Any = function() {
930 |
931 | function Any(expectedObject) {
932 | this.expectedObject = expectedObject;
933 | }
934 |
935 | Any.prototype.jasmineMatches = function(other) {
936 | if (this.expectedObject == String) {
937 | return typeof other == 'string' || other instanceof String;
938 | }
939 |
940 | if (this.expectedObject == Number) {
941 | return typeof other == 'number' || other instanceof Number;
942 | }
943 |
944 | if (this.expectedObject == Function) {
945 | return typeof other == 'function' || other instanceof Function;
946 | }
947 |
948 | if (this.expectedObject == Object) {
949 | return typeof other == 'object';
950 | }
951 |
952 | if (this.expectedObject == Boolean) {
953 | return typeof other == 'boolean';
954 | }
955 |
956 | return other instanceof this.expectedObject;
957 | };
958 |
959 | Any.prototype.jasmineToString = function() {
960 | return '