added Jasmine test suite from inside src/static dir to git repo
This commit is contained in:
21
src/static/tests/LICENSE
Normal file
21
src/static/tests/LICENSE
Normal file
@@ -0,0 +1,21 @@
|
||||
Copyright (c) 2008-2019 Pivotal Labs
|
||||
Copyright (c) 2008-2026 The Jasmine developers
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
"Software"), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
57
src/static/tests/Spec.js
Normal file
57
src/static/tests/Spec.js
Normal file
@@ -0,0 +1,57 @@
|
||||
console.log("Spec.js is loading");
|
||||
|
||||
describe("GameArray JavaScript", () => {
|
||||
const inputId= "id_text";
|
||||
const errorClass = "invalid-feedback";
|
||||
const inputSelector = `#${inputId}`;
|
||||
const errorSelector = `.${errorClass}`;
|
||||
let testDiv;
|
||||
let textInput;
|
||||
let errorMsg;
|
||||
|
||||
beforeEach(() => {
|
||||
console.log("beforeEach");
|
||||
testDiv = document.createElement("div");
|
||||
testDiv.innerHTML = `
|
||||
<form>
|
||||
<input
|
||||
id="${inputId}"
|
||||
name="text"
|
||||
class="form-control form-control-lg is-invalid"
|
||||
placeholder="Enter a to-do item"
|
||||
value="Value as submitted"
|
||||
aria-describedby="id_text_feedback"
|
||||
required
|
||||
/>
|
||||
<div id="id_text_feedback" class="${errorClass}">An error message</div>
|
||||
</form>
|
||||
`;
|
||||
document.body.appendChild(testDiv);
|
||||
textInput = document.querySelector(inputSelector);
|
||||
errorMsg = document.querySelector(errorSelector);
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
testDiv.remove();
|
||||
});
|
||||
|
||||
it("should have a useful html fixture", () => {
|
||||
console.log("in test 1");
|
||||
expect(errorMsg.checkVisibility()).toBe(true);
|
||||
});
|
||||
|
||||
it("should hide error message on input", () => {
|
||||
console.log("in test 2");
|
||||
initialize(inputSelector);
|
||||
textInput.dispatchEvent(new InputEvent("input"));
|
||||
|
||||
expect(errorMsg.checkVisibility()).toBe(false);
|
||||
});
|
||||
|
||||
it("should not hide error message before event is fired", () => {
|
||||
console.log("in test 3");
|
||||
initialize(inputSelector);
|
||||
|
||||
expect(errorMsg.checkVisibility()).toBe(true);
|
||||
});
|
||||
});
|
||||
34
src/static/tests/SpecRunner.html
Normal file
34
src/static/tests/SpecRunner.html
Normal file
@@ -0,0 +1,34 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta name="author" content="Disco DeDisco">
|
||||
<meta name="robots" content="noindex, nofollow">
|
||||
|
||||
<!-- Bootstrap CSS -->
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap/5.3.8/css/bootstrap.min.css"/>
|
||||
<link rel="stylesheet" href="lib/jasmine-6.0.1/jasmine.css">
|
||||
|
||||
<title>Jasmine Spec Runner</title>
|
||||
<link rel="stylesheet" href="lib/jasmine.css">
|
||||
|
||||
<!-- Jasmine -->
|
||||
<script src="lib/jasmine-6.0.1/jasmine.js"></script>
|
||||
<script src="lib/jasmine-6.0.1/jasmine-html.js"></script>
|
||||
<script src="lib/jasmine-6.0.1/boot0.js"></script>
|
||||
<!-- spec files -->
|
||||
<script src="Spec.js"></script>
|
||||
<!-- src files -->
|
||||
<script src="../../apps/dashboard/static/apps/scripts/dashboard.js"></script>
|
||||
<!-- Jasmine env config (optional) -->
|
||||
<script src="lib/jasmine-6.0.1/boot1.js"></script>
|
||||
|
||||
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
||||
68
src/static/tests/lib/jasmine-6.0.1/boot0.js
Normal file
68
src/static/tests/lib/jasmine-6.0.1/boot0.js
Normal file
@@ -0,0 +1,68 @@
|
||||
/*
|
||||
Copyright (c) 2008-2019 Pivotal Labs
|
||||
Copyright (c) 2008-2026 The Jasmine developers
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
"Software"), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
This file starts the process of "booting" Jasmine. It initializes Jasmine,
|
||||
makes its globals available, and creates the env. This file should be loaded
|
||||
after `jasmine.js` and `jasmine_html.js`, but before `boot1.js` or any project
|
||||
source files or spec files are loaded.
|
||||
*/
|
||||
(function() {
|
||||
const jasmineRequire = window.jasmineRequire || require('./jasmine.js');
|
||||
|
||||
/**
|
||||
* ## Require & Instantiate
|
||||
*
|
||||
* Require Jasmine's core files. Specifically, this requires and attaches all of Jasmine's code to the `jasmine` reference.
|
||||
*/
|
||||
const jasmine = jasmineRequire.core(jasmineRequire),
|
||||
global = jasmine.getGlobal();
|
||||
global.jasmine = jasmine;
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
jasmineRequire.html(jasmine);
|
||||
|
||||
/**
|
||||
* Create the Jasmine environment. This is used to run all specs in a project.
|
||||
*/
|
||||
const env = jasmine.getEnv();
|
||||
|
||||
/**
|
||||
* ## The Global Interface
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
const jasmineInterface = jasmineRequire.interface(jasmine, env);
|
||||
|
||||
/**
|
||||
* Add all of the Jasmine global/public interface to the global scope, so a project can use the public interface directly. For example, calling `describe` in specs instead of `jasmine.getEnv().describe`.
|
||||
*/
|
||||
for (const property in jasmineInterface) {
|
||||
global[property] = jasmineInterface[property];
|
||||
}
|
||||
})();
|
||||
64
src/static/tests/lib/jasmine-6.0.1/boot1.js
Normal file
64
src/static/tests/lib/jasmine-6.0.1/boot1.js
Normal file
@@ -0,0 +1,64 @@
|
||||
/*
|
||||
Copyright (c) 2008-2019 Pivotal Labs
|
||||
Copyright (c) 2008-2026 The Jasmine developers
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
"Software"), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
This file finishes 'booting' Jasmine, performing all of the necessary
|
||||
initialization before executing the loaded environment and all of a project's
|
||||
specs. This file should be loaded after `boot0.js` but before any project
|
||||
source files or spec files are loaded. Thus this file can also be used to
|
||||
customize Jasmine for a project.
|
||||
|
||||
If a project is using Jasmine via the standalone distribution, this file can
|
||||
be customized directly. If you only wish to configure the Jasmine env, you
|
||||
can load another file that calls `jasmine.getEnv().configure({...})`
|
||||
after `boot0.js` is loaded and before this file is loaded.
|
||||
*/
|
||||
|
||||
(function() {
|
||||
const env = jasmine.getEnv();
|
||||
const urls = new jasmine.HtmlReporterV2Urls();
|
||||
|
||||
/**
|
||||
* Configures Jasmine based on the current set of query parameters. This
|
||||
* supports all parameters set by the HTML reporter as well as
|
||||
* spec=partialPath, which filters out specs whose paths don't contain the
|
||||
* parameter.
|
||||
*/
|
||||
env.configure(urls.configFromCurrentUrl());
|
||||
|
||||
const currentWindowOnload = window.onload;
|
||||
window.onload = function() {
|
||||
if (currentWindowOnload) {
|
||||
currentWindowOnload();
|
||||
}
|
||||
|
||||
// The HTML reporter needs to be set up here so it can access the DOM. Other
|
||||
// reporters can be added at any time before env.execute() is called.
|
||||
const htmlReporter = new jasmine.HtmlReporterV2({ env, urls });
|
||||
env.addReporter(htmlReporter);
|
||||
env.execute();
|
||||
};
|
||||
})();
|
||||
1863
src/static/tests/lib/jasmine-6.0.1/jasmine-html.js
Normal file
1863
src/static/tests/lib/jasmine-6.0.1/jasmine-html.js
Normal file
File diff suppressed because it is too large
Load Diff
351
src/static/tests/lib/jasmine-6.0.1/jasmine.css
Normal file
351
src/static/tests/lib/jasmine-6.0.1/jasmine.css
Normal file
File diff suppressed because one or more lines are too long
12412
src/static/tests/lib/jasmine-6.0.1/jasmine.js
Normal file
12412
src/static/tests/lib/jasmine-6.0.1/jasmine.js
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user