convert newlines to br in error msg

This commit is contained in:
vitalets
2012-12-28 17:39:39 +04:00
parent 1d6de6fe71
commit 5f3f820312
3 changed files with 15 additions and 4 deletions
CHANGELOG.txt
src/editable-form
test/unit

@ -86,7 +86,7 @@ $(function () {
});
asyncTest("should show error on server validation", function () {
var msg = 'required',
var msg = "required\nfield",
e = $('<a href="#" data-name="text1">abc</a>').appendTo(fx).editable({
validate: function(value) {
ok(this === e[0], 'scope is ok');
@ -104,7 +104,8 @@ $(function () {
setTimeout(function() {
ok(p.is(':visible'), 'popover still shown');
ok(p.find('.editable-error-block').length, 'class "editable-error-block" exists');
equal(p.find('.editable-error-block').text(), 'required', 'error msg shown');
equal(p.find('.editable-error-block').text(), msg.replace('\n', ''), 'error msg shown');
equal(p.find('.editable-error-block').html(), msg.replace('\n', '<br>'), 'newline replaced with br');
p.find('button[type=button]').click();
ok(!p.is(':visible'), 'popover was removed');
e.remove();