Move everything to the _old directory and add the angular-cli generated

angular app scaffold.
This commit is contained in:
Manuel Friedli 2017-11-10 17:30:09 +01:00
parent a482920f44
commit e23cb55543
87 changed files with 6849 additions and 36 deletions

60
_old/test/.jshintrc Normal file
View file

@ -0,0 +1,60 @@
{
// Settings
"passfail" : false, // Stop on first error.
"maxerr" : 100, // Maximum error before stopping.
// Predefined globals whom JSHint will ignore.
"browser" : true, // Standard browser globals e.g. `window`, `document`.
"node" : true,
"jquery" : true,
"predef" : [
"suite",
"chai",
"setup",
"teardown",
"test"
],
// Development.
"debug" : false, // Allow debugger statements e.g. browser breakpoints.
"devel" : true, // Allow developments statements e.g. `console.log();`.
"strict" : true, // Require `use strict` pragma in every file.
"globalstrict" : false, // Allow global "use strict" (also enables 'strict').
// The Good Parts.
"asi" : false, // Tolerate Automatic Semicolon Insertion (no semicolons).
"laxbreak" : false, // Tolerate unsafe line breaks e.g. `return [\n] x` without semicolons.
"bitwise" : true, // Prohibit bitwise operators (&, |, ^, etc.).
"boss" : false, // Tolerate assignments inside if, for & while. Usually conditions & loops are for comparison, not assignments.
"curly" : true, // Require {} for every new block or scope.
"eqeqeq" : true, // Require triple equals i.e. `===`.
"eqnull" : false, // Tolerate use of `== null`.
"evil" : false, // Tolerate use of `eval`.
"expr" : false, // Tolerate `ExpressionStatement` as Programs.
"forin" : false, // Tolerate `for in` loops without `hasOwnPrototype`.
"immed" : true, // Require immediate invocations to be wrapped in parens e.g. `( function(){}() );`
"latedef" : true, // Prohipit variable use before definition.
"loopfunc" : false, // Allow functions to be defined within loops.
"noarg" : true, // Prohibit use of `arguments.caller` and `arguments.callee`.
"scripturl" : true, // Tolerate script-targeted URLs.
"shadow" : false, // Allows re-define variables later in code e.g. `var x=1; x=2;`.
"supernew" : false, // Tolerate `new function () { ... };` and `new Object;`.
"undef" : true, // Require all non-global variables be declared before they are used.
// Personal styling preferences.
"newcap" : true, // Require capitalization of all constructor functions e.g. `new F()`.
"noempty" : true, // Prohibit use of empty blocks.
"nonew" : true, // Prohibit use of constructors for side-effects.
"nomen" : true, // Prohibit use of initial or trailing underbars in names.
"onevar" : false, // Allow only one `var` statement per function.
"plusplus" : false, // Prohibit use of `++` & `--`.
"sub" : false, // Tolerate all forms of subscript notation besides dot notation e.g. `dict['key']` instead of `dict.key`.
"trailing" : true, // Prohibit trailing whitespaces.
"white" : true, // Check against strict whitespace and indentation rules.
"indent" : 0 // Specify indentation spacing
}

270
_old/test/css/mocha.css Normal file
View file

