mirror of
https://github.com/xdan/datetimepicker.git
synced 2024-11-18 06:24:22 +00:00
New version 2.5.19
This commit is contained in:
parent
7d945b6024
commit
2382196ce7
7
.travis.yml
Normal file
7
.travis.yml
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
language: node_js
|
||||||
|
node_js:
|
||||||
|
- "8"
|
||||||
|
before_script:
|
||||||
|
- "export DISPLAY=:99.0"
|
||||||
|
- "sh -e /etc/init.d/xvfb start"
|
||||||
|
- sleep 3 # give xvfb some time to start
|
File diff suppressed because one or more lines are too long
2
build/jquery.datetimepicker.full.min.js
vendored
2
build/jquery.datetimepicker.full.min.js
vendored
File diff suppressed because one or more lines are too long
2
build/jquery.datetimepicker.min.js
vendored
2
build/jquery.datetimepicker.min.js
vendored
File diff suppressed because one or more lines are too long
@ -104,7 +104,7 @@ lang:'en',
|
|||||||
disabledDates:['1986/01/08','1986/01/09','1986/01/10'],
|
disabledDates:['1986/01/08','1986/01/09','1986/01/10'],
|
||||||
startDate: '1986/01/05'
|
startDate: '1986/01/05'
|
||||||
});
|
});
|
||||||
$('#datetimepicker').datetimepicker({value:'2015/04/15 05:03',step:10});
|
$('#datetimepicker').datetimepicker({value:'2015/04/15 05:03', step:10});
|
||||||
|
|
||||||
$('.some_class').datetimepicker();
|
$('.some_class').datetimepicker();
|
||||||
|
|
||||||
|
6
jquery.js
vendored
Normal file
6
jquery.js
vendored
Normal file
File diff suppressed because one or more lines are too long
30
karma.conf.js
Normal file
30
karma.conf.js
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
module.exports = function(config) {
|
||||||
|
config.set({
|
||||||
|
basePath: '',
|
||||||
|
frameworks: ['mocha', 'chai'],
|
||||||
|
files: [
|
||||||
|
'jquery.datetimepicker.css',
|
||||||
|
'node_modules/php-date-formatter/js/php-date-formatter.js',
|
||||||
|
'jquery.js',
|
||||||
|
'jquery.datetimepicker.js',
|
||||||
|
'tests/bootstrap.js',
|
||||||
|
'tests/tests/*.js'
|
||||||
|
],
|
||||||
|
reporters: ['progress'],
|
||||||
|
port: 9876,
|
||||||
|
colors: true,
|
||||||
|
logLevel: config.LOG_INFO,
|
||||||
|
browsers: ['Firefox'],
|
||||||
|
autoWatch: true,
|
||||||
|
singleRun: false, // Karma captures browsers, runs the tests and exits
|
||||||
|
concurrency: Infinity,
|
||||||
|
plugins: [
|
||||||
|
'karma-firefox-launcher',
|
||||||
|
'karma-mocha',
|
||||||
|
'karma-chai'
|
||||||
|
],
|
||||||
|
client: {
|
||||||
|
captureConsole: true
|
||||||
|
}
|
||||||
|
})
|
||||||
|
};
|
5408
package-lock.json
generated
Normal file
5408
package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
14
package.json
14
package.json
@ -1,16 +1,16 @@
|
|||||||
{
|
{
|
||||||
"name": "jquery-datetimepicker",
|
"name": "jquery-datetimepicker",
|
||||||
"version": "2.5.18",
|
"version": "2.5.19",
|
||||||
"description": "jQuery Plugin DateTimePicker it is DatePicker and TimePicker in one",
|
"description": "jQuery Plugin DateTimePicker it is DatePicker and TimePicker in one",
|
||||||
"main": "build/jquery.datetimepicker.full.min.js",
|
"main": "build/jquery.datetimepicker.full.min.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "echo \"Error: no test specified\" && exit 1",
|
"test": "karma start --browsers Firefox karma.conf.js --single-run",
|
||||||
"concat": "concat-cli -f node_modules/php-date-formatter/js/php-date-formatter.min.js jquery.datetimepicker.js node_modules/jquery-mousewheel/jquery.mousewheel.js -o build/jquery.datetimepicker.full.js",
|
"concat": "concat-cli -f node_modules/php-date-formatter/js/php-date-formatter.min.js jquery.datetimepicker.js node_modules/jquery-mousewheel/jquery.mousewheel.js -o build/jquery.datetimepicker.full.js",
|
||||||
"minify": "uglifyjs jquery.datetimepicker.js -c -m -o build/jquery.datetimepicker.min.js && uglifycss jquery.datetimepicker.css > build/jquery.datetimepicker.min.css",
|
"minify": "uglifyjs jquery.datetimepicker.js -c -m -o build/jquery.datetimepicker.min.js && uglifycss jquery.datetimepicker.css > build/jquery.datetimepicker.min.css",
|
||||||
"minifyconcat": "uglifyjs build/jquery.datetimepicker.full.js -c -m -o build/jquery.datetimepicker.full.min.js",
|
"minifyconcat": "uglifyjs build/jquery.datetimepicker.full.js -c -m -o build/jquery.datetimepicker.full.min.js",
|
||||||
"github": "git add --all && git commit -m \"New version %npm_package_version% \" && git tag %npm_package_version% && git push --tags origin HEAD:master && npm publish",
|
"github": "git add --all && git commit -m \"New version %npm_package_version% \" && git tag %npm_package_version% && git push --tags origin HEAD:master && npm publish",
|
||||||
"build": "npm run minify && npm run concat && npm run minifyconcat",
|
"build": "npm run minify && npm run concat && npm run minifyconcat",
|
||||||
"public": "npm version patch --no-git-tag-version && npm run build && npm run github"
|
"public": "npm run test && npm version patch --no-git-tag-version && npm run build && npm run github"
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
@ -25,7 +25,7 @@
|
|||||||
"datepicker",
|
"datepicker",
|
||||||
"timepicker"
|
"timepicker"
|
||||||
],
|
],
|
||||||
"author": "Chupurnov <chupurnov@gmail.com> (http://xdsoft.net/)",
|
"author": "Chupurnov <chupurnov@gmail.com> (https://xdsoft.net/)",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"bugs": {
|
"bugs": {
|
||||||
"url": "https://github.com/xdan/datetimepicker/issues"
|
"url": "https://github.com/xdan/datetimepicker/issues"
|
||||||
@ -37,8 +37,14 @@
|
|||||||
"php-date-formatter": "^1.3.4"
|
"php-date-formatter": "^1.3.4"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
"chai": "^4.1.2",
|
||||||
"concat": "azer/concat",
|
"concat": "azer/concat",
|
||||||
"concat-cli": "^4.0.0",
|
"concat-cli": "^4.0.0",
|
||||||
|
"karma": "^2.0.0",
|
||||||
|
"karma-chai": "^0.1.0",
|
||||||
|
"karma-firefox-launcher": "^1.1.0",
|
||||||
|
"karma-mocha": "^1.3.0",
|
||||||
|
"mocha": "^5.0.4",
|
||||||
"uglifycss": "^0.0.27",
|
"uglifycss": "^0.0.27",
|
||||||
"uglifyjs": "^2.4.10"
|
"uglifyjs": "^2.4.10"
|
||||||
}
|
}
|
||||||
|
0
tests/app.css
Normal file
0
tests/app.css
Normal file
45
tests/index.html
Normal file
45
tests/index.html
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
<!doctype html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8"/>
|
||||||
|
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0"/>
|
||||||
|
<meta http-equiv="X-UA-Compatible" content="ie=edge"/>
|
||||||
|
<title>jQuery DateTimepicker Tests </title>
|
||||||
|
<link rel="stylesheet" href="../node_modules/mocha/mocha.css" />
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div id="mocha"></div>
|
||||||
|
|
||||||
|
<script src="../node_modules/mocha/mocha.js"></script>
|
||||||
|
<script src="../node_modules/chai/chai.js"></script>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
mocha.ui('bdd');
|
||||||
|
mocha.reporter('html');
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<link rel="stylesheet" href="./app.css" />
|
||||||
|
<link rel="stylesheet" href="../jquery.datetimepicker.css" />
|
||||||
|
<script src="../jquery.js"></script>
|
||||||
|
|
||||||
|
<script src="../node_modules/php-date-formatter/js/php-date-formatter.js"></script>
|
||||||
|
<script src="../jquery.datetimepicker.js"></script>
|
||||||
|
|
||||||
|
<script src="./tests/bootstrap.js"></script>
|
||||||
|
<script src="./tests/init.js"></script>
|
||||||
|
<script src="./tests/destroy.js"></script>
|
||||||
|
<script src="./tests/options.js"></script>
|
||||||
|
<script src="./tests/methods.js"></script>
|
||||||
|
<script src="./tests/events.js"></script>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
window.onload = function() {
|
||||||
|
if (window.mochaPhantomJS) {
|
||||||
|
mochaPhantomJS.run();
|
||||||
|
} else {
|
||||||
|
mocha.run();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
@ -98,7 +98,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</footer>
|
</footer>
|
||||||
|
|
||||||
<script src="../bower_components/jquery/dist/jquery.min.js"></script>
|
<script src="../jquery.js"></script>
|
||||||
<script src="../build/jquery.datetimepicker.full.js"></script>
|
<script src="../build/jquery.datetimepicker.full.js"></script>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
@ -98,7 +98,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</footer>
|
</footer>
|
||||||
|
|
||||||
<script src="../bower_components/jquery/dist/jquery.min.js"></script>
|
<script src="../jquery.js"></script>
|
||||||
<script src="../build/jquery.datetimepicker.full.js"></script>
|
<script src="../build/jquery.datetimepicker.full.js"></script>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
55
tests/tests/bootstrap.js
vendored
Normal file
55
tests/tests/bootstrap.js
vendored
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
var inputs = [];
|
||||||
|
|
||||||
|
var box = document.createElement('div');
|
||||||
|
document.body.appendChild(box);
|
||||||
|
|
||||||
|
|
||||||
|
var getInput = function () {
|
||||||
|
var input = document.createElement('input');
|
||||||
|
input.setAttribute('type', 'text');
|
||||||
|
inputs.push(input);
|
||||||
|
box.appendChild(input);
|
||||||
|
return input;
|
||||||
|
};
|
||||||
|
|
||||||
|
var clear = function() {
|
||||||
|
inputs.forEach(function (inp) {
|
||||||
|
$(inp).datetimepicker('destroy');
|
||||||
|
inp.parentNode && inp.parentNode.removeChild(inp)
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
var PICKER = 'xdsoft_datetimepicker';
|
||||||
|
|
||||||
|
var simulateEvent = function (type, element, keyCodeArg, options) {
|
||||||
|
if (!keyCodeArg) {
|
||||||
|
keyCodeArg = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (element instanceof jQuery) {
|
||||||
|
element = element[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
var evt = (element.ownerDocument || document).createEvent('HTMLEvents')
|
||||||
|
evt.initEvent(type, true, true);
|
||||||
|
evt.keyCode = keyCodeArg;
|
||||||
|
evt.which = keyCodeArg;
|
||||||
|
|
||||||
|
if (options) {
|
||||||
|
options(evt);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (type.match(/^mouse/)) {
|
||||||
|
['pageX', 'pageY', 'clientX', 'clientY'].forEach(function (key) {
|
||||||
|
if (evt[key] === undefined) {
|
||||||
|
evt[key] = 0;
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
element.dispatchEvent(evt);
|
||||||
|
};
|
||||||
|
|
||||||
|
afterEach(clear);
|
||||||
|
var expect = chai.expect;
|
||||||
|
chai.config.includeStack = true
|
22
tests/tests/destroy.js
Normal file
22
tests/tests/destroy.js
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
describe('Check destructor', function () {
|
||||||
|
describe('Init picker and after this init again with command destroy', function () {
|
||||||
|
it('Should remove picker from DOM and remove all listeners from original input', function (done) {
|
||||||
|
var input = getInput();
|
||||||
|
$(input).datetimepicker();
|
||||||
|
var dtp = $(input).data('xdsoft_datetimepicker');
|
||||||
|
expect(dtp).to.be.not.equal(null);
|
||||||
|
expect(dtp[0].tagName).to.be.equal('DIV');
|
||||||
|
expect(dtp[0].classList.contains('xdsoft_datetimepicker')).to.be.true;
|
||||||
|
expect(dtp.is(':hidden')).to.be.true;
|
||||||
|
|
||||||
|
$(input).datetimepicker('destroy');
|
||||||
|
expect($(input).data('xdsoft_datetimepicker')).to.be.equal(null);
|
||||||
|
|
||||||
|
$(input).trigger('mousedown')
|
||||||
|
setTimeout(function () {
|
||||||
|
expect(dtp.is(':hidden')).to.be.true;
|
||||||
|
done();
|
||||||
|
}, 150)
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
26
tests/tests/events.js
Normal file
26
tests/tests/events.js
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
describe('Test events', function () {
|
||||||
|
describe('onSelectDate', function () {
|
||||||
|
it('Should fired after user selected day', function (done) {
|
||||||
|
var input= $(getInput()).val('2011/04/15');
|
||||||
|
|
||||||
|
var picker = input.datetimepicker({
|
||||||
|
onSelectDate: function (time, inp, evt) {
|
||||||
|
expect(picker).to.be.equal(this);
|
||||||
|
expect(time.getDate()).to.be.equal(17);
|
||||||
|
expect(time.getMonth()).to.be.equal(3);
|
||||||
|
expect(time.getFullYear()).to.be.equal(2011);
|
||||||
|
expect(inp[0]).to.be.equal(input[0]);
|
||||||
|
expect(evt.type).to.be.equal('click');
|
||||||
|
done();
|
||||||
|
},
|
||||||
|
format: 'Y/m/d'
|
||||||
|
}).trigger('mousedown').data(PICKER);
|
||||||
|
|
||||||
|
setTimeout(function () {
|
||||||
|
var select = picker.find('td[data-date="17"][data-month="3"][data-year="2011"]');
|
||||||
|
expect(select.length).to.be.equal(1);
|
||||||
|
select.trigger('click');
|
||||||
|
}, 100);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
83
tests/tests/init.js
Normal file
83
tests/tests/init.js
Normal file
@ -0,0 +1,83 @@
|
|||||||
|
describe('Init', function () {
|
||||||
|
describe('jQuery.fn', function () {
|
||||||
|
it('Should have datetimepicker method', function () {
|
||||||
|
expect(typeof jQuery.fn.datetimepicker).to.be.equal('function');
|
||||||
|
expect(typeof $.fn.datetimepicker).to.be.equal('function');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
describe('jQuery.fn.datetimepicker', function () {
|
||||||
|
it('Should have `defaults` property', function () {
|
||||||
|
expect(typeof jQuery.fn.datetimepicker.defaults).to.be.equal('object');
|
||||||
|
expect(jQuery.fn.datetimepicker.defaults.format).to.be.equal('Y/m/d H:i');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
describe('Create datetimepicker', function () {
|
||||||
|
describe('Without parameters', function () {
|
||||||
|
it('Should create plugin with default options', function (done) {
|
||||||
|
var input = getInput();
|
||||||
|
$(input).datetimepicker();
|
||||||
|
var dtp = $(input).data('xdsoft_datetimepicker');
|
||||||
|
expect(dtp).to.be.not.equal(null);
|
||||||
|
expect(dtp[0].tagName).to.be.equal('DIV');
|
||||||
|
expect(dtp[0].classList.contains('xdsoft_datetimepicker')).to.be.true;
|
||||||
|
expect(dtp.is(':hidden')).to.be.true;
|
||||||
|
$(input).trigger('mousedown')
|
||||||
|
setTimeout(function () {
|
||||||
|
expect(dtp.is(':hidden')).to.be.false;
|
||||||
|
done();
|
||||||
|
}, 150)
|
||||||
|
});
|
||||||
|
});
|
||||||
|
describe('In inline mode', function () {
|
||||||
|
it('Should create picker and replace original input', function () {
|
||||||
|
var input = getInput();
|
||||||
|
$(input).datetimepicker({
|
||||||
|
inline: true
|
||||||
|
});
|
||||||
|
var dtp = $(input).data('xdsoft_datetimepicker');
|
||||||
|
expect(dtp.is(':hidden')).to.be.false;
|
||||||
|
expect($(input).is(':hidden')).to.be.true;
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
describe('Set locale', function () {
|
||||||
|
describe('Change locale', function () {
|
||||||
|
it('Should create different pickers fro all locales', function (done) {
|
||||||
|
$.datetimepicker.setLocale('en');
|
||||||
|
var $input = $(getInput());
|
||||||
|
$input.datetimepicker({inline: true});
|
||||||
|
setTimeout(function () {
|
||||||
|
var text = $input.data('xdsoft_datetimepicker').text();
|
||||||
|
$input.datetimepicker('destroy');
|
||||||
|
$.datetimepicker.setLocale('ru');
|
||||||
|
$input.datetimepicker({inline: true});
|
||||||
|
setTimeout(function () {
|
||||||
|
expect($input.data('xdsoft_datetimepicker').text()).to.be.not.equal(text);
|
||||||
|
done();
|
||||||
|
}, 100)
|
||||||
|
}, 100)
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
describe('Select day', function () {
|
||||||
|
it('Should set selected date to input by format', function (done) {
|
||||||
|
var input= $(getInput()).val('2011/04/15');
|
||||||
|
|
||||||
|
var picker = input.datetimepicker({
|
||||||
|
format: 'Y/m/d'
|
||||||
|
}).trigger('mousedown').data(PICKER);
|
||||||
|
|
||||||
|
setTimeout(function () {
|
||||||
|
var start = picker.find('td[data-date="15"][data-month="3"][data-year="2011"]');
|
||||||
|
expect(start.length).to.be.equal(1);
|
||||||
|
expect(start.hasClass('xdsoft_disabled')).to.be.false;
|
||||||
|
expect(start.hasClass('xdsoft_current')).to.be.true;
|
||||||
|
var select = picker.find('td[data-date="17"][data-month="3"][data-year="2011"]');
|
||||||
|
expect(start.length).to.be.equal(1);
|
||||||
|
select.trigger('click');
|
||||||
|
expect(input.val()).to.be.equal('2011/04/17')
|
||||||
|
done();
|
||||||
|
}, 100);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
62
tests/tests/methods.js
Normal file
62
tests/tests/methods.js
Normal file
@ -0,0 +1,62 @@
|
|||||||
|
describe('Test methods', function () {
|
||||||
|
describe('Show', function () {
|
||||||
|
it('Should show picker', function () {
|
||||||
|
var input= $(getInput());
|
||||||
|
var picker = input
|
||||||
|
.datetimepicker()
|
||||||
|
.datetimepicker('show')
|
||||||
|
.data(PICKER);
|
||||||
|
|
||||||
|
expect(picker.is(':hidden')).to.be.false;
|
||||||
|
});
|
||||||
|
});
|
||||||
|
describe('Hide', function () {
|
||||||
|
it('Should hide picker', function () {
|
||||||
|
var input= $(getInput());
|
||||||
|
var picker = input
|
||||||
|
.datetimepicker()
|
||||||
|
.datetimepicker('show')
|
||||||
|
.data(PICKER);
|
||||||
|
|
||||||
|
expect(picker.is(':hidden')).to.be.false;
|
||||||
|
input.datetimepicker('hide')
|
||||||
|
expect(picker.is(':hidden')).to.be.true;
|
||||||
|
});
|
||||||
|
});
|
||||||
|
describe('Toggle', function () {
|
||||||
|
it('Should hide/show picker', function () {
|
||||||
|
var input= $(getInput());
|
||||||
|
var picker = input
|
||||||
|
.datetimepicker()
|
||||||
|
.datetimepicker('show')
|
||||||
|
.data(PICKER);
|
||||||
|
|
||||||
|
expect(picker.is(':hidden')).to.be.false;
|
||||||
|
input.datetimepicker('toggle')
|
||||||
|
expect(picker.is(':hidden')).to.be.true;
|
||||||
|
input.datetimepicker('toggle')
|
||||||
|
expect(picker.is(':hidden')).to.be.false;
|
||||||
|
});
|
||||||
|
});
|
||||||
|
describe('Reset', function () {
|
||||||
|
it('Should restore default value', function (done) {
|
||||||
|
var input= $('<input type="text" value="15.12.2008"/>').appendTo(document.body);
|
||||||
|
|
||||||
|
var picker = input
|
||||||
|
.datetimepicker({format: 'd.m.Y'})
|
||||||
|
.datetimepicker('show')
|
||||||
|
.data(PICKER);
|
||||||
|
|
||||||
|
setTimeout(function () {
|
||||||
|
var select = picker.find('td[data-date="16"][data-month="11"][data-year="2008"]');
|
||||||
|
expect(select.length).to.be.equal(1);
|
||||||
|
select.trigger('click');
|
||||||
|
expect(input.val()).to.be.equal('16.12.2008');
|
||||||
|
input.datetimepicker('reset');
|
||||||
|
expect(input.val()).to.be.equal('15.12.2008');
|
||||||
|
input.datetimepicker('destroy').remove();
|
||||||
|
done();
|
||||||
|
}, 100)
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
102
tests/tests/options.js
Normal file
102
tests/tests/options.js
Normal file
@ -0,0 +1,102 @@
|
|||||||
|
describe('Test options', function () {
|
||||||
|
describe('dayOfWeekStart', function () {
|
||||||
|
it('Should change default start of week', function (done) {
|
||||||
|
$.datetimepicker.setLocale('en');
|
||||||
|
var input = $(getInput());
|
||||||
|
var picker = input.datetimepicker({inline: true}).trigger('mousedown').data('xdsoft_datetimepicker');
|
||||||
|
setTimeout(function () {
|
||||||
|
var day = picker.find('th').eq(0).text();
|
||||||
|
var date = picker.find('td').eq(0).text();
|
||||||
|
input.datetimepicker('destroy');
|
||||||
|
|
||||||
|
var picker2 = $(getInput()).datetimepicker({
|
||||||
|
inline: true,
|
||||||
|
dayOfWeekStart: 2
|
||||||
|
}).trigger('mousedown').data(PICKER);
|
||||||
|
|
||||||
|
setTimeout(function () {
|
||||||
|
expect(picker2.find('th').eq(0).text()).to.be.not.equal(day);
|
||||||
|
expect(picker2.find('td').eq(0).text()).to.be.not.equal(date);
|
||||||
|
done();
|
||||||
|
}, 100);
|
||||||
|
}, 100);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
describe('disabledDates and startDate', function () {
|
||||||
|
it('Should disable some dates in picker and picker should be open on startDate', function (done) {
|
||||||
|
var input= $(getInput());
|
||||||
|
var picker = input.datetimepicker({
|
||||||
|
disabledDates:['1986/01/08','1986/01/09','1986/01/10'],
|
||||||
|
startDate: '1986/01/05'
|
||||||
|
}).trigger('mousedown').data(PICKER);
|
||||||
|
|
||||||
|
setTimeout(function () {
|
||||||
|
var day = picker.find('td[data-date="8"][data-month="0"][data-year="1986"]');
|
||||||
|
expect(day.hasClass('xdsoft_disabled')).to.be.true;
|
||||||
|
var start = picker.find('td[data-date="5"][data-month="0"][data-year="1986"]');
|
||||||
|
expect(start.length).to.be.equal(1);
|
||||||
|
expect(start.hasClass('xdsoft_disabled')).to.be.false;
|
||||||
|
done();
|
||||||
|
}, 100);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
describe('defaultDate', function () {
|
||||||
|
it('Should open picker on some date', function (done) {
|
||||||
|
var input= $(getInput());
|
||||||
|
var picker = input.datetimepicker({formatDate:'d.m.Y', defaultDate: '+03.01.1970'}).trigger('mousedown').data(PICKER);
|
||||||
|
|
||||||
|
setTimeout(function () {
|
||||||
|
var now = new Date();
|
||||||
|
now.setDate(now.getDate() + 2)
|
||||||
|
var start = picker.find('td[data-date="' + now.getDate() + '"][data-month="' + now.getMonth() + '"][data-year="' + now.getFullYear() + '"]');
|
||||||
|
expect(start.length).to.be.equal(1);
|
||||||
|
expect(start.hasClass('xdsoft_disabled')).to.be.false;
|
||||||
|
expect(start.hasClass('xdsoft_current xdsoft_today')).to.be.true;
|
||||||
|
done();
|
||||||
|
}, 100);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
describe('Value', function () {
|
||||||
|
it('Should set value to plugin', function (done) {
|
||||||
|
var input= $(getInput());
|
||||||
|
var picker = input.datetimepicker({value: '2011/04/15 05:03'}).trigger('mousedown').data(PICKER);
|
||||||
|
|
||||||
|
setTimeout(function () {
|
||||||
|
var start = picker.find('td[data-date="15"][data-month="3"][data-year="2011"]');
|
||||||
|
expect(start.length).to.be.equal(1);
|
||||||
|
expect(start.hasClass('xdsoft_disabled')).to.be.false;
|
||||||
|
done();
|
||||||
|
}, 100);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
describe('timepicker = false', function () {
|
||||||
|
it('Should create only datepicker', function (done) {
|
||||||
|
var input= $(getInput());
|
||||||
|
var picker = input.datetimepicker({
|
||||||
|
timepicker: false
|
||||||
|
}).trigger('mousedown').data(PICKER);
|
||||||
|
|
||||||
|
setTimeout(function () {
|
||||||
|
var timepicker = picker.find('.xdsoft_timepicker');
|
||||||
|
expect(timepicker.length).to.be.equal(1);
|
||||||
|
expect(timepicker.is(':hidden')).to.be.true;
|
||||||
|
done();
|
||||||
|
}, 100);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
describe('datepicker = false', function () {
|
||||||
|
it('Should create only timepicker', function (done) {
|
||||||
|
var input= $(getInput());
|
||||||
|
var picker = input.datetimepicker({
|
||||||
|
datepicker: false
|
||||||
|
}).trigger('mousedown').data(PICKER);
|
||||||
|
|
||||||
|
setTimeout(function () {
|
||||||
|
var datepicker = picker.find('.xdsoft_datepicker');
|
||||||
|
expect(datepicker.length).to.be.equal(1);
|
||||||
|
expect(datepicker.is(':hidden')).to.be.true;
|
||||||
|
done();
|
||||||
|
}, 100);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
175
yarn.lock
175
yarn.lock
@ -1,175 +0,0 @@
|
|||||||
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
|
|
||||||
# yarn lockfile v1
|
|
||||||
|
|
||||||
|
|
||||||
ansi-regex@^2.0.0:
|
|
||||||
version "2.1.1"
|
|
||||||
resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-2.1.1.tgz#c3b33ab5ee360d86e0e628f0468ae7ef27d654df"
|
|
||||||
|
|
||||||
ansi-styles@^2.2.1:
|
|
||||||
version "2.2.1"
|
|
||||||
resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-2.2.1.tgz#b432dd3358b634cf75e1e4664368240533c1ddbe"
|
|
||||||
|
|
||||||
camelcase@^2.0.1:
|
|
||||||
version "2.1.1"
|
|
||||||
resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-2.1.1.tgz#7c1d16d679a1bbe59ca02cacecfb011e201f5a1f"
|
|
||||||
|
|
||||||
chalk@^1.1.1:
|
|
||||||
version "1.1.3"
|
|
||||||
resolved "https://registry.yarnpkg.com/chalk/-/chalk-1.1.3.tgz#a8115c55e4a702fe4d150abd3872822a7e09fc98"
|
|
||||||
dependencies:
|
|
||||||
ansi-styles "^2.2.1"
|
|
||||||
escape-string-regexp "^1.0.2"
|
|
||||||
has-ansi "^2.0.0"
|
|
||||||
strip-ansi "^3.0.0"
|
|
||||||
supports-color "^2.0.0"
|
|
||||||
|
|
||||||
cliui@^3.0.3:
|
|
||||||
version "3.2.0"
|
|
||||||
resolved "https://registry.yarnpkg.com/cliui/-/cliui-3.2.0.tgz#120601537a916d29940f934da3b48d585a39213d"
|
|
||||||
dependencies:
|
|
||||||
string-width "^1.0.1"
|
|
||||||
strip-ansi "^3.0.1"
|
|
||||||
wrap-ansi "^2.0.0"
|
|
||||||
|
|
||||||
code-point-at@^1.0.0:
|
|
||||||
version "1.1.0"
|
|
||||||
resolved "https://registry.yarnpkg.com/code-point-at/-/code-point-at-1.1.0.tgz#0d070b4d043a5bea33a2f1a40e2edb3d9a4ccf77"
|
|
||||||
|
|
||||||
commander@^2.9.0:
|
|
||||||
version "2.11.0"
|
|
||||||
resolved "https://registry.yarnpkg.com/commander/-/commander-2.11.0.tgz#157152fd1e7a6c8d98a5b715cf376df928004563"
|
|
||||||
|
|
||||||
concat-cli@^4.0.0:
|
|
||||||
version "4.0.0"
|
|
||||||
resolved "https://registry.yarnpkg.com/concat-cli/-/concat-cli-4.0.0.tgz#a73a0fb0d18b25804ebe703bcc35922324dbf74d"
|
|
||||||
dependencies:
|
|
||||||
chalk "^1.1.1"
|
|
||||||
concat "^1.0.0"
|
|
||||||
yargs "^3.30.0"
|
|
||||||
|
|
||||||
concat@^1.0.0:
|
|
||||||
version "1.0.3"
|
|
||||||
resolved "https://registry.yarnpkg.com/concat/-/concat-1.0.3.tgz#40f3353089d65467695cb1886b45edd637d8cca8"
|
|
||||||
dependencies:
|
|
||||||
commander "^2.9.0"
|
|
||||||
|
|
||||||
concat@azer/concat:
|
|
||||||
version "1.0.0"
|
|
||||||
resolved "https://codeload.github.com/azer/concat/tar.gz/c64c5cbc2e60b0bc1a8f4bceafed661f66f19dcf"
|
|
||||||
dependencies:
|
|
||||||
parallel-loop azer/parallel-loop
|
|
||||||
serial-loop azer/serial-loop
|
|
||||||
|
|
||||||
decamelize@^1.1.1:
|
|
||||||
version "1.2.0"
|
|
||||||
resolved "https://registry.yarnpkg.com/decamelize/-/decamelize-1.2.0.tgz#f6534d15148269b20352e7bee26f501f9a191290"
|
|
||||||
|
|
||||||
escape-string-regexp@^1.0.2:
|
|
||||||
version "1.0.5"
|
|
||||||
resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4"
|
|
||||||
|
|
||||||
has-ansi@^2.0.0:
|
|
||||||
version "2.0.0"
|
|
||||||
resolved "https://registry.yarnpkg.com/has-ansi/-/has-ansi-2.0.0.tgz#34f5049ce1ecdf2b0649af3ef24e45ed35416d91"
|
|
||||||
dependencies:
|
|
||||||
ansi-regex "^2.0.0"
|
|
||||||
|
|
||||||
invert-kv@^1.0.0:
|
|
||||||
version "1.0.0"
|
|
||||||
resolved "https://registry.yarnpkg.com/invert-kv/-/invert-kv-1.0.0.tgz#104a8e4aaca6d3d8cd157a8ef8bfab2d7a3ffdb6"
|
|
||||||
|
|
||||||
is-fullwidth-code-point@^1.0.0:
|
|
||||||
version "1.0.0"
|
|
||||||
resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz#ef9e31386f031a7f0d643af82fde50c457ef00cb"
|
|
||||||
dependencies:
|
|
||||||
number-is-nan "^1.0.0"
|
|
||||||
|
|
||||||
"jquery-mousewheel@>= 3.1.13":
|
|
||||||
version "3.1.13"
|
|
||||||
resolved "https://registry.yarnpkg.com/jquery-mousewheel/-/jquery-mousewheel-3.1.13.tgz#06f0335f16e353a695e7206bf50503cb523a6ee5"
|
|
||||||
|
|
||||||
"jquery@>= 1.7.2":
|
|
||||||
version "3.2.1"
|
|
||||||
resolved "https://registry.yarnpkg.com/jquery/-/jquery-3.2.1.tgz#5c4d9de652af6cd0a770154a631bba12b015c787"
|
|
||||||
|
|
||||||
lcid@^1.0.0:
|
|
||||||
version "1.0.0"
|
|
||||||
resolved "https://registry.yarnpkg.com/lcid/-/lcid-1.0.0.tgz#308accafa0bc483a3867b4b6f2b9506251d1b835"
|
|
||||||
dependencies:
|
|
||||||
invert-kv "^1.0.0"
|
|
||||||
|
|
||||||
number-is-nan@^1.0.0:
|
|
||||||
version "1.0.1"
|
|
||||||
resolved "https://registry.yarnpkg.com/number-is-nan/-/number-is-nan-1.0.1.tgz#097b602b53422a522c1afb8790318336941a011d"
|
|
||||||
|
|
||||||
os-locale@^1.4.0:
|
|
||||||
version "1.4.0"
|
|
||||||
resolved "https://registry.yarnpkg.com/os-locale/-/os-locale-1.4.0.tgz#20f9f17ae29ed345e8bde583b13d2009803c14d9"
|
|
||||||
dependencies:
|
|
||||||
lcid "^1.0.0"
|
|
||||||
|
|
||||||
parallel-loop@azer/parallel-loop:
|
|
||||||
version "0.0.2"
|
|
||||||
resolved "https://codeload.github.com/azer/parallel-loop/tar.gz/054b0d3fe633483a3a6b94104c8343473208d5fb"
|
|
||||||
|
|
||||||
php-date-formatter@^1.3.4:
|
|
||||||
version "1.3.4"
|
|
||||||
resolved "https://registry.yarnpkg.com/php-date-formatter/-/php-date-formatter-1.3.4.tgz#09a15ae0766ba0beb1900c27c1ec319ef2e4563e"
|
|
||||||
|
|
||||||
serial-loop@azer/serial-loop:
|
|
||||||
version "0.0.1"
|
|
||||||
resolved "https://codeload.github.com/azer/serial-loop/tar.gz/99c6271f80f075b7db089a1aadc7178a310a4570"
|
|
||||||
|
|
||||||
string-width@^1.0.1:
|
|
||||||
version "1.0.2"
|
|
||||||
resolved "https://registry.yarnpkg.com/string-width/-/string-width-1.0.2.tgz#118bdf5b8cdc51a2a7e70d211e07e2b0b9b107d3"
|
|
||||||
dependencies:
|
|
||||||
code-point-at "^1.0.0"
|
|
||||||
is-fullwidth-code-point "^1.0.0"
|
|
||||||
strip-ansi "^3.0.0"
|
|
||||||
|
|
||||||
strip-ansi@^3.0.0, strip-ansi@^3.0.1:
|
|
||||||
version "3.0.1"
|
|
||||||
resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-3.0.1.tgz#6a385fb8853d952d5ff05d0e8aaf94278dc63dcf"
|
|
||||||
dependencies:
|
|
||||||
ansi-regex "^2.0.0"
|
|
||||||
|
|
||||||
supports-color@^2.0.0:
|
|
||||||
version "2.0.0"
|
|
||||||
resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-2.0.0.tgz#535d045ce6b6363fa40117084629995e9df324c7"
|
|
||||||
|
|
||||||
uglifycss@^0.0.27:
|
|
||||||
version "0.0.27"
|
|
||||||
resolved "https://registry.yarnpkg.com/uglifycss/-/uglifycss-0.0.27.tgz#53553b8115de26dce57b42ba0b34e88dd80d0cde"
|
|
||||||
|
|
||||||
uglifyjs@^2.4.10:
|
|
||||||
version "2.4.11"
|
|
||||||
resolved "https://registry.yarnpkg.com/uglifyjs/-/uglifyjs-2.4.11.tgz#3440d64e045759589524418eb641c68bb90d113e"
|
|
||||||
|
|
||||||
window-size@^0.1.4:
|
|
||||||
version "0.1.4"
|
|
||||||
resolved "https://registry.yarnpkg.com/window-size/-/window-size-0.1.4.tgz#f8e1aa1ee5a53ec5bf151ffa09742a6ad7697876"
|
|
||||||
|
|
||||||
wrap-ansi@^2.0.0:
|
|
||||||
version "2.1.0"
|
|
||||||
resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-2.1.0.tgz#d8fc3d284dd05794fe84973caecdd1cf824fdd85"
|
|
||||||
dependencies:
|
|
||||||
string-width "^1.0.1"
|
|
||||||
strip-ansi "^3.0.1"
|
|
||||||
|
|
||||||
y18n@^3.2.0:
|
|
||||||
version "3.2.1"
|
|
||||||
resolved "https://registry.yarnpkg.com/y18n/-/y18n-3.2.1.tgz#6d15fba884c08679c0d77e88e7759e811e07fa41"
|
|
||||||
|
|
||||||
yargs@^3.30.0:
|
|
||||||
version "3.32.0"
|
|
||||||
resolved "https://registry.yarnpkg.com/yargs/-/yargs-3.32.0.tgz#03088e9ebf9e756b69751611d2a5ef591482c995"
|
|
||||||
dependencies:
|
|
||||||
camelcase "^2.0.1"
|
|
||||||
cliui "^3.0.3"
|
|
||||||
decamelize "^1.1.1"
|
|
||||||
os-locale "^1.4.0"
|
|
||||||
string-width "^1.0.1"
|
|
||||||
window-size "^0.1.4"
|
|
||||||
y18n "^3.2.0"
|
|
Loading…
Reference in New Issue
Block a user