Add frontend assets and plugin bundles
Add the legacy frontend themes, scripts, and plugin assets required by the main SPOTA interfaces.
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
Copyright (c) 2010-2011, Rudy Lattae
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of Rudy Lattae nor the
|
||||
names of its contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL Rudy Lattae BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
@@ -0,0 +1,106 @@
|
||||
/**
|
||||
* Calm theme for the jasmine-bloom StyledHtmlReporter output.
|
||||
*
|
||||
* This theme does away with the default boxey look. The resulting report
|
||||
* is a lot less "busy" thus making it easy to focus on your specs.
|
||||
*/
|
||||
|
||||
/* jasmine-reporter style overrides for */
|
||||
.jasmine_reporter a { text-decoration:none; }
|
||||
|
||||
.jasmine_reporter > .suite {
|
||||
padding-bottom: 0.3em;
|
||||
margin-bottom: 0.3em;
|
||||
border-bottom: solid 2px #eee; }
|
||||
|
||||
.banner, .runner {
|
||||
-webkit-border-radius: 7px;
|
||||
-moz-border-radius: 7px;
|
||||
border-radius: 7px; }
|
||||
|
||||
.runner {
|
||||
-webkit-box-shadow: 2px 2px 3px #888;
|
||||
-moz-box-shadow: 2px 2px 3px #888;
|
||||
box-shadow: 2px 2px 5px #888; }
|
||||
|
||||
.suite {
|
||||
border: none;
|
||||
padding-left: 0.5em; }
|
||||
.suite.failed,
|
||||
.suite.passed,
|
||||
.suite.skipped {
|
||||
background: transparent; }
|
||||
.suite.passed > a {
|
||||
color: green; }
|
||||
.suite.failed > a {
|
||||
color: #c11b17; }
|
||||
.suite.skipped > a {
|
||||
color: #aaa; }
|
||||
.suite > .description {
|
||||
font-weight: bold; }
|
||||
.suite.step > .description {
|
||||
font-weight: normal; }
|
||||
|
||||
.spec {
|
||||
margin: 0px;
|
||||
border: none;
|
||||
padding-left: 0.5em;
|
||||
margin-left: 0.5em;
|
||||
margin-top: 0.2em; }
|
||||
.spec.failed,
|
||||
.spec.passed,
|
||||
.spec.skipped {
|
||||
background: transparent;
|
||||
border: none;
|
||||
padding-bottom: 0.2em; }
|
||||
.spec.failed a {
|
||||
color: #c11b17; }
|
||||
.spec.passed a {
|
||||
color: green; }
|
||||
.spec.skipped a {
|
||||
color: #ccc; }
|
||||
.spec:hover {
|
||||
background-color: #eee;
|
||||
-webkit-border-radius: 7px;
|
||||
-moz-border-radius: 7px;
|
||||
border-radius: 7px; }
|
||||
.spec .description {
|
||||
padding-left: 0.5em; }
|
||||
|
||||
.messages {
|
||||
border: none;
|
||||
margin-left: 1em;
|
||||
padding-bottom: 0.5em; }
|
||||
|
||||
.jasmine_reporter .summary ul {
|
||||
font-size: 0.9em;
|
||||
color: #333;
|
||||
padding-left: 0.2em;
|
||||
margin: 0 0.5em; }
|
||||
|
||||
.jasmine_reporter .summary li {
|
||||
list-style: none; }
|
||||
|
||||
.jasmine_reporter .details ul {
|
||||
font-size: 0.8em;
|
||||
color: #777;
|
||||
padding-left: 0.2em;
|
||||
margin: 0 0.8em; }
|
||||
|
||||
.jasmine_reporter .details li {
|
||||
list-style: none; }
|
||||
|
||||
|
||||
/* header style (if header is used) */
|
||||
.header {
|
||||
margin: 0 5px; }
|
||||
.header h1 {
|
||||
font-size: 1.3em; }
|
||||
.header ul.menu {
|
||||
margin: 0 0 0.5em 0;
|
||||
padding: 0.3em;
|
||||
background-color: #eee; }
|
||||
.header ul.menu li {
|
||||
display: inline;
|
||||
list-style-type: none;
|
||||
margin-right: 1em; }
|
||||
@@ -0,0 +1,233 @@
|
||||
/**
|
||||
* Jasmine Grammar - Additional Jasmine grammar to enable alternate BDD approaches.
|
||||
*
|
||||
* Copyright (C) 2010-2011, Rudy Lattae
|
||||
* License: Simplified BSD
|
||||
*
|
||||
* Jasmine-Grammar contains some additions to the jasmine api that make it
|
||||
* more suitable to alternate BDD approaches. The end-goal is streamline the
|
||||
* grammatical aspect of specing out an application from different view-points.
|
||||
*
|
||||
* The new grammar should make it easier to create other types of specifications
|
||||
* apart from "describe" and "it should". They are simply wrappers
|
||||
* for "describe" and "it" so they follow the same rules for nesting.
|
||||
*/
|
||||
|
||||
// Top level namespace for the package
|
||||
jasmine.grammar = (typeof jasmine.grammar === 'undefined') ? {} : jasmine.grammar;
|
||||
|
||||
|
||||
/**
|
||||
* Feature / Story => Scenario => ... style grammar
|
||||
*/
|
||||
jasmine.grammar.FeatureStory = {
|
||||
|
||||
/**
|
||||
* Defines a suite tagged as a "feature"
|
||||
*/
|
||||
feature: function(description, specDefinitions) {
|
||||
var suite = jasmine.grammar.getEnv().describe('Feature: ' + description, specDefinitions);
|
||||
suite.tags = ['feature'];
|
||||
return suite;
|
||||
},
|
||||
|
||||
/**
|
||||
* Defines a suite tagged as a "story"
|
||||
*/
|
||||
story: function(description, specDefinitions) {
|
||||
var suite = jasmine.grammar.getEnv().describe('Story: ' + description, specDefinitions);
|
||||
suite.tags = ['story'];
|
||||
return suite;
|
||||
},
|
||||
|
||||
/**
|
||||
* Defines a suite tagged as a "component"
|
||||
*/
|
||||
component: function(description, specDefinitions) {
|
||||
var suite = jasmine.grammar.getEnv().describe('Component: ' + description, specDefinitions);
|
||||
suite.tags = ['component'];
|
||||
return suite;
|
||||
},
|
||||
|
||||
/**
|
||||
* Defines a spec marked as a "scenario"
|
||||
*/
|
||||
scenario: function(desc, func) {
|
||||
return jasmine.grammar.getEnv().it('Scenario: ' + desc, func);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Given => When => Then ... style grammar
|
||||
*/
|
||||
jasmine.grammar.GWT = {
|
||||
|
||||
/**
|
||||
* Defines a "given" step as a runs block that marks the beginning of a GWT chain
|
||||
*/
|
||||
given: function(desc, func) {
|
||||
return this._addStepToCurrentSpec('Given ' + desc, func);
|
||||
},
|
||||
|
||||
/**
|
||||
* Defines a "when" step as a runs block that marks the interesting event in a GWT chain
|
||||
*/
|
||||
when: function(desc, func) {
|
||||
return this._addStepToCurrentSpec('When ' + desc, func);
|
||||
},
|
||||
|
||||
/**
|
||||
* Defines a "then" step as a runs block that marks the conclusion of a Given, when, then construct
|
||||
*/
|
||||
then: function(desc, func) {
|
||||
return this._addStepToCurrentSpec('Then ' + desc, func);
|
||||
},
|
||||
|
||||
/**
|
||||
* Defines an "and" step as a runs block that is a continuation from a "then" statement
|
||||
*/
|
||||
and: function(desc, func) {
|
||||
return this._addStepToCurrentSpec('And ' + desc, func);
|
||||
},
|
||||
|
||||
/**
|
||||
* Defines a "but" step as a runs block that is a continuation from a "then" statement
|
||||
*/
|
||||
but: function(desc, func) {
|
||||
return this._addStepToCurrentSpec('But ' + desc, func);
|
||||
},
|
||||
|
||||
/**
|
||||
* Adds the given function as a step (runs block) in the current spec. Also adds the description to the details list of the spec
|
||||
*/
|
||||
_addStepToCurrentSpec: function(desc, func) {
|
||||
var spec = jasmine.grammar.getEnv().currentSpec;
|
||||
spec.details = spec.details || [];
|
||||
spec.details.push(desc);
|
||||
spec.runs(func);
|
||||
return spec;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Concern => Context => Specification style grammar
|
||||
*/
|
||||
jasmine.grammar.ContextSpecification = {
|
||||
|
||||
/**
|
||||
* Defines a suite tagged as a "concern"
|
||||
*/
|
||||
concern: function(description, specDefinitions) {
|
||||
var suite = jasmine.grammar.getEnv().describe(description, specDefinitions);
|
||||
suite.tags = ['concern'];
|
||||
return suite;
|
||||
},
|
||||
|
||||
/**
|
||||
* Defines a suite tagged as a "context"
|
||||
*/
|
||||
context: function(description, specDefinitions) {
|
||||
var suite = jasmine.grammar.getEnv().describe(description, specDefinitions);
|
||||
suite.tags = ['context'];
|
||||
return suite;
|
||||
},
|
||||
|
||||
/**
|
||||
* Defines a simple spec -- similar to it
|
||||
*/
|
||||
spec: function(desc, func) {
|
||||
return jasmine.grammar.getEnv().it(desc, func);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Executable docs (Topic => Example) style grammar
|
||||
*/
|
||||
jasmine.grammar.XDoc = {
|
||||
|
||||
/**
|
||||
* Defines a suite tagged as a "topic"
|
||||
*/
|
||||
topic: function(description, specDefinitions) {
|
||||
var suite = jasmine.grammar.getEnv().describe(description, specDefinitions);
|
||||
suite.tags = ['topic'];
|
||||
return suite;
|
||||
},
|
||||
|
||||
/**
|
||||
* Defines a suite tagged as an "example".
|
||||
*
|
||||
* An axample suite actually stores the inner suites as a string in the "defs" attribute
|
||||
*/
|
||||
example: function(description, specDefinitions) {
|
||||
var suite = jasmine.grammar.getEnv().describe(description, specDefinitions);
|
||||
suite.tags = ['example'];
|
||||
suite.expose = true;
|
||||
suite.defs = specDefinitions.toString()
|
||||
.replace(/^function.*\(.*\).*{/, '')
|
||||
.replace(/}$/, '').trim(); // stored for later output
|
||||
return suite;
|
||||
},
|
||||
|
||||
/**
|
||||
* Defines a simple spec without any associated function
|
||||
*/
|
||||
pass: function(desc, func) {
|
||||
return jasmine.grammar.getEnv().it(desc);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Some more useful constructs that attach metadata to suites and specs
|
||||
*/
|
||||
jasmine.grammar.Meta = {
|
||||
|
||||
/**
|
||||
* Adds summary content to the current suite.
|
||||
*
|
||||
* @param {String} content(s) variable number of detail content
|
||||
* @see jasmine.grammar.SuiteDetails
|
||||
*/
|
||||
summary: function() {
|
||||
var suite = jasmine.grammar.getEnv().currentSuite;
|
||||
suite.summary = suite.summary || [];
|
||||
|
||||
if (arguments.length > 0) {
|
||||
for(i=0; i<arguments.length; i++) {
|
||||
suite.summary.push(arguments[i]);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Adds detail entries in the current spec.
|
||||
*
|
||||
* @param {String} content(s) variable number of detail content
|
||||
* @see jasmine.grammar.SuiteDetails
|
||||
*/
|
||||
details: function() {
|
||||
var spec = jasmine.grammar.getEnv().currentSpec;
|
||||
spec.details = spec.details || [];
|
||||
|
||||
if (arguments.length > 0) {
|
||||
for(i=0; i<arguments.length; i++) {
|
||||
spec.details.push(arguments[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// Utilities
|
||||
// =========
|
||||
|
||||
/**
|
||||
* Getter for the Jasmine environment. Makes it possible to inject a different environment when necessary.
|
||||
*/
|
||||
jasmine.grammar.getEnv = function() {
|
||||
return jasmine.grammar._currentEnv = jasmine.grammar._currentEnv || jasmine.getEnv();
|
||||
};
|
||||
@@ -0,0 +1,191 @@
|
||||
/**
|
||||
* Jasmine Reporting - Companion reporting with metadata output for your
|
||||
* Jasmine specs with extended grammar
|
||||
*
|
||||
* Copyright (C) 2010-2011, Rudy Lattae
|
||||
* License: Simplified BSD
|
||||
*/
|
||||
|
||||
// Top level namespace for the package
|
||||
jasmine.reporting = (typeof jasmine.reporting === 'undefined') ? {} : jasmine.reporting;
|
||||
|
||||
|
||||
/**
|
||||
* The StyledHtmlReporter provides augments the jasmine.TrivialReporter
|
||||
*
|
||||
* It outputs additional meta-data relating to your specs to streamline
|
||||
* the presentation of the spec report. When used in conjunction with the
|
||||
* the alternate BDD grammar, your Html report is much easier on the eyes.
|
||||
*/
|
||||
jasmine.reporting.StyledHtmlReporter = function(doc) {
|
||||
this.document = doc || document;
|
||||
this.suiteDivs = {};
|
||||
this.logRunningSpecs = false;
|
||||
};
|
||||
|
||||
jasmine.reporting.StyledHtmlReporter.prototype = new jasmine.TrivialReporter();
|
||||
jasmine.reporting.StyledHtmlReporter.prototype.constructor = jasmine.reporting.StyledHtmlReporter;
|
||||
|
||||
|
||||
jasmine.reporting.StyledHtmlReporter.prototype.reportRunnerStarting = function(runner) {
|
||||
var showPassed, showSkipped;
|
||||
|
||||
this.outerDiv = this.createDom('div', { className: 'jasmine_reporter' },
|
||||
this.createDom('div', { className: 'banner' },
|
||||
this.createDom('div', { className: 'logo' },
|
||||
this.createDom('a', { href: 'http://pivotal.github.com/jasmine/', target: "_blank" }, "Jasmine"),
|
||||
this.createDom('span', { className: 'version' }, runner.env.versionString())),
|
||||
this.createDom('div', { className: 'options' },
|
||||
"Show ",
|
||||
showPassed = this.createDom('input', { id: "__jasmine_TrivialReporter_showPassed__", type: 'checkbox' }),
|
||||
this.createDom('label', { "for": "__jasmine_TrivialReporter_showPassed__" }, " passed "),
|
||||
showSkipped = this.createDom('input', { id: "__jasmine_TrivialReporter_showSkipped__", type: 'checkbox' }),
|
||||
this.createDom('label', { "for": "__jasmine_TrivialReporter_showSkipped__" }, " skipped")
|
||||
)
|
||||
),
|
||||
|
||||
this.runnerDiv = this.createDom('div', { className: 'runner running' },
|
||||
this.createDom('a', { className: 'run_spec', href: '?' }, "run all"),
|
||||
this.runnerMessageSpan = this.createDom('span', {}, "Running..."),
|
||||
this.finishedAtSpan = this.createDom('span', { className: 'finished-at' }, ""))
|
||||
);
|
||||
|
||||
this.document.body.appendChild(this.outerDiv);
|
||||
|
||||
var suites = runner.suites();
|
||||
for (var i = 0; i < suites.length; i++) {
|
||||
var suite = suites[i];
|
||||
|
||||
var suiteTags = (typeof suite.tags === 'undefined') ? '' : ' ' + suite.tags.join(' ');
|
||||
var suiteDiv = this.createDom('div', { className: 'suite' + suiteTags },
|
||||
this.createDom('a', { className: 'run_spec', href: '?spec=' + encodeURIComponent(suite.getFullName()) }, "run"),
|
||||
this.createDom('a', { className: 'description', href: '?spec=' + encodeURIComponent(suite.getFullName()) }, suite.description));
|
||||
|
||||
if (suite.summary) {
|
||||
suiteDiv.appendChild(this.createDom('div', {className: 'summary'}, this.createDomFromListOrString(suite.summary)));
|
||||
}
|
||||
|
||||
if (suite.expose) {
|
||||
suiteDiv.appendChild(this.createDom('pre', {}, suite.defs));
|
||||
}
|
||||
|
||||
this.suiteDivs[suite.id] = suiteDiv;
|
||||
var parentDiv = this.outerDiv;
|
||||
if (suite.parentSuite) {
|
||||
parentDiv = this.suiteDivs[suite.parentSuite.id];
|
||||
}
|
||||
parentDiv.appendChild(suiteDiv);
|
||||
}
|
||||
|
||||
this.startedAt = new Date();
|
||||
|
||||
var self = this;
|
||||
showPassed.onchange = function(evt) {
|
||||
if (evt.target.checked) {
|
||||
self.outerDiv.className += ' show-passed';
|
||||
} else {
|
||||
self.outerDiv.className = self.outerDiv.className.replace(/ show-passed/, '');
|
||||
}
|
||||
};
|
||||
|
||||
showSkipped.onchange = function(evt) {
|
||||
if (evt.target.checked) {
|
||||
self.outerDiv.className += ' show-skipped';
|
||||
} else {
|
||||
self.outerDiv.className = self.outerDiv.className.replace(/ show-skipped/, '');
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
jasmine.reporting.StyledHtmlReporter.prototype.reportSuiteResults = function(suite) {
|
||||
var results = suite.results();
|
||||
var status = results.passed() ? 'passed' : 'failed';
|
||||
if (results.totalCount == 0 && (!status == 'failed' || !suite.isIntermediate)) { // todo: change this to check results.skipped
|
||||
status = 'skipped';
|
||||
}
|
||||
this.suiteDivs[suite.id].className += " " + status;
|
||||
};
|
||||
|
||||
jasmine.reporting.StyledHtmlReporter.prototype.reportSpecResults = function(spec) {
|
||||
var results = spec.results();
|
||||
var status = results.passed() ? 'passed' : 'failed';
|
||||
if (results.skipped) {
|
||||
status = 'skipped';
|
||||
}
|
||||
var specDiv = this.createDom('div', { className: 'spec ' + status },
|
||||
this.createDom('a', { className: 'run_spec', href: '?spec=' + encodeURIComponent(spec.getFullName()) }, "run"),
|
||||
this.createDom('a', {
|
||||
className: 'description',
|
||||
href: '?spec=' + encodeURIComponent(spec.getFullName()),
|
||||
title: spec.getFullName()
|
||||
}, spec.description));
|
||||
|
||||
if (spec.details) {
|
||||
specDiv.appendChild(this.createDom('div', {className: 'details'}, this.createDomFromListOrString(spec.details)));
|
||||
}
|
||||
|
||||
var resultItems = results.getItems();
|
||||
var messagesDiv = this.createDom('div', { className: 'messages' });
|
||||
for (var i = 0; i < resultItems.length; i++) {
|
||||
var result = resultItems[i];
|
||||
|
||||
if (result.type == 'log') {
|
||||
messagesDiv.appendChild(this.createDom('div', {className: 'resultMessage log'}, result.toString()));
|
||||
} else if (result.type == 'expect' && result.passed && !result.passed()) {
|
||||
messagesDiv.appendChild(this.createDom('div', {className: 'resultMessage fail'}, result.message));
|
||||
|
||||
if (result.trace.stack) {
|
||||
messagesDiv.appendChild(this.createDom('div', {className: 'stackTrace'}, result.trace.stack));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (messagesDiv.childNodes.length > 0) {
|
||||
specDiv.appendChild(messagesDiv);
|
||||
}
|
||||
|
||||
this.suiteDivs[spec.suite.id].appendChild(specDiv);
|
||||
};
|
||||
|
||||
/**
|
||||
* Creates the proper dom element for the given data object.
|
||||
*
|
||||
* If the data is a simple string, the element created is a "p".
|
||||
* If the data is a list, the element created is an unordered list.
|
||||
* The tags are rendered to the class attribute on the dom element created
|
||||
*/
|
||||
jasmine.reporting.StyledHtmlReporter.prototype.createDomFromListOrString = function(data, tags) {
|
||||
var classAttrs = '';
|
||||
if (typeof tags !== 'undefined') {
|
||||
classAttrs = (tags instanceof Array) ? tags.join(' ') : tags;
|
||||
}
|
||||
if (data instanceof Array) {
|
||||
return this.createDomList('ul', ((classAttrs == '') ? {} : { className: classAttrs}), data);
|
||||
}
|
||||
|
||||
return this.createDom('p', { className: classAttrs}, data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates dom element with the suite defs as content
|
||||
*/
|
||||
jasmine.reporting.StyledHtmlReporter.prototype.createDomFromSuiteDefs = function(defs) {
|
||||
var classAttrs = '';
|
||||
if (typeof defs !== 'undefined') {
|
||||
return this.createDom('p', {}, defs);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a list of 'li' elements given an array
|
||||
*/
|
||||
jasmine.reporting.StyledHtmlReporter.prototype.createDomList = function(type, attrs, items) {
|
||||
var list;
|
||||
if (typeof items !== 'undefined' && items.length > 0) {
|
||||
list = this.createDom(type, attrs);
|
||||
for (var i = 0; i < items.length; i++) {
|
||||
list.appendChild(this.createDom('li', {}, items[i]));
|
||||
}
|
||||
}
|
||||
return list;
|
||||
};
|
||||
@@ -0,0 +1 @@
|
||||
{"version": "0.8.5b"}
|
||||
Reference in New Issue
Block a user