add jquery 1.9.1 and fix tests

This commit is contained in:
vitalets 2013-03-07 00:09:18 +04:00
parent e4565910cc
commit fa11895f0b
9 changed files with 33 additions and 13 deletions

@ -106,10 +106,11 @@ module.exports = function(grunt) {
//module = '&module=select';
//module = '&module=text';
//test on several jquery versions
var qunit_testover = [];
['bootstrap', 'jqueryui', 'plain'].forEach(function(f){
['popup', 'inline'].forEach(function(c){
['1.6.4', '1.7.1', '1.7.2', '1.8.2', '1.8.3'].forEach(function(jqver) {
['1.7.2', '1.8.3', '1.9.1'].forEach(function(jqver) {
qunit_testover.push('http://localhost:8000/test/index.html?f='+f+'&c='+c+'&jquery='+jqver+module);
});
});

5
test/libs/jquery/jquery-1.9.1.min.js vendored Normal file

File diff suppressed because one or more lines are too long

@ -1,6 +1,6 @@
//detect version of jquery from url param, e.g. 'jquery=1.7.2'
var jqver = decodeURIComponent((new RegExp('[?|&]' + 'jquery' + '=' + '([^&;]+?)(&|#|;|$)').exec(location.search)||[,""])[1].replace(/\+/g, '%20'))||null;
jqurl = jqver ? "http://ajax.googleapis.com/ajax/libs/jquery/"+jqver+"/jquery.min.js" : "libs/jquery/jquery-1.8.2.min.js";
jqurl = jqver ? "http://ajax.googleapis.com/ajax/libs/jquery/"+jqver+"/jquery.min.js" : "libs/jquery/jquery-1.9.1.min.js";
require(["loader", jqurl], function(loader) {

@ -5,9 +5,7 @@ $(function () {
$.mockjax({
url: 'post.php',
responseText: {
success: true
}
responseText: '{"success": true}'
});
$.mockjax({

@ -80,8 +80,8 @@
var p = tip(e);
ok(p.is(':visible'), 'popover shown');
//todo: for jqueryui phantomjs calcs wrong position. Need investigation
if(!$.browser.webkit && e.data('editableContainer').containerName !== 'tooltip') {
//todo: for jqueryui phantomjs calcs wrong position. Skip this test..
if(!/phantom/i.test(navigator.userAgent) && e.data('editableContainer').containerName !== 'tooltip') {
ok(p.offset().top > e.offset().top, 'placement ok');
}
@ -276,8 +276,9 @@
test("should not wrap buttons when parent has position:absolute (except ie7)", function () {
//skip this for: ie7 + bootstrap + popup
if($.browser.msie && parseInt($.browser.version, 10) <= 8 && $.fn.editable.defaults.mode === 'popup' && $.fn.editableContainer.Popup.prototype.containerName === 'popover') {
//skip this for: ie7 + bootstrap + popup
var msieOld = /msie\s*(8|7|6)/i.test(navigator.userAgent);
if(msieOld && $.fn.editable.defaults.mode === 'popup' && $.fn.editableContainer.Popup.prototype.containerName === 'popover') {
expect(0);
return;
}

@ -604,6 +604,9 @@ $(function () {
e = $('<a href="#" data-type="select" data-value="2" data-url="post.php"></a>').appendTo(fx).editable({
pk: 1,
source: groups,
ajaxOptions: {
dataType: 'json'
},
display: function(value, sourceData, response) {
var els = $.grep(sourceData, function(o) {return o.value == value;});
$(this).text('qq' + els[0].text);

@ -345,7 +345,10 @@ $(function () {
asyncTest("'display' callback", function () {
var newText = 'cd<e>;"',
e = $('<a href="#" data-pk="1" data-url="post.php" data-name="text1">abc</a>').appendTo(fx).editable({
display: function(value, response) {
ajaxOptions: {
dataType: 'json'
},
display: function(value, response) {
ok(this === e[0], 'scope is ok');
ok(response.success, 'response param ok');
$(this).text('qq'+value);
@ -462,12 +465,17 @@ $(function () {
e.click()
var p = tip(e);
var c = p.find('.editable-clear-x');
ok(c.is(':visible'), 'clear shown');
//now clear shown with delay..
/*
p.find('input').val('').trigger('keyup');
ok(!c.is(':visible'), 'clear hidden for empty input');
p.find('input').val('cde').trigger('keyup');
ok(c.is(':visible'), 'clear shown on keyboard input');
*/
c.click();
ok(!c.is(':visible'), 'clear hidden after click');
ok(!p.find('input').val(), 'input empty');

@ -33,11 +33,14 @@ $(function () {
ok($input.typeahead, 'typeahead applied to input');
$input.val(newText).keyup();
ok(p.find('.typeahead.dropdown-menu').is(':visible'), 'dropdown visible');
//select `Admin`
v = 5;
p.find('.typeahead.dropdown-menu').find('.active').click();
ok(p.find('.typeahead.dropdown-menu').find('li').length, 'active item exists');
p.find('.typeahead.dropdown-menu').find('li').mouseover().click();
equal($input.val(), groups[v], 'input contain correct text');
p.find('form').submit();
@ -91,7 +94,7 @@ $(function () {
//select `ab`
v = 'ab';
p.find('.typeahead.dropdown-menu').find('.active').click();
p.find('.typeahead.dropdown-menu').find('li').mouseover().click();
equal($input.val(), v, 'input contain correct text');
p.find('form').submit();

@ -10,7 +10,8 @@ $(function () {
asyncTest("should load correct value and save new entered value", function () {
//skip test for ie7 as it is not supported by wysihtml5
if($.browser.msie && parseInt($.browser.version, 10) <= 8) {
var msieOld = /msie\s*(7|6)/i.test(navigator.userAgent);
if(msieOld) {
expect(0);
start();
return;