added the first two test methods that actually work!
This commit is contained in:
parent
51d21d8ff6
commit
0c7aebc200
15 changed files with 248 additions and 305 deletions
283
Gruntfile.js
283
Gruntfile.js
|
@ -1,150 +1,147 @@
|
||||||
module.exports = function (grunt) {
|
module.exports = function (grunt) {
|
||||||
'use strict';
|
'use strict';
|
||||||
// Load all grunt tasks
|
// Load all grunt tasks
|
||||||
require('load-grunt-tasks')(grunt);
|
require('load-grunt-tasks')(grunt);
|
||||||
// Show elapsed time at the end
|
// Show elapsed time at the end
|
||||||
require('time-grunt')(grunt);
|
require('time-grunt')(grunt);
|
||||||
|
|
||||||
// Project configuration.
|
// Project configuration.
|
||||||
grunt.initConfig({
|
grunt.initConfig({
|
||||||
// Metadata.
|
// Metadata.
|
||||||
pkg: grunt.file.readJSON('package.json'),
|
pkg: grunt.file.readJSON('package.json'),
|
||||||
banner: '/*! <%= pkg.name %> - v<%= pkg.version %> - ' +
|
banner: '/*! <%= pkg.name %> - v<%= pkg.version %> - ' +
|
||||||
'<%= grunt.template.today("yyyy-mm-dd") %>\n' +
|
'<%= grunt.template.today("yyyy-mm-dd") %>\n' +
|
||||||
'<%= pkg.homepage ? "* " + pkg.homepage + "\\n" : "" %>' +
|
'<%= pkg.homepage ? "* " + pkg.homepage + "\\n" : "" %>' +
|
||||||
'* Copyright (c) <%= grunt.template.today("yyyy") %> <%= pkg.author.name %>;' +
|
'* Copyright (c) <%= grunt.template.today("yyyy") %> <%= pkg.author.name %>;' +
|
||||||
' Licensed <%= pkg.licenses[0].type %> */\n',
|
' Licensed <%= pkg.licenses[0].type %> */\n',
|
||||||
// Task configuration.
|
// Task configuration.
|
||||||
clean: {
|
clean: {
|
||||||
files: ['dist']
|
files: ['dist']
|
||||||
},
|
|
||||||
concat: {
|
|
||||||
options: {
|
|
||||||
banner: '<%= banner %>',
|
|
||||||
stripBanners: true
|
|
||||||
},
|
|
||||||
libs: {
|
|
||||||
src: [
|
|
||||||
'bower_components/jquery/dist/jquery.js',
|
|
||||||
'bower_components/jquery-ui/ui/core.js',
|
|
||||||
'bower_components/jquery-ui/ui/widget.js',
|
|
||||||
'bower_components/jquery-cookie/jquery.cookie.js'
|
|
||||||
],
|
|
||||||
dest: 'dist/libs.js'
|
|
||||||
},
|
|
||||||
dist: {
|
|
||||||
src: ['src/uhr.js', 'src/uhr-*.js'],
|
|
||||||
dest: 'dist/jquery.<%= pkg.name %>.complete.js'
|
|
||||||
},
|
|
||||||
main: {
|
|
||||||
src: ['src/uhr.js'],
|
|
||||||
dest: 'dist/jquery.<%= pkg.name %>.main.js'
|
|
||||||
},
|
|
||||||
base: {
|
|
||||||
src: ['src/uhr.js', 'src/uhr-de_CH.js'],
|
|
||||||
dest: 'dist/jquery.<%= pkg.name %>.base.js'
|
|
||||||
},
|
|
||||||
baselangs: {
|
|
||||||
src: ['src/uhr-*.js'],
|
|
||||||
exclude: ['src/uhr-de_CH.js'],
|
|
||||||
dest: 'dist/jquery.<%= pkg.name %>.baselangs.js'
|
|
||||||
},
|
|
||||||
langs: {
|
|
||||||
src: ['src/uhr-*.js'],
|
|
||||||
dest: 'dist/jquery.<%= pkg.name %>.langs.js'
|
|
||||||
}
|
|
||||||
},
|
|
||||||
uglify: {
|
|
||||||
options: {
|
|
||||||
banner: '<%= banner %>'
|
|
||||||
},
|
|
||||||
libs:{
|
|
||||||
src: '<%= concat.libs.dest %>',
|
|
||||||
dest: 'dist/libs.min.js'
|
|
||||||
},
|
|
||||||
dist: {
|
|
||||||
src: '<%= concat.dist.dest %>',
|
|
||||||
dest: 'dist/jquery.<%= pkg.name %>.complete.min.js'
|
|
||||||
},
|
|
||||||
main: {
|
|
||||||
src: '<%= concat.main.dest %>',
|
|
||||||
dest: 'dist/jquery.<%= pkg.name %>.main.min.js'
|
|
||||||
},
|
|
||||||
base: {
|
|
||||||
src: '<%= concat.base.dest %>',
|
|
||||||
dest: 'dist/jquery.<%= pkg.name %>.base.min.js'
|
|
||||||
},
|
|
||||||
baselangs: {
|
|
||||||
src: '<%= concat.baselangs.dest %>',
|
|
||||||
dest: 'dist/jquery.<%= pkg.name %>.baselangs.min.js'
|
|
||||||
},
|
|
||||||
langs: {
|
|
||||||
src: '<%= concat.langs.dest %>',
|
|
||||||
dest: 'dist/jquery.<%= pkg.name %>.langs.min.js'
|
|
||||||
}
|
|
||||||
},
|
|
||||||
qunit: {
|
|
||||||
all: {
|
|
||||||
options: {
|
|
||||||
urls: ['http://localhost:9000/test/<%= pkg.name %>.html']
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
jshint: {
|
|
||||||
options: {
|
|
||||||
reporter: require('jshint-stylish')
|
|
||||||
},
|
|
||||||
gruntfile: {
|
|
||||||
options: {
|
|
||||||
jshintrc: '.jshintrc'
|
|
||||||
},
|
},
|
||||||
src: 'Gruntfile.js'
|
concat: {
|
||||||
},
|
options: {
|
||||||
src: {
|
banner: '<%= banner %>',
|
||||||
options: {
|
stripBanners: true
|
||||||
jshintrc: '.jshintrc'
|
},
|
||||||
|
libs: {
|
||||||
|
src: [
|
||||||
|
'bower_components/jquery/dist/jquery.js',
|
||||||
|
'bower_components/jquery-ui/ui/core.js',
|
||||||
|
'bower_components/jquery-ui/ui/widget.js',
|
||||||
|
'bower_components/jquery-cookie/jquery.cookie.js'
|
||||||
|
],
|
||||||
|
dest: 'dist/libs.js'
|
||||||
|
},
|
||||||
|
dist: {
|
||||||
|
src: ['src/uhr.js', 'src/uhr-*.js'],
|
||||||
|
dest: 'dist/jquery.<%= pkg.name %>.complete.js'
|
||||||
|
},
|
||||||
|
main: {
|
||||||
|
src: ['src/uhr.js'],
|
||||||
|
dest: 'dist/jquery.<%= pkg.name %>.main.js'
|
||||||
|
},
|
||||||
|
base: {
|
||||||
|
src: ['src/uhr.js', 'src/uhr-de_CH.js'],
|
||||||
|
dest: 'dist/jquery.<%= pkg.name %>.base.js'
|
||||||
|
},
|
||||||
|
baselangs: {
|
||||||
|
src: ['src/uhr-*.js'],
|
||||||
|
exclude: ['src/uhr-de_CH.js'],
|
||||||
|
dest: 'dist/jquery.<%= pkg.name %>.baselangs.js'
|
||||||
|
},
|
||||||
|
langs: {
|
||||||
|
src: ['src/uhr-*.js'],
|
||||||
|
dest: 'dist/jquery.<%= pkg.name %>.langs.js'
|
||||||
|
}
|
||||||
},
|
},
|
||||||
src: ['src/**/*.js']
|
uglify: {
|
||||||
// },
|
options: {
|
||||||
// test: {
|
banner: '<%= banner %>'
|
||||||
// options: {
|
},
|
||||||
// jshintrc: 'test/.jshintrc'
|
libs: {
|
||||||
// },
|
src: '<%= concat.libs.dest %>',
|
||||||
// src: ['test/**/*.js']
|
dest: 'dist/libs.min.js'
|
||||||
}
|
},
|
||||||
},
|
dist: {
|
||||||
watch: {
|
src: '<%= concat.dist.dest %>',
|
||||||
gruntfile: {
|
dest: 'dist/jquery.<%= pkg.name %>.complete.min.js'
|
||||||
files: '<%= jshint.gruntfile.src %>',
|
},
|
||||||
tasks: ['jshint:gruntfile']
|
main: {
|
||||||
},
|
src: '<%= concat.main.dest %>',
|
||||||
src: {
|
dest: 'dist/jquery.<%= pkg.name %>.main.min.js'
|
||||||
files: '<%= jshint.src.src %>',
|
},
|
||||||
tasks: ['jshint:src', 'qunit']
|
base: {
|
||||||
},
|
src: '<%= concat.base.dest %>',
|
||||||
test: {
|
dest: 'dist/jquery.<%= pkg.name %>.base.min.js'
|
||||||
files: '<%= jshint.test.src %>',
|
},
|
||||||
tasks: ['jshint:test', 'qunit']
|
baselangs: {
|
||||||
}
|
src: '<%= concat.baselangs.dest %>',
|
||||||
},
|
dest: 'dist/jquery.<%= pkg.name %>.baselangs.min.js'
|
||||||
connect: {
|
},
|
||||||
server: {
|
langs: {
|
||||||
options: {
|
src: '<%= concat.langs.dest %>',
|
||||||
hostname: '*',
|
dest: 'dist/jquery.<%= pkg.name %>.langs.min.js'
|
||||||
port: 9000
|
}
|
||||||
|
},
|
||||||
|
mocha_phantomjs: {
|
||||||
|
all:{
|
||||||
|
options: {
|
||||||
|
urls: ['http://localhost:9000/test/test.html']
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
jshint: {
|
||||||
|
options: {
|
||||||
|
reporter: require('jshint-stylish')
|
||||||
|
},
|
||||||
|
gruntfile: {
|
||||||
|
options: {
|
||||||
|
jshintrc: '.jshintrc'
|
||||||
|
},
|
||||||
|
src: 'Gruntfile.js'
|
||||||
|
},
|
||||||
|
src: {
|
||||||
|
options: {
|
||||||
|
jshintrc: '.jshintrc'
|
||||||
|
},
|
||||||
|
src: ['src/**/*.js']
|
||||||
|
},
|
||||||
|
test: {
|
||||||
|
src: ['test/*.js']
|
||||||
|
}
|
||||||
|
},
|
||||||
|
watch: {
|
||||||
|
gruntfile: {
|
||||||
|
files: '<%= jshint.gruntfile.src %>',
|
||||||
|
tasks: ['jshint:gruntfile']
|
||||||
|
},
|
||||||
|
src: {
|
||||||
|
files: '<%= jshint.src.src %>',
|
||||||
|
tasks: ['jshint:src', 'mocha_phantomjs']
|
||||||
|
},
|
||||||
|
test: {
|
||||||
|
files: ['test/test.html', '<%= jshint.test.src %>'],
|
||||||
|
tasks: ['jshint:test', 'mocha_phantomjs']
|
||||||
|
}
|
||||||
|
},
|
||||||
|
connect: {
|
||||||
|
server: {
|
||||||
|
options: {
|
||||||
|
hostname: '*',
|
||||||
|
port: 9000
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// Default task.
|
grunt.loadNpmTasks('grunt-mocha-phantomjs');
|
||||||
// grunt.registerTask('default', ['jshint', 'connect', 'qunit', 'clean', 'concat', 'uglify']);
|
// Default task.
|
||||||
grunt.registerTask('default', ['jshint', 'connect', /*'qunit', */'clean', 'concat', 'uglify']);
|
grunt.registerTask('default', ['jshint', 'connect', 'mocha_phantomjs', 'clean', 'concat', 'uglify']);
|
||||||
grunt.registerTask('buildonly', ['clean', 'concat', 'uglify']);
|
grunt.registerTask('buildonly', ['clean', 'concat', 'uglify']);
|
||||||
grunt.registerTask('server', function () {
|
grunt.registerTask('server', function () {
|
||||||
grunt.log.warn('The `server` task has been deprecated. Use `grunt serve` to start a server.');
|
grunt.log.warn('The `server` task has been deprecated. Use `grunt serve` to start a server.');
|
||||||
grunt.task.run(['serve']);
|
grunt.task.run(['serve']);
|
||||||
});
|
});
|
||||||
grunt.registerTask('serve', ['connect', 'watch']);
|
grunt.registerTask('serve', ['connect', 'watch']);
|
||||||
grunt.registerTask('test', ['jshint', 'connect', 'qunit']);
|
grunt.registerTask('test', ['jshint', 'connect', 'mocha_phantomjs']);
|
||||||
};
|
};
|
||||||
|
|
21
bower.json
21
bower.json
|
@ -1,12 +1,13 @@
|
||||||
{
|
{
|
||||||
"name": "uhr",
|
"name": "uhr",
|
||||||
"version": "0.0.1",
|
"version": "7.0.0-next",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"jquery-ui": "~1.11.2",
|
"jquery": "~2.1.3",
|
||||||
"jquery-cookie": "~1.4.1"
|
"jquery-ui": "~1.11.2",
|
||||||
},
|
"jquery-cookie": "~1.4.1"
|
||||||
"devDependencies": {
|
},
|
||||||
"qunit": "~1.12.0",
|
"devDependencies": {
|
||||||
"jquery": "~2.1.3"
|
"mocha": "~2.1.0",
|
||||||
}
|
"chai": "~1.10.0"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
14
dist/jquery.uhr.base.js
vendored
14
dist/jquery.uhr.base.js
vendored
|
@ -333,6 +333,16 @@
|
||||||
}.bind(this));
|
}.bind(this));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
var destroy = function destroy() {
|
||||||
|
this.timer = null;
|
||||||
|
$(this.element)
|
||||||
|
.removeAttr('style')
|
||||||
|
.removeAttr('class')
|
||||||
|
.empty();
|
||||||
|
$('#uhr-configlink' + this.id).remove();
|
||||||
|
$('#uhr-controlpanel' + this.id).remove();
|
||||||
|
|
||||||
|
};
|
||||||
var setCookie = function setCookie(cookieName, cookieValue) {
|
var setCookie = function setCookie(cookieName, cookieValue) {
|
||||||
var options = {};
|
var options = {};
|
||||||
if (this.options.cookiePath !== undefined) {
|
if (this.options.cookiePath !== undefined) {
|
||||||
|
@ -446,7 +456,9 @@
|
||||||
"mode": setMode,
|
"mode": setMode,
|
||||||
"width": setWidth,
|
"width": setWidth,
|
||||||
// constructor method
|
// constructor method
|
||||||
"_create": create
|
"_create": create,
|
||||||
|
// destructor method
|
||||||
|
"_destroy": destroy
|
||||||
});
|
});
|
||||||
$.fritteli.uhr.register = uhrGlobals.registerLanguage;
|
$.fritteli.uhr.register = uhrGlobals.registerLanguage;
|
||||||
/**
|
/**
|
||||||
|
|
2
dist/jquery.uhr.base.min.js
vendored
2
dist/jquery.uhr.base.min.js
vendored
File diff suppressed because one or more lines are too long
14
dist/jquery.uhr.complete.js
vendored
14
dist/jquery.uhr.complete.js
vendored
|
@ -333,6 +333,16 @@
|
||||||
}.bind(this));
|
}.bind(this));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
var destroy = function destroy() {
|
||||||
|
this.timer = null;
|
||||||
|
$(this.element)
|
||||||
|
.removeAttr('style')
|
||||||
|
.removeAttr('class')
|
||||||
|
.empty();
|
||||||
|
$('#uhr-configlink' + this.id).remove();
|
||||||
|
$('#uhr-controlpanel' + this.id).remove();
|
||||||
|
|
||||||
|
};
|
||||||
var setCookie = function setCookie(cookieName, cookieValue) {
|
var setCookie = function setCookie(cookieName, cookieValue) {
|
||||||
var options = {};
|
var options = {};
|
||||||
if (this.options.cookiePath !== undefined) {
|
if (this.options.cookiePath !== undefined) {
|
||||||
|
@ -446,7 +456,9 @@
|
||||||
"mode": setMode,
|
"mode": setMode,
|
||||||
"width": setWidth,
|
"width": setWidth,
|
||||||
// constructor method
|
// constructor method
|
||||||
"_create": create
|
"_create": create,
|
||||||
|
// destructor method
|
||||||
|
"_destroy": destroy
|
||||||
});
|
});
|
||||||
$.fritteli.uhr.register = uhrGlobals.registerLanguage;
|
$.fritteli.uhr.register = uhrGlobals.registerLanguage;
|
||||||
/**
|
/**
|
||||||
|
|
2
dist/jquery.uhr.complete.min.js
vendored
2
dist/jquery.uhr.complete.min.js
vendored
File diff suppressed because one or more lines are too long
14
dist/jquery.uhr.main.js
vendored
14
dist/jquery.uhr.main.js
vendored
|
@ -333,6 +333,16 @@
|
||||||
}.bind(this));
|
}.bind(this));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
var destroy = function destroy() {
|
||||||
|
this.timer = null;
|
||||||
|
$(this.element)
|
||||||
|
.removeAttr('style')
|
||||||
|
.removeAttr('class')
|
||||||
|
.empty();
|
||||||
|
$('#uhr-configlink' + this.id).remove();
|
||||||
|
$('#uhr-controlpanel' + this.id).remove();
|
||||||
|
|
||||||
|
};
|
||||||
var setCookie = function setCookie(cookieName, cookieValue) {
|
var setCookie = function setCookie(cookieName, cookieValue) {
|
||||||
var options = {};
|
var options = {};
|
||||||
if (this.options.cookiePath !== undefined) {
|
if (this.options.cookiePath !== undefined) {
|
||||||
|
@ -446,7 +456,9 @@
|
||||||
"mode": setMode,
|
"mode": setMode,
|
||||||
"width": setWidth,
|
"width": setWidth,
|
||||||
// constructor method
|
// constructor method
|
||||||
"_create": create
|
"_create": create,
|
||||||
|
// destructor method
|
||||||
|
"_destroy": destroy
|
||||||
});
|
});
|
||||||
$.fritteli.uhr.register = uhrGlobals.registerLanguage;
|
$.fritteli.uhr.register = uhrGlobals.registerLanguage;
|
||||||
/**
|
/**
|
||||||
|
|
2
dist/jquery.uhr.main.min.js
vendored
2
dist/jquery.uhr.main.min.js
vendored
File diff suppressed because one or more lines are too long
4
lib/jquery-2.1.0.min.js
vendored
4
lib/jquery-2.1.0.min.js
vendored
File diff suppressed because one or more lines are too long
|
@ -1,117 +0,0 @@
|
||||||
/*!
|
|
||||||
* jQuery Cookie Plugin v1.4.0
|
|
||||||
* https://github.com/carhartl/jquery-cookie
|
|
||||||
*
|
|
||||||
* Copyright 2013 Klaus Hartl
|
|
||||||
* Released under the MIT license
|
|
||||||
*/
|
|
||||||
(function (factory) {
|
|
||||||
if (typeof define === 'function' && define.amd) {
|
|
||||||
// AMD. Register as anonymous module.
|
|
||||||
define(['jquery'], factory);
|
|
||||||
} else {
|
|
||||||
// Browser globals.
|
|
||||||
factory(jQuery);
|
|
||||||
}
|
|
||||||
}(function ($) {
|
|
||||||
|
|
||||||
var pluses = /\+/g;
|
|
||||||
|
|
||||||
function encode(s) {
|
|
||||||
return config.raw ? s : encodeURIComponent(s);
|
|
||||||
}
|
|
||||||
|
|
||||||
function decode(s) {
|
|
||||||
return config.raw ? s : decodeURIComponent(s);
|
|
||||||
}
|
|
||||||
|
|
||||||
function stringifyCookieValue(value) {
|
|
||||||
return encode(config.json ? JSON.stringify(value) : String(value));
|
|
||||||
}
|
|
||||||
|
|
||||||
function parseCookieValue(s) {
|
|
||||||
if (s.indexOf('"') === 0) {
|
|
||||||
// This is a quoted cookie as according to RFC2068, unescape...
|
|
||||||
s = s.slice(1, -1).replace(/\\"/g, '"').replace(/\\\\/g, '\\');
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
// Replace server-side written pluses with spaces.
|
|
||||||
// If we can't decode the cookie, ignore it, it's unusable.
|
|
||||||
s = decodeURIComponent(s.replace(pluses, ' '));
|
|
||||||
} catch(e) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
// If we can't parse the cookie, ignore it, it's unusable.
|
|
||||||
return config.json ? JSON.parse(s) : s;
|
|
||||||
} catch(e) {}
|
|
||||||
}
|
|
||||||
|
|
||||||
function read(s, converter) {
|
|
||||||
var value = config.raw ? s : parseCookieValue(s);
|
|
||||||
return $.isFunction(converter) ? converter(value) : value;
|
|
||||||
}
|
|
||||||
|
|
||||||
var config = $.cookie = function (key, value, options) {
|
|
||||||
|
|
||||||
// Write
|
|
||||||
if (value !== undefined && !$.isFunction(value)) {
|
|
||||||
options = $.extend({}, config.defaults, options);
|
|
||||||
|
|
||||||
if (typeof options.expires === 'number') {
|
|
||||||
var days = options.expires, t = options.expires = new Date();
|
|
||||||
t.setDate(t.getDate() + days);
|
|
||||||
}
|
|
||||||
|
|
||||||
return (document.cookie = [
|
|
||||||
encode(key), '=', stringifyCookieValue(value),
|
|
||||||
options.expires ? '; expires=' + options.expires.toUTCString() : '', // use expires attribute, max-age is not supported by IE
|
|
||||||
options.path ? '; path=' + options.path : '',
|
|
||||||
options.domain ? '; domain=' + options.domain : '',
|
|
||||||
options.secure ? '; secure' : ''
|
|
||||||
].join(''));
|
|
||||||
}
|
|
||||||
|
|
||||||
// Read
|
|
||||||
|
|
||||||
var result = key ? undefined : {};
|
|
||||||
|
|
||||||
// To prevent the for loop in the first place assign an empty array
|
|
||||||
// in case there are no cookies at all. Also prevents odd result when
|
|
||||||
// calling $.cookie().
|
|
||||||
var cookies = document.cookie ? document.cookie.split('; ') : [];
|
|
||||||
|
|
||||||
for (var i = 0, l = cookies.length; i < l; i++) {
|
|
||||||
var parts = cookies[i].split('=');
|
|
||||||
var name = decode(parts.shift());
|
|
||||||
var cookie = parts.join('=');
|
|
||||||
|
|
||||||
if (key && key === name) {
|
|
||||||
// If second argument (value) is a function it's a converter...
|
|
||||||
result = read(cookie, value);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Prevent storing a cookie that we couldn't decode.
|
|
||||||
if (!key && (cookie = read(cookie)) !== undefined) {
|
|
||||||
result[name] = cookie;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
|
||||||
};
|
|
||||||
|
|
||||||
config.defaults = {};
|
|
||||||
|
|
||||||
$.removeCookie = function (key, options) {
|
|
||||||
if ($.cookie(key) !== undefined) {
|
|
||||||
// Must not alter options, thus extending a fresh object...
|
|
||||||
$.cookie(key, '', $.extend({}, options, { expires: -1 }));
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
};
|
|
||||||
|
|
||||||
}));
|
|
6
lib/jquery-ui-1.10.4.custom.min.js
vendored
6
lib/jquery-ui-1.10.4.custom.min.js
vendored
File diff suppressed because one or more lines are too long
|
@ -3,7 +3,8 @@
|
||||||
"version": "7.0.0-next",
|
"version": "7.0.0-next",
|
||||||
"description": "jQuery QLOCKTWO plugin",
|
"description": "jQuery QLOCKTWO plugin",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"jquery-plugin", "qlocktwo"
|
"jquery-plugin",
|
||||||
|
"qlocktwo"
|
||||||
],
|
],
|
||||||
"homepage": "http://bärneruhr.ch/",
|
"homepage": "http://bärneruhr.ch/",
|
||||||
"author": {
|
"author": {
|
||||||
|
@ -31,8 +32,10 @@
|
||||||
"grunt-contrib-qunit": "~0.5.1",
|
"grunt-contrib-qunit": "~0.5.1",
|
||||||
"grunt-contrib-uglify": "~0.5.0",
|
"grunt-contrib-uglify": "~0.5.0",
|
||||||
"grunt-contrib-watch": "~0.6.1",
|
"grunt-contrib-watch": "~0.6.1",
|
||||||
|
"grunt-mocha-phantomjs": "^0.6.0",
|
||||||
"jshint-stylish": "~0.2.0",
|
"jshint-stylish": "~0.2.0",
|
||||||
"load-grunt-tasks": "~0.6.0",
|
"load-grunt-tasks": "~0.6.0",
|
||||||
|
"phantomjs": "^1.9.13",
|
||||||
"time-grunt": "~0.3.2"
|
"time-grunt": "~0.3.2"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
14
src/uhr.js
14
src/uhr.js
|
@ -344,6 +344,16 @@
|
||||||
}.bind(this));
|
}.bind(this));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
var destroy = function destroy() {
|
||||||
|
this.timer = null;
|
||||||
|
$(this.element)
|
||||||
|
.removeAttr('style')
|
||||||
|
.removeAttr('class')
|
||||||
|
.empty();
|
||||||
|
$('#uhr-configlink' + this.id).remove();
|
||||||
|
$('#uhr-controlpanel' + this.id).remove();
|
||||||
|
|
||||||
|
};
|
||||||
var setCookie = function setCookie(cookieName, cookieValue) {
|
var setCookie = function setCookie(cookieName, cookieValue) {
|
||||||
var options = {};
|
var options = {};
|
||||||
if (this.options.cookiePath !== undefined) {
|
if (this.options.cookiePath !== undefined) {
|
||||||
|
@ -457,7 +467,9 @@
|
||||||
"mode": setMode,
|
"mode": setMode,
|
||||||
"width": setWidth,
|
"width": setWidth,
|
||||||
// constructor method
|
// constructor method
|
||||||
"_create": create
|
"_create": create,
|
||||||
|
// destructor method
|
||||||
|
"_destroy": destroy
|
||||||
});
|
});
|
||||||
$.fritteli.uhr.register = uhrGlobals.registerLanguage;
|
$.fritteli.uhr.register = uhrGlobals.registerLanguage;
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -6,23 +6,28 @@
|
||||||
<link rel="stylesheet" type="text/css" href="css/mocha.css"/>
|
<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.css"/>
|
||||||
<link rel="stylesheet" type="text/css" href="../css/uhr-black.css" data-class="black"/>
|
<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"/>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div id="mocha"></div>
|
|
||||||
<script src="lib/mocha.js"></script>
|
|
||||||
<script src="lib/chai.js"></script>
|
|
||||||
<script>mocha.setup('tdd');</script>
|
|
||||||
<script src="../lib/jquery-2.1.0.min.js"></script>
|
|
||||||
<script src="../lib/jquery-ui-1.10.4.custom.min.js"></script>
|
|
||||||
<script src="../lib/jquery-cookie-1.4.0.js"></script>
|
|
||||||
<script src="../src/uhr.js"></script>
|
|
||||||
<script src="../src/uhr-de_CH.js"></script>
|
|
||||||
<script src="test.js"></script>
|
|
||||||
<div id="u"></div>
|
<div id="u"></div>
|
||||||
<script>
|
<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.checkLeaks();
|
||||||
mocha.run();
|
mocha.globals(['jQuery*']);
|
||||||
// $('#u').uhr({'width':'200px'});
|
if (window.mochaPhantomJS) {
|
||||||
|
mochaPhantomJS.run();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
mocha.run();
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
24
test/test.js
24
test/test.js
|
@ -1,5 +1,21 @@
|
||||||
suite('Bärneruhr', function() {
|
suite('Bärneruhr', function () {
|
||||||
"use strict";
|
'use strict';
|
||||||
test('dummy', function() {
|
var assert = chai.assert;
|
||||||
|
test('create widget', function () {
|
||||||
|
var e = jQuery('#u');
|
||||||
|
var uhr = e.uhr('instance');
|
||||||
|
assert.isUndefined(uhr);
|
||||||
|
uhr = e.uhr();
|
||||||
|
assert.isNotNull(uhr);
|
||||||
|
assert.isDefined(uhr);
|
||||||
});
|
});
|
||||||
});
|
test('destroy widget', function() {
|
||||||
|
var e = jQuery('#u');
|
||||||
|
var uhr = e.uhr('instance');
|
||||||
|
assert.isNotNull(uhr);
|
||||||
|
assert.isDefined(uhr);
|
||||||
|
e.uhr('destroy');
|
||||||
|
uhr = e.uhr('instance');
|
||||||
|
assert.isUndefined(uhr);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
Loading…
Reference in a new issue