@ -0,0 +1,270 @@
@charset "utf-8";
body {
margin:0;
}
#mocha {
font: 20px/1.5 "Helvetica Neue", Helvetica, Arial, sans-serif;
margin: 60px 50px;
}
#mocha ul,
#mocha li {
margin: 0;
padding: 0;
}
#mocha ul {
list-style: none;
}
#mocha h1,
#mocha h2 {
margin: 0;
}
#mocha h1 {
margin-top: 15px;
font-size: 1em;
font-weight: 200;
}
#mocha h1 a {
text-decoration: none;
color: inherit;
}
#mocha h1 a:hover {
text-decoration: underline;
}
#mocha .suite .suite h1 {
margin-top: 0;
font-size: .8em;
}
#mocha .hidden {
display: none;
}
#mocha h2 {
font-size: 12px;
font-weight: normal;
cursor: pointer;
}
#mocha .suite {
margin-left: 15px;
}
#mocha .test {
margin-left: 15px;
overflow: hidden;
}
#mocha .test.pending:hover h2::after {
content: '(pending)';
font-family: arial, sans-serif;
}
#mocha .test.pass.medium .duration {
background: #c09853;
}
#mocha .test.pass.slow .duration {
background: #b94a48;
}
#mocha .test.pass::before {
content: '✓';
font-size: 12px;
display: block;
float: left;
margin-right: 5px;
color: #00d6b2;
}
#mocha .test.pass .duration {
font-size: 9px;
margin-left: 5px;
padding: 2px 5px;
color: #fff;
-webkit-box-shadow: inset 0 1px 1px rgba(0,0,0,.2);
-moz-box-shadow: inset 0 1px 1px rgba(0,0,0,.2);
box-shadow: inset 0 1px 1px rgba(0,0,0,.2);
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
-ms-border-radius: 5px;
-o-border-radius: 5px;
border-radius: 5px;
}
#mocha .test.pass.fast .duration {
display: none;
}
#mocha .test.pending {
color: #0b97c4;
}
#mocha .test.pending::before {
content: '◦';
color: #0b97c4;
}
#mocha .test.fail {
color: #c00;
}
#mocha .test.fail pre {
color: black;
}
#mocha .test.fail::before {
content: '✖';
font-size: 12px;
display: block;
float: left;
margin-right: 5px;
color: #c00;
}
#mocha .test pre.error {
color: #c00;
max-height: 300px;
overflow: auto;
}
/**
* (1): approximate for browsers not supporting calc
* (2): 42 = 2*15 + 2*10 + 2*1 (padding + margin + border)
* ^^ seriously
*/
#mocha .test pre {
display: block;
float: left;
clear: left;
font: 12px/1.5 monaco, monospace;
margin: 5px;
padding: 15px;
border: 1px solid #eee;
max-width: 85%; /*(1)*/
max-width: calc(100% - 42px); /*(2)*/
word-wrap: break-word;
border-bottom-color: #ddd;
-webkit-border-radius: 3px;
-webkit-box-shadow: 0 1px 3px #eee;
-moz-border-radius: 3px;
-moz-box-shadow: 0 1px 3px #eee;
border-radius: 3px;
}
#mocha .test h2 {
position: relative;
}
#mocha .test a.replay {
position: absolute;
top: 3px;
right: 0;
text-decoration: none;
vertical-align: middle;
display: block;
width: 15px;
height: 15px;
line-height: 15px;
text-align: center;
background: #eee;
font-size: 15px;
-moz-border-radius: 15px;
border-radius: 15px;
-webkit-transition: opacity 200ms;
-moz-transition: opacity 200ms;
transition: opacity 200ms;
opacity: 0.3;
color: #888;
}
#mocha .test:hover a.replay {
opacity: 1;
}
#mocha-report.pass .test.fail {
display: none;
}
#mocha-report.fail .test.pass {
display: none;
}
#mocha-report.pending .test.pass,
#mocha-report.pending .test.fail {
display: none;
}
#mocha-report.pending .test.pass.pending {
display: block;
}
#mocha-error {
color: #c00;
font-size: 1.5em;
font-weight: 100;
letter-spacing: 1px;
}
#mocha-stats {
position: fixed;
top: 15px;
right: 10px;
font-size: 12px;
margin: 0;
color: #888;
z-index: 1;
}
#mocha-stats .progress {
float: right;
padding-top: 0;
}
#mocha-stats em {
color: black;
}
#mocha-stats a {
text-decoration: none;
color: inherit;
}
#mocha-stats a:hover {
border-bottom: 1px solid #eee;
}
#mocha-stats li {
display: inline-block;
margin: 0 5px;
list-style: none;
padding-top: 11px;
}
#mocha-stats canvas {
width: 40px;
height: 40px;
}
#mocha code .comment { color: #ddd; }
#mocha code .init { color: #2f6fad; }
#mocha code .string { color: #5890ad; }
#mocha code .keyword { color: #8a6343; }
#mocha code .number { color: #2f6fad; }
@media screen and (max-device-width: 480px) {
#mocha {
margin: 60px 0px;
}
#mocha #stats {
position: absolute;
}
}

View file

