annotate src/DML/MainVisBundle/Resources/assets/jasmine/boot.js @ 0:493bcb69166c

added public content
author Daniel Wolff
date Tue, 09 Feb 2016 20:54:02 +0100
parents
children
rev   line source
Daniel@0 1 /**
Daniel@0 2 * This file was created based on the original jasmine's boot.js (v2.1.3)
Daniel@0 3 */
Daniel@0 4 (function() {
Daniel@0 5
Daniel@0 6 /**
Daniel@0 7 * ## Require & Instantiate
Daniel@0 8 *
Daniel@0 9 * Require Jasmine's core files. Specifically, this requires and attaches all of Jasmine's code to the `jasmine` reference.
Daniel@0 10 */
Daniel@0 11 window.jasmine = jasmineRequire.core(jasmineRequire);
Daniel@0 12
Daniel@0 13 /**
Daniel@0 14 * Since this is being run in a browser and the results should populate to an HTML page, require the HTML-specific Jasmine code, injecting the same reference.
Daniel@0 15 */
Daniel@0 16 jasmineRequire.html(jasmine);
Daniel@0 17
Daniel@0 18 /**
Daniel@0 19 * Create the Jasmine environment. This is used to run all specs in a project.
Daniel@0 20 */
Daniel@0 21 var env = jasmine.getEnv();
Daniel@0 22
Daniel@0 23 /**
Daniel@0 24 * ## The Global Interface
Daniel@0 25 *
Daniel@0 26 * Build up the functions that will be exposed as the Jasmine public interface. A project can customize, rename or alias any of these functions as desired, provided the implementation remains unchanged.
Daniel@0 27 */
Daniel@0 28 var jasmineInterface = jasmineRequire.interface(jasmine, env);
Daniel@0 29
Daniel@0 30 /**
Daniel@0 31 * Add all of the Jasmine global/public interface to the proper global, so a project can use the public interface directly. For example, calling `describe` in specs instead of `jasmine.getEnv().describe`.
Daniel@0 32 */
Daniel@0 33 if (typeof window == "undefined" && typeof exports == "object") {
Daniel@0 34 extend(exports, jasmineInterface);
Daniel@0 35 } else {
Daniel@0 36 extend(window, jasmineInterface);
Daniel@0 37 }
Daniel@0 38
Daniel@0 39 /**
Daniel@0 40 * ## Runner Parameters
Daniel@0 41 *
Daniel@0 42 * More browser specific code - wrap the query string in an object and to allow for getting/setting parameters from the runner user interface.
Daniel@0 43 */
Daniel@0 44
Daniel@0 45 var queryString = new jasmine.QueryString({
Daniel@0 46 getWindowLocation: function() { return window.location; }
Daniel@0 47 });
Daniel@0 48
Daniel@0 49 var catchingExceptions = queryString.getParam("catch");
Daniel@0 50 env.catchExceptions(typeof catchingExceptions === "undefined" ? true : catchingExceptions);
Daniel@0 51
Daniel@0 52 /**
Daniel@0 53 * ## Reporters
Daniel@0 54 * The `HtmlReporter` builds all of the HTML UI for the runner page. This reporter paints the dots, stars, and x's for specs, as well as all spec names and all failures (if any).
Daniel@0 55 */
Daniel@0 56 var htmlReporter = new jasmine.HtmlReporter({
Daniel@0 57 env: env,
Daniel@0 58 onRaiseExceptionsClick: function() { queryString.setParam("catch", !env.catchingExceptions()); },
Daniel@0 59 getContainer: function() { return $(".jasmine").get(0); },
Daniel@0 60 // getContainer: function() { return document.body; },
Daniel@0 61 createElement: function() { return document.createElement.apply(document, arguments); },
Daniel@0 62 createTextNode: function() { return document.createTextNode.apply(document, arguments); },
Daniel@0 63 timer: new jasmine.Timer()
Daniel@0 64 });
Daniel@0 65
Daniel@0 66 /**
Daniel@0 67 * The `jsApiReporter` also receives spec results, and is used by any environment that needs to extract the results from JavaScript.
Daniel@0 68 */
Daniel@0 69 env.addReporter(jasmineInterface.jsApiReporter);
Daniel@0 70 env.addReporter(htmlReporter);
Daniel@0 71
Daniel@0 72 /**
Daniel@0 73 * Filter which specs will be run by matching the start of the full name against the `spec` query param.
Daniel@0 74 */
Daniel@0 75 var specFilter = new jasmine.HtmlSpecFilter({
Daniel@0 76 // MODIFIED
Daniel@0 77 // filterString: function() { return queryString.getParam("jasmine"); }
Daniel@0 78 filterString: function() { return queryString.getParam("jasmine") == "undefined" ? undefined : queryString.getParam("jasmine") }
Daniel@0 79 });
Daniel@0 80
Daniel@0 81 env.specFilter = function(spec) {
Daniel@0 82 return specFilter.matches(spec.getFullName());
Daniel@0 83 };
Daniel@0 84
Daniel@0 85 /**
Daniel@0 86 * Setting up timing functions to be able to be overridden. Certain browsers (Safari, IE 8, phantomjs) require this hack.
Daniel@0 87 */
Daniel@0 88 window.setTimeout = window.setTimeout;
Daniel@0 89 window.setInterval = window.setInterval;
Daniel@0 90 window.clearTimeout = window.clearTimeout;
Daniel@0 91 window.clearInterval = window.clearInterval;
Daniel@0 92
Daniel@0 93 /**
Daniel@0 94 * ## Execution
Daniel@0 95 *
Daniel@0 96 * Replace the browser window's `onload`, ensure it's called, and then run all of the loaded specs. This includes initializing the `HtmlReporter` instance and then executing the loaded Jasmine environment. All of this will happen after all of the specs are loaded.
Daniel@0 97 */
Daniel@0 98 //MODIFIED
Daniel@0 99 window.executeJasmine = function() {
Daniel@0 100 htmlReporter.initialize();
Daniel@0 101 env.execute();
Daniel@0 102 }
Daniel@0 103 //var currentWindowOnload = window.onload;
Daniel@0 104
Daniel@0 105 //MODIFIED
Daniel@0 106 //window.onload = function() {
Daniel@0 107 // if (currentWindowOnload) {
Daniel@0 108 // currentWindowOnload();
Daniel@0 109 // }
Daniel@0 110 // console.log("JASM");
Daniel@0 111 //};
Daniel@0 112
Daniel@0 113 /**
Daniel@0 114 * Helper function for readability above.
Daniel@0 115 */
Daniel@0 116 function extend(destination, source) {
Daniel@0 117 for (var property in source) destination[property] = source[property];
Daniel@0 118 return destination;
Daniel@0 119 }
Daniel@0 120
Daniel@0 121 }());