Browse Source

Fixes #16425: Check for additional values for disabled confirm dialog

tags/2.0.16
Evgeniy Moiseenko 6 years ago committed by Alexander Makarov
parent
commit
7c76696905
  1. 1
      framework/CHANGELOG.md
  2. 2
      framework/assets/yii.js
  3. 27
      tests/js/tests/yii.test.js

1
framework/CHANGELOG.md

@ -4,6 +4,7 @@ Yii Framework 2 Change Log
2.0.16 under development
------------------------
- Bug #16425: Check for additional values for disabled confirm dialog (Alex-Code, s1lver)
- Enh #14367: In `yii\db\mysql\QueryBuilder` added support fractional seconds for time types for MySQL >= 5.6.4 (konstantin-vl)
- Bug #16766: `yii\filters\ContentNegotiator` was not setting `Vary` header to inform cache recipients (koteq, cebe, samdark)
- Bug #11960: Fixed `checked` option ignore in `yii\helpers\BaseHtml::checkbox()` (misantron)

2
framework/assets/yii.js

@ -483,7 +483,7 @@ window.yii = (function ($) {
return true;
}
if (message !== undefined) {
if (message !== undefined && message !== false && message !== '') {
$.proxy(pub.confirm, this)(message, function () {
pub.handleAction($this, event);
});

27
tests/js/tests/yii.test.js

@ -1359,6 +1359,33 @@ describe('yii', function () {
});
});
describe('disabled confirm dialog', function () {
it('confirm data param = false', function () {
var element = $('#data-methods-no-data');
element.attr('data-confirm', false);
element.trigger($.Event('click'));
assert.isFalse(yiiConfirmSpy.called);
assert.isTrue(yiiHandleActionStub.called);
});
it('confirm data param = empty', function () {
var element = $('#data-methods-no-data');
element.attr('data-confirm', '');
element.trigger($.Event('click'));
assert.isFalse(yiiConfirmSpy.called);
assert.isTrue(yiiHandleActionStub.called);
});
it('confirm data param = undefined', function () {
var element = $('#data-methods-no-data');
element.attr('data-confirm', undefined);
element.trigger($.Event('click'));
assert.isFalse(yiiConfirmSpy.called);
assert.isTrue(yiiHandleActionStub.called);
});
});
describe('with clickableSelector with data-confirm', function () {
it('should call confirm and handleAction methods', function () {
var event = $.Event('click');

Loading…
Cancel
Save