|
<!DOCTYPE html> |
|
<html> |
|
|
|
<head> |
|
<link rel="stylesheet" type="text/css" href="https://thimble.mozilla.org/tutorial/tutorial.css"> |
|
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/jasmine/3.4.0/jasmine.css"> |
|
<script src="https://www.stemcstudio.com:/vendor/[email protected]/domready.js"></script> |
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/jasmine/3.4.0/jasmine.min.js"></script> |
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/jasmine/3.4.0/jasmine-html.min.js"></script> |
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/stats.js/r16/Stats.min.js"></script> |
|
<script src="https://unpkg.com/[email protected]/dist/system.js"></script> |
|
</head> |
|
|
|
<body> |
|
<script> |
|
System.config({ |
|
"warnings": false, |
|
"map": { |
|
"davinci-eight": "https://unpkg.com/[email protected]/build/browser/index.js" |
|
} |
|
}); |
|
</script> |
|
<div class="tutorial"> |
|
<h1>STEMCstudio Tutorial</h1> |
|
<p> |
|
Edit this tutorial to provide step-by-step instructions to people remixing your project, including those who might be doing it on their own (without a mentor/facilitator/teacher). They will be able to toggle between the Preview pane and this Tutorial. Replace this section with an overview or some background about your project. |
|
</p> |
|
<p> |
|
Check out the <a href="https://thimble.mozilla.org/tutorial/tutorial-style-guide.html" target="_blank">style guide</a> for HTML elements you can include. |
|
</p> |
|
|
|
<h3>Step-by-Step Instructions</h3> |
|
<ol class="steps"> |
|
<li> |
|
Add your first step here. |
|
</li> |
|
<li> |
|
Add your second step here. |
|
</li> |
|
<li> |
|
Add your third step here, and add more steps if needed. |
|
</li> |
|
<li> |
|
Add a note of congratulations for completing the project and remixing the Web! Note any specific instructions for where to share the completed project if appropriate (e.g. Twitter hashtag, email to teacher, etc.) |
|
</li> |
|
</ol> |
|
<pre class="code"> const x = 27; |
|
export default function(x: number, y: number) { |
|
const that = { |
|
}; |
|
return that; |
|
} |
|
</pre> |
|
</div> |
|
|
|
<script> |
|
System.register('./Example.spec.js', [], function (exports_1, context_1) { |
|
'use strict'; |
|
var __moduleName = context_1 && context_1.id; |
|
function default_1() { |
|
describe('...', function () { |
|
it('should ...', function () { |
|
expect(true).toBeTruthy(); |
|
}); |
|
}); |
|
} |
|
exports_1('default', default_1); |
|
return { |
|
setters: [], |
|
execute: function () { |
|
} |
|
}; |
|
}); |
|
System.register('./index.js', ['davinci-eight'], function (exports_1, context_1) { |
|
'use strict'; |
|
var EIGHT, engine, scene, ambients, camera, dirLight, trackball, body, stats, animate; |
|
var __moduleName = context_1 && context_1.id; |
|
return { |
|
setters: [function (EIGHT_1) { |
|
EIGHT = EIGHT_1; |
|
}], |
|
execute: function () { |
|
engine = new EIGHT.Engine('canvas').size(500, 500).clearColor(0.1, 0.1, 0.1, 1).enable(EIGHT.Capability.DEPTH_TEST); |
|
scene = new EIGHT.Scene(engine); |
|
ambients = []; |
|
camera = new EIGHT.PerspectiveCamera(); |
|
camera.eye.scale(5); |
|
ambients.push(camera); |
|
dirLight = new EIGHT.DirectionalLight(); |
|
ambients.push(dirLight); |
|
trackball = new EIGHT.TrackballControls(camera, window); |
|
trackball.subscribe(engine.canvas); |
|
trackball.noPan = true; |
|
body = new EIGHT.Box(engine, { color: EIGHT.Color.blueviolet }); |
|
scene.add(body); |
|
stats = new Stats(); |
|
document.body.appendChild(stats.domElement); |
|
animate = function (_timestamp) { |
|
stats.begin(); |
|
engine.clear(); |
|
trackball.update(); |
|
dirLight.direction.copy(camera.look).sub(camera.eye); |
|
scene.render(ambients); |
|
stats.end(); |
|
requestAnimationFrame(animate); |
|
}; |
|
requestAnimationFrame(animate); |
|
} |
|
}; |
|
}); |
|
System.register('./tests.spec.js', [], function (exports_1, context_1) { |
|
'use strict'; |
|
var __moduleName = context_1 && context_1.id; |
|
function spec() { |
|
describe('example', function () { |
|
it('should pass', function () { |
|
expect(true).toBeTruthy(); |
|
}); |
|
}); |
|
} |
|
exports_1('spec', spec); |
|
return { |
|
setters: [], |
|
execute: function () { |
|
} |
|
}; |
|
}); |
|
System.register('./tests.js', ['./tests.spec.js'], function (exports_1, context_1) { |
|
'use strict'; |
|
var tests_spec_1, HtmlReporter, config, specifications; |
|
var __moduleName = context_1 && context_1.id; |
|
function getContainer() { |
|
var element = document.body; |
|
return element; |
|
} |
|
function onChangeOption(key, value) { |
|
switch (key) { |
|
case 'failFast': { |
|
config.failFast = !config.failFast; |
|
break; |
|
} |
|
case 'throwFailures': { |
|
config.oneFailurePerSpec = !config.oneFailurePerSpec; |
|
break; |
|
} |
|
case 'random': { |
|
config.random = !config.random; |
|
break; |
|
} |
|
case 'hideDisabled': { |
|
config.hideDisabled = !config.hideDisabled; |
|
break; |
|
} |
|
default: { |
|
console.warn('navigateWithNewParam(key=' + key + ', value=' + JSON.stringify(value)); |
|
} |
|
} |
|
runTests(); |
|
} |
|
function addSpec(value) { |
|
specifications.push(value); |
|
return ''; |
|
} |
|
function addSeed(_seed) { |
|
return ''; |
|
} |
|
function runTests() { |
|
var jasmineCore = jasmineRequire.core(jasmineRequire); |
|
jasmineRequire.html(jasmineCore); |
|
var env = jasmineCore.getEnv(); |
|
var jasmineInterface = jasmineRequire.interface(jasmineCore, env); |
|
extend(window, jasmineInterface); |
|
var htmlReporter = new HtmlReporter({ |
|
env: env, |
|
addToExistingQueryString: function (key, value) { |
|
switch (key) { |
|
case 'spec': { |
|
return addSpec(value); |
|
break; |
|
} |
|
case 'seed': { |
|
return addSeed(parseInt(value, 10)); |
|
break; |
|
} |
|
default: { |
|
throw new Error('Unknown key: ' + key); |
|
} |
|
} |
|
}, |
|
navigateWithNewParam: onChangeOption, |
|
getContainer: getContainer, |
|
createElement: function () { |
|
return document.createElement.apply(document, arguments); |
|
}, |
|
createTextNode: function () { |
|
return document.createTextNode.apply(document, arguments); |
|
}, |
|
timer: new jasmine.Timer(), |
|
filterSpecs: true |
|
}); |
|
env.addReporter(jasmineInterface.jsApiReporter); |
|
env.addReporter(htmlReporter); |
|
env.configure(config); |
|
htmlReporter.initialize(); |
|
describe('spec', tests_spec_1.spec); |
|
env.execute(); |
|
} |
|
function extend(destination, source) { |
|
for (var property in source) { |
|
if (source.hasOwnProperty(property)) { |
|
destination[property] = source[property]; |
|
} |
|
} |
|
return destination; |
|
} |
|
return { |
|
setters: [function (tests_spec_1_1) { |
|
tests_spec_1 = tests_spec_1_1; |
|
}], |
|
execute: function () { |
|
HtmlReporter = function () { |
|
var ResultsNode = function () { |
|
function ResultsNode(result, type, parent) { |
|
this.result = result; |
|
this.type = type; |
|
this.parent = parent; |
|
this.children = []; |
|
} |
|
ResultsNode.prototype.addChild = function (result, type) { |
|
this.children.push(new ResultsNode(result, type, this)); |
|
}; |
|
ResultsNode.prototype.last = function () { |
|
return this.children[this.children.length - 1]; |
|
}; |
|
ResultsNode.prototype.updateResult = function (result) { |
|
this.result = result; |
|
}; |
|
return ResultsNode; |
|
}(); |
|
var ResultsStateBuilder = function () { |
|
function ResultsStateBuilder() { |
|
this.topResults = new ResultsNode({ description: '' }, 'suite', null); |
|
this.currentParent = this.topResults; |
|
this.specsExecuted = 0; |
|
this.failureCount = 0; |
|
this.pendingSpecCount = 0; |
|
} |
|
ResultsStateBuilder.prototype.suiteStarted = function (result) { |
|
this.currentParent.addChild(result, 'suite'); |
|
this.currentParent = this.currentParent.last(); |
|
}; |
|
ResultsStateBuilder.prototype.suiteDone = function (result) { |
|
this.currentParent.updateResult(result); |
|
if (this.currentParent !== this.topResults) { |
|
this.currentParent = this.currentParent.parent; |
|
} |
|
if (result.status === 'failed') { |
|
this.failureCount++; |
|
} |
|
}; |
|
ResultsStateBuilder.prototype.specStarted = function (_report) { |
|
}; |
|
ResultsStateBuilder.prototype.specDone = function (result) { |
|
this.currentParent.addChild(result, 'spec'); |
|
if (result.status !== 'excluded') { |
|
this.specsExecuted++; |
|
} |
|
if (result.status === 'failed') { |
|
this.failureCount++; |
|
} |
|
if (result.status === 'pending') { |
|
this.pendingSpecCount++; |
|
} |
|
}; |
|
return ResultsStateBuilder; |
|
}(); |
|
var HtmlReporter = function () { |
|
function HtmlReporter(options) { |
|
this.failures = []; |
|
this.deprecationWarnings = []; |
|
this.stateBuilder = new ResultsStateBuilder(); |
|
this.config = function () { |
|
return options.env && options.env.configuration() || {}; |
|
}; |
|
this.getContainer = options.getContainer; |
|
this.createElement = options.createElement; |
|
this.createTextNode = options.createTextNode; |
|
this.navigateWithNewParam = options.navigateWithNewParam || function () { |
|
}; |
|
this.addToExistingQueryString = options.addToExistingQueryString || defaultQueryString; |
|
this.filterSpecs = options.filterSpecs; |
|
this.summary = createDom(this, 'div', { className: 'jasmine-summary' }); |
|
} |
|
HtmlReporter.prototype.initialize = function () { |
|
clearPrior(this); |
|
this.htmlReporterMain = createDom(this, 'div', { className: 'jasmine_html-reporter' }, createDom(this, 'div', { className: 'jasmine-banner' }, this.createAnchor({ |
|
className: 'jasmine-title', |
|
href: 'http://jasmine.github.io/', |
|
target: '_blank' |
|
}), createDom(this, 'span', { className: 'jasmine-version' }, jasmine.version)), createDom(this, 'ul', { className: 'jasmine-symbol-summary' }), createDom(this, 'div', { className: 'jasmine-alert' }), createDom(this, 'div', { className: 'jasmine-results' }, createDom(this, 'div', { className: 'jasmine-failures' }))); |
|
this.getContainer().appendChild(this.htmlReporterMain); |
|
}; |
|
HtmlReporter.prototype.jasmineStarted = function (options) { |
|
this.totalSpecsDefined = options.totalSpecsDefined || 0; |
|
}; |
|
HtmlReporter.prototype.suiteStarted = function (result) { |
|
this.stateBuilder.suiteStarted(result); |
|
}; |
|
HtmlReporter.prototype.suiteDone = function (result) { |
|
this.stateBuilder.suiteDone(result); |
|
if (result.status === 'failed') { |
|
this.failures.push(failureDom(result, this)); |
|
} |
|
addDeprecationWarnings(result, this); |
|
}; |
|
HtmlReporter.prototype.specStarted = function (result) { |
|
this.stateBuilder.specStarted(result); |
|
}; |
|
HtmlReporter.prototype.specDone = function (result) { |
|
this.stateBuilder.specDone(result); |
|
if (noExpectations(result)) { |
|
var noSpecMsg = 'Spec "' + result.fullName + '" has no expectations.'; |
|
if (result.status === 'failed') { |
|
console.error(noSpecMsg); |
|
} else { |
|
console.warn(noSpecMsg); |
|
} |
|
} |
|
if (!this.symbols) { |
|
this.symbols = find('.jasmine-symbol-summary', this, 'specDone'); |
|
} |
|
this.symbols.appendChild(createDom(this, 'li', { |
|
className: this.classNameFromSpecReport(result), |
|
id: 'spec_' + result.id, |
|
title: result.fullName |
|
})); |
|
if (result.status === 'failed') { |
|
this.failures.push(failureDom(result, this)); |
|
} |
|
addDeprecationWarnings(result, this); |
|
}; |
|
HtmlReporter.prototype.classNameFromSpecReport = function (report) { |
|
return noExpectations(report) && report.status === 'passed' ? 'jasmine-empty' : this.classNameFromStatus(report.status); |
|
}; |
|
HtmlReporter.prototype.classNameFromStatus = function (status) { |
|
switch (status) { |
|
case 'excluded': |
|
case 'passed': { |
|
return this.config().hideDisabled ? 'jasmine-excluded-no-display' : 'jasmine-excluded'; |
|
} |
|
case 'pending': |
|
return 'jasmine-pending'; |
|
case 'failed': |
|
return 'jasmine-failed'; |
|
default: { |
|
throw new Error('classNameFromStatus(\'' + status + '\')'); |
|
} |
|
} |
|
}; |
|
HtmlReporter.prototype.jasmineDone = function (doneResult) { |
|
var _this = this; |
|
var banner = find('.jasmine-banner', this, 'jasmineDone'); |
|
var alert = find('.jasmine-alert', this, 'jasmineDone'); |
|
var order = doneResult && doneResult.order; |
|
alert.appendChild(createDom(this, 'span', { className: 'jasmine-duration' }, 'finished in ' + doneResult.totalTime / 1000 + 's')); |
|
banner.appendChild(optionsMenu(this.config(), this)); |
|
if (this.stateBuilder.specsExecuted < this.totalSpecsDefined) { |
|
var skippedMessage = 'Ran ' + this.stateBuilder.specsExecuted + ' of ' + this.totalSpecsDefined + ' specs - run all'; |
|
var skippedLink = this.addToExistingQueryString('spec', ''); |
|
alert.appendChild(createDom(this, 'span', { className: 'jasmine-bar jasmine-skipped' }, this.createAnchor({ |
|
href: skippedLink, |
|
title: 'Run all specs' |
|
}, skippedMessage))); |
|
} |
|
var statusBarMessage = ''; |
|
var statusBarClassName = 'jasmine-overall-result jasmine-bar '; |
|
var globalFailures = doneResult && doneResult.failedExpectations || []; |
|
var failed = this.stateBuilder.failureCount + globalFailures.length > 0; |
|
if (this.totalSpecsDefined > 0 || failed) { |
|
statusBarMessage += pluralize('spec', this.stateBuilder.specsExecuted) + ', ' + pluralize('failure', this.stateBuilder.failureCount); |
|
if (this.stateBuilder.pendingSpecCount) { |
|
statusBarMessage += ', ' + pluralize('pending spec', this.stateBuilder.pendingSpecCount); |
|
} |
|
} |
|
if (doneResult.overallStatus === 'passed') { |
|
statusBarClassName += ' jasmine-passed '; |
|
} else if (doneResult.overallStatus === 'incomplete') { |
|
statusBarClassName += ' jasmine-incomplete '; |
|
statusBarMessage = 'Incomplete: ' + doneResult.incompleteReason + ', ' + statusBarMessage; |
|
} else { |
|
statusBarClassName += ' jasmine-failed '; |
|
} |
|
if (order && order.random) { |
|
var seedBar = createDom(this, 'span', { className: 'jasmine-seed-bar' }, ', randomized with seed ', this.createAnchor({ |
|
title: 'randomized with seed ' + order.seed, |
|
href: seedHref(order.seed, this) |
|
}, order.seed)); |
|
alert.appendChild(createDom(this, 'span', { className: statusBarClassName }, statusBarMessage, seedBar)); |
|
} else { |
|
alert.appendChild(createDom(this, 'span', { className: statusBarClassName }, statusBarMessage)); |
|
} |
|
var errorBarClassName = 'jasmine-bar jasmine-errored'; |
|
var afterAllMessagePrefix = 'AfterAll '; |
|
var _Tt0La = Date.now(); |
|
for (var _i = 0, globalFailures_1 = globalFailures; _i < globalFailures_1.length; _i++) { |
|
if (Date.now() - _Tt0La > 1000) { |
|
throw new Error('Infinite loop suspected after 1000 milliseconds.'); |
|
} |
|
{ |
|
var globalFailure = globalFailures_1[_i]; |
|
alert.appendChild(createDom(this, 'span', { className: errorBarClassName }, globalFailureMessage(globalFailure))); |
|
} |
|
} |
|
function globalFailureMessage(failure) { |
|
if (failure.globalErrorType === 'load') { |
|
var prefix = 'Error during loading: ' + failure.message; |
|
if (failure.filename) { |
|
return prefix + ' in ' + failure.filename + ' line ' + failure.lineno; |
|
} else { |
|
return prefix; |
|
} |
|
} else { |
|
return afterAllMessagePrefix + failure.message; |
|
} |
|
} |
|
addDeprecationWarnings(doneResult, this); |
|
var warningBarClassName = 'jasmine-bar jasmine-warning'; |
|
var _hAF3g = Date.now(); |
|
for (var _a = 0, _b = this.deprecationWarnings; _a < _b.length; _a++) { |
|
if (Date.now() - _hAF3g > 1000) { |
|
throw new Error('Infinite loop suspected after 1000 milliseconds.'); |
|
} |
|
{ |
|
var deprecationWarning = _b[_a]; |
|
alert.appendChild(createDom(this, 'span', { className: warningBarClassName }, 'DEPRECATION: ' + deprecationWarning)); |
|
} |
|
} |
|
var results = find('.jasmine-results', this, 'jasmineDone'); |
|
results.appendChild(this.summary); |
|
summaryList(this.stateBuilder.topResults, this.summary, this); |
|
if (this.failures.length) { |
|
alert.appendChild(createDom(this, 'span', { className: 'jasmine-menu jasmine-bar jasmine-spec-list' }, createDom(this, 'span', {}, 'Spec List | '), this.createAnchor({ |
|
className: 'jasmine-failures-menu', |
|
href: '#' |
|
}, 'Failures'))); |
|
alert.appendChild(createDom(this, 'span', { className: 'jasmine-menu jasmine-bar jasmine-failure-list' }, this.createAnchor({ |
|
className: 'jasmine-spec-list-menu', |
|
href: '#' |
|
}, 'Spec List'), createDom(this, 'span', {}, ' | Failures '))); |
|
findAnchor('.jasmine-failures-menu', this).onclick = function () { |
|
setMenuModeTo('jasmine-failure-list', _this); |
|
return false; |
|
}; |
|
findAnchor('.jasmine-spec-list-menu', this).onclick = function () { |
|
setMenuModeTo('jasmine-spec-list', _this); |
|
return false; |
|
}; |
|
setMenuModeTo('jasmine-failure-list', this); |
|
var failureNode = find('.jasmine-failures', this, 'jasmineDone'); |
|
var _gc1Tt = Date.now(); |
|
for (var _c = 0, _d = this.failures; _c < _d.length; _c++) { |
|
if (Date.now() - _gc1Tt > 1000) { |
|
throw new Error('Infinite loop suspected after 1000 milliseconds.'); |
|
} |
|
{ |
|
var failure = _d[_c]; |
|
failureNode.appendChild(failure); |
|
} |
|
} |
|
} |
|
}; |
|
HtmlReporter.prototype.createAnchor = function (attrs, text) { |
|
var placeholder = {}; |
|
if (attrs.className) { |
|
placeholder.className = attrs.className; |
|
} |
|
if (attrs.title) { |
|
placeholder.title = attrs.title; |
|
} |
|
if (attrs.target) { |
|
placeholder.target = attrs.target; |
|
} |
|
if (attrs.href) { |
|
if (attrs.target === '_blank') { |
|
placeholder.href = attrs.href; |
|
} |
|
} |
|
if (typeof text === 'string') { |
|
return createDom(this, 'a', placeholder, text); |
|
} else { |
|
return createDom(this, 'a', placeholder); |
|
} |
|
}; |
|
return HtmlReporter; |
|
}(); |
|
function failureDom(result, reporter) { |
|
var failure = createDom(reporter, 'div', { className: 'jasmine-spec-detail jasmine-failed' }, failureDescription(result, reporter.stateBuilder.currentParent, reporter), createDom(reporter, 'div', { className: 'jasmine-messages' })); |
|
var messages = failure.childNodes[1]; |
|
var _x6RwI = Date.now(); |
|
for (var _i = 0, _a = result.failedExpectations; _i < _a.length; _i++) { |
|
if (Date.now() - _x6RwI > 1000) { |
|
throw new Error('Infinite loop suspected after 1000 milliseconds.'); |
|
} |
|
{ |
|
var expectation = _a[_i]; |
|
messages.appendChild(createDom(reporter, 'div', { className: 'jasmine-result-message' }, expectation.message)); |
|
messages.appendChild(createDom(reporter, 'div', { className: 'jasmine-stack-trace' }, expectation.stack)); |
|
} |
|
} |
|
if (result.failedExpectations.length === 0) { |
|
messages.appendChild(createDom(reporter, 'div', { className: 'jasmine-result-message' }, 'Spec has no expectations')); |
|
} |
|
return failure; |
|
} |
|
function summaryList(resultsTree, domParent, reporter) { |
|
var specListNode; |
|
var _9j242 = Date.now(); |
|
for (var _i = 0, _a = resultsTree.children; _i < _a.length; _i++) { |
|
if (Date.now() - _9j242 > 1000) { |
|
throw new Error('Infinite loop suspected after 1000 milliseconds.'); |
|
} |
|
{ |
|
var resultNode = _a[_i]; |
|
if (reporter.filterSpecs && !hasActiveSpec(resultNode)) { |
|
continue; |
|
} |
|
if (resultNode.type === 'suite') { |
|
var result = resultNode.result; |
|
var suiteListNode = createDom(reporter, 'ul', { |
|
className: 'jasmine-suite', |
|
id: 'suite-' + result.id |
|
}, createDom(reporter, 'li', { className: 'jasmine-suite-detail jasmine-' + result.status }, reporter.createAnchor({ href: specHref(result, reporter) }, result.description))); |
|
summaryList(resultNode, suiteListNode, reporter); |
|
domParent.appendChild(suiteListNode); |
|
} |
|
if (resultNode.type === 'spec') { |
|
var result = resultNode.result; |
|
if (domParent.getAttribute('class') !== 'jasmine-specs') { |
|
specListNode = createDom(reporter, 'ul', { className: 'jasmine-specs' }); |
|
domParent.appendChild(specListNode); |
|
} |
|
var specDescription = result.description; |
|
if (noExpectations(result)) { |
|
specDescription = 'SPEC HAS NO EXPECTATIONS ' + specDescription; |
|
} |
|
if (result.status === 'pending' && result.pendingReason !== '') { |
|
specDescription = specDescription + ' PENDING WITH MESSAGE: ' + result.pendingReason; |
|
} |
|
specListNode.appendChild(createDom(reporter, 'li', { |
|
className: 'jasmine-' + result.status, |
|
id: 'spec-' + result.id |
|
}, reporter.createAnchor({ href: specHref(result, reporter) }, specDescription))); |
|
} |
|
} |
|
} |
|
} |
|
function optionsMenu(config, reporter) { |
|
var optionsMenuDom = createDom(reporter, 'div', { className: 'jasmine-run-options' }, createDom(reporter, 'span', { className: 'jasmine-trigger' }, 'Options'), createDom(reporter, 'div', { className: 'jasmine-payload' }, createDom(reporter, 'div', { className: 'jasmine-stop-on-failure' }, createDom(reporter, 'input', { |
|
className: 'jasmine-fail-fast', |
|
id: 'jasmine-fail-fast', |
|
type: 'checkbox' |
|
}), createDom(reporter, 'label', { |
|
className: 'jasmine-label', |
|
for: 'jasmine-fail-fast' |
|
}, 'stop execution on spec failure')), createDom(reporter, 'div', { className: 'jasmine-throw-failures' }, createDom(reporter, 'input', { |
|
className: 'jasmine-throw', |
|
id: 'jasmine-throw-failures', |
|
type: 'checkbox' |
|
}), createDom(reporter, 'label', { |
|
className: 'jasmine-label', |
|
for: 'jasmine-throw-failures' |
|
}, 'stop spec on expectation failure')), createDom(reporter, 'div', { className: 'jasmine-random-order' }, createDom(reporter, 'input', { |
|
className: 'jasmine-random', |
|
id: 'jasmine-random-order', |
|
type: 'checkbox' |
|
}), createDom(reporter, 'label', { |
|
className: 'jasmine-label', |
|
for: 'jasmine-random-order' |
|
}, 'run tests in random order')), createDom(reporter, 'div', { className: 'jasmine-hide-disabled' }, createDom(reporter, 'input', { |
|
className: 'jasmine-disabled', |
|
id: 'jasmine-hide-disabled', |
|
type: 'checkbox' |
|
}), createDom(reporter, 'label', { |
|
className: 'jasmine-label', |
|
for: 'jasmine-hide-disabled' |
|
}, 'hide disabled tests')))); |
|
var failFastCheckbox = optionsMenuDom.querySelector('#jasmine-fail-fast'); |
|
failFastCheckbox.checked = config.failFast ? true : false; |
|
failFastCheckbox.onclick = function () { |
|
reporter.navigateWithNewParam('failFast', !config.failFast); |
|
}; |
|
var throwCheckbox = optionsMenuDom.querySelector('#jasmine-throw-failures'); |
|
throwCheckbox.checked = config.oneFailurePerSpec ? true : false; |
|
throwCheckbox.onclick = function () { |
|
reporter.navigateWithNewParam('throwFailures', !config.oneFailurePerSpec); |
|
}; |
|
var randomCheckbox = optionsMenuDom.querySelector('#jasmine-random-order'); |
|
randomCheckbox.checked = config.random ? true : false; |
|
randomCheckbox.onclick = function () { |
|
reporter.navigateWithNewParam('random', !config.random); |
|
}; |
|
var hideDisabled = optionsMenuDom.querySelector('#jasmine-hide-disabled'); |
|
hideDisabled.checked = config.hideDisabled ? true : false; |
|
hideDisabled.onclick = function () { |
|
reporter.navigateWithNewParam('hideDisabled', !config.hideDisabled); |
|
}; |
|
var optionsTrigger = optionsMenuDom.querySelector('.jasmine-trigger'); |
|
var optionsPayload = optionsMenuDom.querySelector('.jasmine-payload'); |
|
var isOpen = /\bjasmine-open\b/; |
|
optionsTrigger.onclick = function () { |
|
if (isOpen.test(optionsPayload.className)) { |
|
optionsPayload.className = optionsPayload.className.replace(isOpen, ''); |
|
} else { |
|
optionsPayload.className += ' jasmine-open'; |
|
} |
|
}; |
|
return optionsMenuDom; |
|
} |
|
function failureDescription(result, suite, reporter) { |
|
var wrapper = createDom(reporter, 'div', { className: 'jasmine-description' }, reporter.createAnchor({ |
|
title: result.description, |
|
href: specHref(result, reporter) |
|
}, result.description)); |
|
var suiteLink; |
|
var _MJ5UB = Date.now(); |
|
while (suite && suite.parent) { |
|
if (Date.now() - _MJ5UB > 1000) { |
|
throw new Error('Infinite loop suspected after 1000 milliseconds.'); |
|
} |
|
{ |
|
wrapper.insertBefore(reporter.createTextNode(' > '), wrapper.firstChild); |
|
suiteLink = reporter.createAnchor({ href: suiteHref(suite, reporter) }, suite.result.description); |
|
wrapper.insertBefore(suiteLink, wrapper.firstChild); |
|
suite = suite.parent; |
|
} |
|
} |
|
return wrapper; |
|
} |
|
function suiteHref(suite, reporter) { |
|
var els = []; |
|
var _jXXue = Date.now(); |
|
while (suite && suite.parent) { |
|
if (Date.now() - _jXXue > 1000) { |
|
throw new Error('Infinite loop suspected after 1000 milliseconds.'); |
|
} |
|
{ |
|
els.unshift(suite.result.description); |
|
suite = suite.parent; |
|
} |
|
} |
|
return reporter.addToExistingQueryString('spec', els.join(' ')); |
|
} |
|
function addDeprecationWarnings(result, reporter) { |
|
if (result && result.deprecationWarnings) { |
|
var _3p0dJ = Date.now(); |
|
for (var _i = 0, _a = result.deprecationWarnings; _i < _a.length; _i++) { |
|
if (Date.now() - _3p0dJ > 1000) { |
|
throw new Error('Infinite loop suspected after 1000 milliseconds.'); |
|
} |
|
{ |
|
var deprecationWarning = _a[_i]; |
|
var warning = deprecationWarning.message; |
|
reporter.deprecationWarnings.push(warning); |
|
} |
|
} |
|
} |
|
} |
|
function findAnchor(selector, reporter) { |
|
var element = find(selector, reporter, 'findAnchor'); |
|
if (element instanceof HTMLAnchorElement) { |
|
return element; |
|
} else { |
|
throw new Error(selector + ' is not an HTMLAnchorElement'); |
|
} |
|
} |
|
function find(selector, reporter, _origin) { |
|
var selectors = '.jasmine_html-reporter ' + selector; |
|
var element = reporter.getContainer().querySelector(selectors); |
|
if (element) { |
|
return element; |
|
} else { |
|
throw new Error('Unable to find selectors ' + JSON.stringify(selectors)); |
|
} |
|
} |
|
function clearPrior(reporter) { |
|
try { |
|
var oldReporter = find('', reporter, 'clearPrior'); |
|
reporter.getContainer().removeChild(oldReporter); |
|
} catch (e) { |
|
} |
|
} |
|
function createDom(factory, type, attrs) { |
|
var _children = []; |
|
var _b577C = Date.now(); |
|
for (var _i = 3; _i < arguments.length; _i++) { |
|
if (Date.now() - _b577C > 1000) { |
|
throw new Error('Infinite loop suspected after 1000 milliseconds.'); |
|
} |
|
{ |
|
_children[_i - 3] = arguments[_i]; |
|
} |
|
} |
|
var el = factory.createElement(type); |
|
var _VjCjL = Date.now(); |
|
for (var i = 3; i < arguments.length; i++) { |
|
if (Date.now() - _VjCjL > 1000) { |
|
throw new Error('Infinite loop suspected after 1000 milliseconds.'); |
|
} |
|
{ |
|
var child = arguments[i]; |
|
if (typeof child === 'string') { |
|
el.appendChild(factory.createTextNode(child)); |
|
} else { |
|
if (child) { |
|
el.appendChild(child); |
|
} |
|
} |
|
} |
|
} |
|
for (var attr in attrs) { |
|
if (attr === 'className') { |
|
el[attr] = attrs[attr]; |
|
} else { |
|
el.setAttribute(attr, attrs[attr]); |
|
} |
|
} |
|
return el; |
|
} |
|
function pluralize(singular, count) { |
|
var word = count === 1 ? singular : singular + 's'; |
|
return '' + count + ' ' + word; |
|
} |
|
function specHref(result, reporter) { |
|
return reporter.addToExistingQueryString('spec', result.fullName); |
|
} |
|
function seedHref(seed, reporter) { |
|
return reporter.addToExistingQueryString('seed', seed); |
|
} |
|
function defaultQueryString(key, value) { |
|
return '?' + key + '=' + value; |
|
} |
|
function setMenuModeTo(mode, reporter) { |
|
reporter.htmlReporterMain.setAttribute('class', 'jasmine_html-reporter ' + mode); |
|
} |
|
function noExpectations(result) { |
|
var allExpectations = result.failedExpectations.length + result.passedExpectations.length; |
|
return allExpectations === 0 && (result.status === 'passed' || result.status === 'failed'); |
|
} |
|
function hasActiveSpec(resultNode) { |
|
if (resultNode.type === 'spec') { |
|
var result = resultNode.result; |
|
if (result.status !== 'excluded') { |
|
return true; |
|
} |
|
} |
|
if (resultNode.type === 'suite') { |
|
var j = resultNode.children.length; |
|
var _8H7Mp = Date.now(); |
|
for (var i = 0; i < j; i++) { |
|
if (Date.now() - _8H7Mp > 1000) { |
|
throw new Error('Infinite loop suspected after 1000 milliseconds.'); |
|
} |
|
{ |
|
if (hasActiveSpec(resultNode.children[i])) { |
|
return true; |
|
} |
|
} |
|
} |
|
} |
|
return false; |
|
} |
|
return HtmlReporter; |
|
}(); |
|
config = { |
|
random: false, |
|
failFast: false, |
|
failSpecWithNoExpectations: false, |
|
oneFailurePerSpec: false, |
|
hideDisabled: false, |
|
specFilter: void 0, |
|
promise: void 0 |
|
}; |
|
specifications = []; |
|
DomReady.ready(runTests).catch(function (e) { |
|
return console.error(e); |
|
}); |
|
} |
|
}; |
|
}); |
|
</script> |
|
</body> |
|
|
|
</html> |