@ -0,0 +1,76 @@
<!DOCTYPE html>
<!--
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
-->
<html lang="de" manifest="manifest.appcache">
<head>
<title>Fastforward bärneruhr.ch</title>
<meta charset="utf-8"/>
<meta name="apple-mobile-web-app-capable" content="yes"/>
<meta name="apple-mobile-web-app-status-bar-style" content="black"/>
<meta name="apple-mobile-web-app-title" content="Bärneruhr"/>
<meta name="viewport" content="width=device-width,user-scalable=no,initial-scale=1"/>
<link rel="stylesheet" type="text/css" href="../dist/uhr.min.css"/>
<link rel="stylesheet" type="text/css" href="../dist/uhr-black.min.css" data-class="black" data-name="Schwarz"/>
<link rel="stylesheet" type="text/css" href="../dist/uhr-white.min.css" data-class="white" data-name="Weiss"/>
<link rel="stylesheet" type="text/css" href="../dist/uhr-red.min.css" data-class="red" data-name="Rot"/>
<link rel="stylesheet" type="text/css" href="../dist/uhr-yellow.min.css" data-class="yellow" data-name="Gelb"/>
<link rel="stylesheet" type="text/css" href="../dist/uhr-green.min.css" data-class="green" data-name="Grün"/>
<link rel="stylesheet" type="text/css" href="../dist/uhr-blue.min.css" data-class="blue" data-name="Blau"/>
<link rel="stylesheet" type="text/css" href="../dist/uhr-pink.min.css" data-class="pink" data-name="Pink"/>
<link rel="shortcut icon" type="image/png" href="../resources/favicon.png"/>
<link rel="apple-touch-icon-precomposed" href="../resources/apple-touch-icon-precomposed.png"/>
<script type="text/javascript" src="../dist/libs.min.js"></script>
<script type="text/javascript" src="../dist/jquery.uhr.complete.min.js"></script>
</head>
<body>
<div id="uhr"></div>
<button id="timer">Start</button>
<button id="reset">Reset</button>
<script type="text/javascript">
(function ($) {
var time = new Date(2000, 0, 1, 0, 0, 0, 0);
var timer = null;
$('#timer').on('click', function () {
if (timer == null) {
timer = window.setInterval(function () {
var minutes = time.getMinutes();
var hours = time.getHours();
minutes = (minutes + 1) % 60;
if (minutes == 0) {
hours = (hours + 1) % 24;
time.setHours(hours);
}
time.setMinutes(minutes);
$('#uhr').uhr('time', time);
}, 200);
$('#timer').html('Pause');
} else {
window.clearInterval(timer);
timer = null;
$('#timer').html('Start');
}
});
$('#reset').on('click', function () {
time = new Date(2000, 0, 1, 0, 0, 0, 0);
$('#uhr').uhr('time', time);
});
$('#uhr').uhr({
width: '200px',
time: time
});
})(jQuery);
</script>
</body>
</html>

4782
_old/test/lib/chai.js Normal file

File diff suppressed because it is too large Load diff

5842
_old/test/lib/mocha.js Normal file

File diff suppressed because it is too large Load diff

48
_old/test/test.html Normal file
View file

@ -0,0 +1,48 @@
<!DOCTYPE html>
<!--
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
-->
<html>
<head lang="en">
<meta charset="UTF-8">
<title>Test bärneruhr.ch</title>
<link rel="stylesheet" type="text/css" href="css/mocha.css"/>
<link rel="stylesheet" type="text/css" href="../css/uhr.css"/>
<link rel="stylesheet" type="text/css" href="../css/uhr-black.css" data-class="black"/>
<link rel="stylesheet" type="text/css" href="../css/uhr-red.css" data-class="red"/>
<link rel="stylesheet" type="text/css" href="../css/uhr-pink.css" data-class="pink"/>
</head>
<body>
<div id="u"></div>
<div id="mocha"></div>
<script type="text/javascript" src="lib/mocha.js"></script>
<script type="text/javascript" src="lib/chai.js"></script>
<script type="text/javascript" src="../dist/libs.js"></script>
<script type="text/javascript" src="../dist/jquery.uhr.complete.js"></script>
<script type="text/javascript">
mocha.setup('tdd');
</script>
<script type="text/javascript" src="test.js"></script>
<script type="text/javascript">
// mocha.checkLeaks();
// mocha.globals(['jQuery*']);
if (window.mochaPhantomJS) {
mochaPhantomJS.run();
}
else {
mocha.run();
}
</script>
</body>
</html>

