init
This commit is contained in:
.gitignoreCHANGELOG.txtLICENSE-GPLLICENSE-MITREADME.mdgrunt.jsjquery.ui.datepicker-ru.jsmakezippackage.json
libs
bootstrap204
css
img
js
bootstrap211
css
img
js
bootstrap221
css
img
js
jquery-ui-1.9.1.custom
css
redmond
images
ui-bg_flat_0_aaaaaa_40x100.pngui-bg_flat_55_fbec88_40x100.pngui-bg_glass_75_d0e5f5_1x400.pngui-bg_glass_85_dfeffc_1x400.pngui-bg_glass_95_fef1ec_1x400.pngui-bg_gloss-wave_55_5c9ccc_500x100.pngui-bg_inset-hard_100_f5f8f9_1x100.pngui-bg_inset-hard_100_fcfdfd_1x100.pngui-icons_217bc0_256x240.pngui-icons_2e83ff_256x240.pngui-icons_469bdd_256x240.pngui-icons_6da8d5_256x240.pngui-icons_cd0a0a_256x240.pngui-icons_d8e7f3_256x240.pngui-icons_f9bd01_256x240.png
jquery-ui-1.9.1.custom.cssjquery-ui-1.9.1.custom.min.csssmoothness
images
ui-bg_flat_0_aaaaaa_40x100.pngui-bg_flat_75_ffffff_40x100.pngui-bg_glass_55_fbf9ee_1x400.pngui-bg_glass_65_ffffff_1x400.pngui-bg_glass_75_dadada_1x400.pngui-bg_glass_75_e6e6e6_1x400.pngui-bg_glass_95_fef1ec_1x400.pngui-bg_highlight-soft_75_cccccc_1x100.pngui-icons_222222_256x240.pngui-icons_2e83ff_256x240.pngui-icons_454545_256x240.pngui-icons_888888_256x240.pngui-icons_cd0a0a_256x240.png
jquery-ui-1.9.1.custom.cssjquery-ui-1.9.1.custom.min.cssjs
jquery-ui-datepicker
jquery
mockjax
poshytip
jquery.poshytip.jsjquery.poshytip.min.jsjquery.poshytip_corrected.js
tip-darkgray
tip-green
tip-skyblue
tip-twitter
tip-violet
tip-yellow
tip-yellowsimple
qunit
src
containers
editable-container.csseditable-container.jseditable-inline.jseditable-popover.jseditable-poshytip.jseditable-tooltip.js
editable-form
editable-form-bootstrap.jseditable-form-jqueryui.jseditable-form-utils.jseditable-form.csseditable-form.js
img
element
inputs
abstract.js
date
bootstrap-datepicker.jsdate.jsdatepicker.css
dateui.jsselect.jstext.jstextarea.jslocales
bootstrap-datepicker.bg.jsbootstrap-datepicker.br.jsbootstrap-datepicker.cs.jsbootstrap-datepicker.da.jsbootstrap-datepicker.de.jsbootstrap-datepicker.es.jsbootstrap-datepicker.fi.jsbootstrap-datepicker.fr.jsbootstrap-datepicker.id.jsbootstrap-datepicker.is.jsbootstrap-datepicker.it.jsbootstrap-datepicker.ja.jsbootstrap-datepicker.kr.jsbootstrap-datepicker.lt.jsbootstrap-datepicker.lv.jsbootstrap-datepicker.ms.jsbootstrap-datepicker.nb.jsbootstrap-datepicker.nl.jsbootstrap-datepicker.pl.jsbootstrap-datepicker.pt-BR.jsbootstrap-datepicker.pt.jsbootstrap-datepicker.ru.jsbootstrap-datepicker.sl.jsbootstrap-datepicker.sv.jsbootstrap-datepicker.th.jsbootstrap-datepicker.tr.jsbootstrap-datepicker.zh-CN.jsbootstrap-datepicker.zh-TW.js
test
110
test/unit/textarea.js
Normal file
110
test/unit/textarea.js
Normal file
@@ -0,0 +1,110 @@
|
||||
$(function () {
|
||||
|
||||
var v1 = 'abb&c"',
|
||||
v2 = "a!b<b>'c";
|
||||
|
||||
module("textarea", {
|
||||
setup: function(){
|
||||
fx = $('#async-fixture'),
|
||||
$.fn.editable.defaults.name = 'name1';
|
||||
}
|
||||
});
|
||||
|
||||
test("textarea should contain '' if element is empty", function () {
|
||||
var e = $('<a href="#" data-type="textarea"></a>').appendTo('#qunit-fixture').editable()
|
||||
e.click()
|
||||
var p = tip(e);
|
||||
ok(p.find('textarea').length, 'textarea exists')
|
||||
ok(!p.find('textarea').val().length, 'textrea is empty')
|
||||
p.find('button[type=button]').click();
|
||||
ok(!p.is(':visible'), 'popover was removed')
|
||||
})
|
||||
|
||||
test("placeholder", function () {
|
||||
var e = $('<a href="#" data-type="textarea"></a>').appendTo('#qunit-fixture').editable({placeholder: 'abc'})
|
||||
e.click()
|
||||
var p = tip(e);
|
||||
equal(p.find('textarea').attr('placeholder'), 'abc', 'placeholder exists');
|
||||
p.find('button[type=button]').click();
|
||||
ok(!p.is(':visible'), 'popover was removed');
|
||||
})
|
||||
|
||||
|
||||
asyncTest("should load correct value and save new entered text (and value)", function () {
|
||||
var e = $('<a href="#" data-pk="1" data-url="post.php">'+v1+'</a>').appendTo(fx).editable({
|
||||
type: 'textarea',
|
||||
send: 'ifpk',
|
||||
success: function(data) {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
e.click()
|
||||
var p = tip(e);
|
||||
ok(p.is(':visible'), 'popover visible');
|
||||
ok(p.find('textarea').length, 'textarea exists');
|
||||
equal(p.find('textarea').val(), e.data('editable').value, 'textrea val equal text');
|
||||
|
||||
p.find('textarea').val(v2);
|
||||
p.find('form').submit();
|
||||
|
||||
setTimeout(function() {
|
||||
ok(!p.is(':visible'), 'popover closed')
|
||||
equal(e.data('editable').value, v2, 'new text saved to value')
|
||||
equal(e.text().toLowerCase(), v2.toLowerCase(), 'new text shown')
|
||||
e.remove();
|
||||
start();
|
||||
}, timeout);
|
||||
})
|
||||
|
||||
asyncTest("should replace <br> with newline (on show) and back (on save)", function () {
|
||||
var v = '12<br>3<i>4<br />56',
|
||||
e = $('<a href="#" data-type="textarea" data-pk="1" data-url="post.php">'+v+'</a>').appendTo(fx).editable(),
|
||||
v1 = '12\n3<i>4\n56',
|
||||
vnew = "12\n3<b>4\n56\n\n78",
|
||||
vnew2 = "12<br>3<b>4<br>56<br><br>78";
|
||||
|
||||
equal(e.data('editable').value, v1, '<br> replaced with new lines');
|
||||
|
||||
e.click();
|
||||
var p = tip(e);
|
||||
equal(p.find('textarea').val(), e.data('editable').value, 'textarea contains correct value');
|
||||
|
||||
p.find('textarea').val(vnew)
|
||||
p.find('form').submit();
|
||||
|
||||
setTimeout(function() {
|
||||
ok(!p.is(':visible'), 'popover closed')
|
||||
equal(e.data('editable').value, vnew, 'new text saved to value')
|
||||
equal(e.html().toLowerCase(), vnew2.toLowerCase(), 'new text shown')
|
||||
e.remove();
|
||||
start();
|
||||
}, timeout);
|
||||
})
|
||||
|
||||
asyncTest("submit by ctrl+enter", function () {
|
||||
expect(2);
|
||||
var v = '12<br>3<i>4<br />56',
|
||||
e = $('<a href="#" data-type="textarea" data-pk="1" data-url="post.php">'+v+'</a>').appendTo(fx).editable(),
|
||||
vnew = 'sdfg',
|
||||
event;
|
||||
|
||||
e.click();
|
||||
var p = tip(e);
|
||||
p.find('textarea').val(vnew);
|
||||
|
||||
event = jQuery.Event("keydown");
|
||||
event.ctrlKey = true;
|
||||
event.which = 13;
|
||||
|
||||
p.find('textarea').trigger(event);
|
||||
|
||||
setTimeout(function() {
|
||||
ok(!p.is(':visible'), 'popover closed');
|
||||
equal(e.data('editable').value, vnew, 'new text saved to value');
|
||||
e.remove();
|
||||
start();
|
||||
}, timeout);
|
||||
})
|
||||
|
||||
})
|
Reference in New Issue
Block a user