remove date and dateui global config of datepicker
This commit is contained in:
parent
57b55c3cbe
commit
01b242d9da
@ -26,7 +26,7 @@ $(function(){
|
||||
this.init('date', options, Date.defaults);
|
||||
|
||||
//set popular options directly from settings or data-* attributes
|
||||
var directOptions = $.fn.editableform.utils.sliceObj(this.options, ['format', 'weekStart', 'startView']);
|
||||
var directOptions = $.fn.editableform.utils.sliceObj(this.options, ['format']);
|
||||
|
||||
//overriding datepicker config (as by default jQuery extend() is not recursive)
|
||||
this.options.datepicker = $.extend({}, Date.defaults.datepicker, directOptions, options.datepicker);
|
||||
|
@ -26,7 +26,7 @@ $(function(){
|
||||
this.init('dateui', options, DateUI.defaults);
|
||||
|
||||
//set popular options directly from settings or data-* attributes
|
||||
var directOptions = $.fn.editableform.utils.sliceObj(this.options, ['format', 'firstDay']);
|
||||
var directOptions = $.fn.editableform.utils.sliceObj(this.options, ['format']);
|
||||
|
||||
//overriding datepicker config (as by default jQuery extend() is not recursive)
|
||||
this.options.datepicker = $.extend({}, DateUI.defaults.datepicker, directOptions, options.datepicker);
|
||||
|
@ -2,7 +2,7 @@
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Test Bootstrap Editable</title>
|
||||
<title>Test X-editable</title>
|
||||
|
||||
<!-- jquery -->
|
||||
<script src="../libs/jquery/jquery-1.8.2.js"></script>
|
||||
|
@ -16,8 +16,11 @@ $(function () {
|
||||
|
||||
asyncTest("popover should contain datepicker with value and save new entered date", function () {
|
||||
expect(9);
|
||||
|
||||
$.fn.editableform.types.date.defaults.datepicker.weekStart = 1;
|
||||
|
||||
var d = '15.05.1984',
|
||||
e = $('<a href="#" data-type="date" data-pk="1" data-weekstart="1" data-url="post-date.php">'+d+'</a>').appendTo(fx).editable({
|
||||
e = $('<a href="#" data-type="date" data-pk="1" data-url="post-date.php">'+d+'</a>').appendTo(fx).editable({
|
||||
format: f,
|
||||
datepicker: {
|
||||
|
||||
@ -57,9 +60,12 @@ $(function () {
|
||||
});
|
||||
|
||||
asyncTest("viewformat, init by text", function () {
|
||||
|
||||
$.fn.editableform.types.date.defaults.datepicker.weekStart = 1;
|
||||
|
||||
var dview = '15/05/1984',
|
||||
d = '1984-05-15',
|
||||
e = $('<a href="#" data-type="date" data-pk="1" data-weekstart="1" data-url="post-date1.php">'+dview+'</a>').appendTo(fx).editable({
|
||||
e = $('<a href="#" data-type="date" data-pk="1" data-url="post-date1.php">'+dview+'</a>').appendTo(fx).editable({
|
||||
format: 'yyyy-mm-dd',
|
||||
viewformat: 'dd/mm/yyyy',
|
||||
datepicker: {
|
||||
|
@ -20,7 +20,9 @@ $(function () {
|
||||
e = $('<a href="#" data-type="date" data-pk="1" data-url="post-date.php">'+dview+'</a>').appendTo(fx).editable({
|
||||
format: 'dd.mm.yyyy',
|
||||
viewformat: 'dd/mm/yyyy',
|
||||
firstDay: 1
|
||||
datepicker: {
|
||||
firstDay: 1
|
||||
}
|
||||
}),
|
||||
nextD = '16.05.1984',
|
||||
nextDview = '16/05/1984';
|
||||
|
@ -9,11 +9,15 @@ $(function () {
|
||||
5: 'Admin',
|
||||
6: '',
|
||||
'': 'Nothing'
|
||||
};
|
||||
};
|
||||
|
||||
window.size = 0;
|
||||
//groups as array
|
||||
window.groupsArr = [];
|
||||
for(var i in groups) {
|
||||
groupsArr.push({value: i, text: groups[i]});
|
||||
}
|
||||
|
||||
for (e in groups) { size++; }
|
||||
window.size = groupsArr.length;
|
||||
|
||||
$.mockjax({
|
||||
url: 'groups.php',
|
||||
@ -86,7 +90,25 @@ $(function () {
|
||||
ok(!p.is(':visible'), 'popover was removed');
|
||||
});
|
||||
|
||||
test("load options from native array", function () {
|
||||
test("load options from normal array", function () {
|
||||
var e = $('<a href="#" data-type="select" data-value="2" data-url="post.php">customer</a>').appendTo('#qunit-fixture').editable({
|
||||
pk: 1,
|
||||
source: groupsArr,
|
||||
placement: 'right'
|
||||
});
|
||||
|
||||
e.click()
|
||||
var p = tip(e);
|
||||
ok(p.is(':visible'), 'popover visible');
|
||||
ok(p.find('select').length, 'select exists');
|
||||
equal(p.find('select').find('option').length, groupsArr.length, 'options loaded');
|
||||
equal(p.find('select').val(), e.data('editable').value, 'selected value correct');
|
||||
|
||||
p.find('button[type=button]').click();
|
||||
ok(!p.is(':visible'), 'popover was removed');
|
||||
});
|
||||
|
||||
test("load options from simple array", function () {
|
||||
var arr = ['q', 'w', 'x'],
|
||||
e = $('<a href="#" data-type="select" data-value="2" data-url="post.php">customer</a>').appendTo('#qunit-fixture').editable({
|
||||
pk: 1,
|
||||
|
Loading…
x
Reference in New Issue
Block a user