139
_old/test/test.js Normal file
View file

@ -0,0 +1,139 @@
suite('Bärneruhr', function () {
'use strict';
var assert = chai.assert;
var $ = jQuery;
var elem;
setup(function () {
elem = $('#u');
});
teardown(function () {
var uhr = elem.uhr('instance');
if (uhr !== undefined) {
cleanupCookies(uhr.id);
}
try {
elem.uhr('destroy');
} catch (e) {
// just TRY to clean up, but don't DIE trying.
}
window.location.hash = '';
});
function cleanupCookies(id) {
$.removeCookie('uhr-language' + id);
$.removeCookie('uhr-mode' + id);
$.removeCookie('uhr-status' + id);
$.removeCookie('uhr-theme' + id);
}
test('create and destroy widget', function () {
var uhr = elem.uhr('instance');
var id;
assert.isUndefined(uhr);
elem.uhr();
uhr = elem.uhr('instance');
assert.isNotNull(uhr);
assert.isDefined(uhr);
id = uhr.id;
elem.uhr('destroy');
uhr = elem.uhr('instance');
assert.isUndefined(uhr);
// cookies need to be cleaned up separately in this case, because in teardown(), the uhr widget doesn't exist anymore
cleanupCookies(id);
});
test('default config', function () {
var options;
elem.uhr();
options = elem.uhr('instance').options;
assert.isTrue(options.autoresize);
assert.isTrue(options.controls);
assert.isUndefined(options.cookiePath);
assert.isFalse(options.force);
assert.equal(options.language, 'de_CH');
assert.equal(options.mode, 'normal');
assert.equal(options.status, 'on');
assert.equal(options.theme, 'black');
});
test('custom config', function () {
var options;
var realWidth;
var myWidth = 100;
var myOptions = {
autoresize: false,
controls: false,
cookiePath: '/foo/bar',
force: true,
language: 'de',
mode: 'seconds',
status: 'off',
theme: 'red',
width: myWidth + 'px'
};
elem.uhr(myOptions);
options = elem.uhr('instance').options;
assert.equal(options.autoresize, myOptions.autoresize);
assert.equal(options.controls, myOptions.controls);
assert.equal(options.cookiePath, myOptions.cookiePath);
assert.equal(options.force, myOptions.force);
assert.equal(options.language, myOptions.language);
assert.equal(options.mode, myOptions.mode);
assert.equal(options.status, myOptions.status);
assert.equal(options.theme, myOptions.theme);
assert.equal(options.width, myOptions.width);
realWidth = elem.width();
assert.equal(myWidth, realWidth);
});
test('unknown language', function () {
var uhr;
elem.uhr({
language: 'klingon'
});
uhr = elem.uhr('instance');
// NB: 'de' is just the first language that is included in the page. that may change!
assert.equal(uhr.options.language, 'de');
});
test('unknown theme', function () {
var uhr;
elem.uhr({
theme: 'klingon'
});
uhr = elem.uhr('instance');
// NB: 'black' is the first theme that is included in the test page.
assert.equal(uhr.options.theme, 'black');
});
test('URL params, short', function () {
var options;
window.location.hash = '#t=red&l=dk&m=seconds&s=on';
elem.uhr();
options = elem.uhr('instance').options;
assert.isTrue(options.force);
assert.equal(options.language, 'dk');
assert.equal(options.mode, 'seconds');
assert.equal(options.status, 'on');
assert.equal(options.theme, 'red');
});
test('URL params, long', function () {
var options;
window.location.hash = '#theme=pink&language=de_CH&mode=normal&status=off';
elem.uhr();
options = elem.uhr('instance').options;
assert.isTrue(options.force);
assert.equal(options.language, 'de_CH');
assert.equal(options.mode, 'normal');
assert.equal(options.status, 'off');
assert.equal(options.theme, 'pink');
});
});