Daniel@0: /** Daniel@0: * This file was created based on the original jasmine's boot.js (v2.1.3) Daniel@0: */ Daniel@0: (function() { Daniel@0: Daniel@0: /** Daniel@0: * ## Require & Instantiate Daniel@0: * Daniel@0: * Require Jasmine's core files. Specifically, this requires and attaches all of Jasmine's code to the `jasmine` reference. Daniel@0: */ Daniel@0: window.jasmine = jasmineRequire.core(jasmineRequire); Daniel@0: Daniel@0: /** Daniel@0: * 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: */ Daniel@0: jasmineRequire.html(jasmine); Daniel@0: Daniel@0: /** Daniel@0: * Create the Jasmine environment. This is used to run all specs in a project. Daniel@0: */ Daniel@0: var env = jasmine.getEnv(); Daniel@0: Daniel@0: /** Daniel@0: * ## The Global Interface Daniel@0: * Daniel@0: * 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: */ Daniel@0: var jasmineInterface = jasmineRequire.interface(jasmine, env); Daniel@0: Daniel@0: /** Daniel@0: * 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: */ Daniel@0: if (typeof window == "undefined" && typeof exports == "object") { Daniel@0: extend(exports, jasmineInterface); Daniel@0: } else { Daniel@0: extend(window, jasmineInterface); Daniel@0: } Daniel@0: Daniel@0: /** Daniel@0: * ## Runner Parameters Daniel@0: * Daniel@0: * 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: */ Daniel@0: Daniel@0: var queryString = new jasmine.QueryString({ Daniel@0: getWindowLocation: function() { return window.location; } Daniel@0: }); Daniel@0: Daniel@0: var catchingExceptions = queryString.getParam("catch"); Daniel@0: env.catchExceptions(typeof catchingExceptions === "undefined" ? true : catchingExceptions); Daniel@0: Daniel@0: /** Daniel@0: * ## Reporters Daniel@0: * 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: */ Daniel@0: var htmlReporter = new jasmine.HtmlReporter({ Daniel@0: env: env, Daniel@0: onRaiseExceptionsClick: function() { queryString.setParam("catch", !env.catchingExceptions()); }, Daniel@0: getContainer: function() { return $(".jasmine").get(0); }, Daniel@0: // getContainer: function() { return document.body; }, Daniel@0: createElement: function() { return document.createElement.apply(document, arguments); }, Daniel@0: createTextNode: function() { return document.createTextNode.apply(document, arguments); }, Daniel@0: timer: new jasmine.Timer() Daniel@0: }); Daniel@0: Daniel@0: /** Daniel@0: * The `jsApiReporter` also receives spec results, and is used by any environment that needs to extract the results from JavaScript. Daniel@0: */ Daniel@0: env.addReporter(jasmineInterface.jsApiReporter); Daniel@0: env.addReporter(htmlReporter); Daniel@0: Daniel@0: /** Daniel@0: * Filter which specs will be run by matching the start of the full name against the `spec` query param. Daniel@0: */ Daniel@0: var specFilter = new jasmine.HtmlSpecFilter({ Daniel@0: // MODIFIED Daniel@0: // filterString: function() { return queryString.getParam("jasmine"); } Daniel@0: filterString: function() { return queryString.getParam("jasmine") == "undefined" ? undefined : queryString.getParam("jasmine") } Daniel@0: }); Daniel@0: Daniel@0: env.specFilter = function(spec) { Daniel@0: return specFilter.matches(spec.getFullName()); Daniel@0: }; Daniel@0: Daniel@0: /** Daniel@0: * Setting up timing functions to be able to be overridden. Certain browsers (Safari, IE 8, phantomjs) require this hack. Daniel@0: */ Daniel@0: window.setTimeout = window.setTimeout; Daniel@0: window.setInterval = window.setInterval; Daniel@0: window.clearTimeout = window.clearTimeout; Daniel@0: window.clearInterval = window.clearInterval; Daniel@0: Daniel@0: /** Daniel@0: * ## Execution Daniel@0: * Daniel@0: * 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: */ Daniel@0: //MODIFIED Daniel@0: window.executeJasmine = function() { Daniel@0: htmlReporter.initialize(); Daniel@0: env.execute(); Daniel@0: } Daniel@0: //var currentWindowOnload = window.onload; Daniel@0: Daniel@0: //MODIFIED Daniel@0: //window.onload = function() { Daniel@0: // if (currentWindowOnload) { Daniel@0: // currentWindowOnload(); Daniel@0: // } Daniel@0: // console.log("JASM"); Daniel@0: //}; Daniel@0: Daniel@0: /** Daniel@0: * Helper function for readability above. Daniel@0: */ Daniel@0: function extend(destination, source) { Daniel@0: for (var property in source) destination[property] = source[property]; Daniel@0: return destination; Daniel@0: } Daniel@0: Daniel@0: }());