mirror of
https://github.com/yiisoft/yii2.git
synced 2025-11-02 04:37:42 +08:00
@ -44,7 +44,6 @@ Yii Framework 2 Change Log
|
|||||||
- Bug #16377: Fixed `yii\base\Event:off()` undefined index error when event handler does not match (razvanphp)
|
- Bug #16377: Fixed `yii\base\Event:off()` undefined index error when event handler does not match (razvanphp)
|
||||||
- Bug #16514: Fixed `yii\di\Container::resolveCallableDependencies` to support callable object (wi1dcard)
|
- Bug #16514: Fixed `yii\di\Container::resolveCallableDependencies` to support callable object (wi1dcard)
|
||||||
- Bug #15889: Fixed override `yii\helpers\Html::setActivePlaceholder` (lesha724)
|
- Bug #15889: Fixed override `yii\helpers\Html::setActivePlaceholder` (lesha724)
|
||||||
- Bug #16552: Added check in `yii\db\ActiveQuery::prepare()` to prevent populating already populated relation when another relation is requested with `via` (drlibra)
|
|
||||||
- Enh #16522: Allow jQuery 3.3 (Slamdunk)
|
- Enh #16522: Allow jQuery 3.3 (Slamdunk)
|
||||||
- Enh #16603: Added `yii\mutex\FileMutex::$isWindows` for Windows file shares on Unix guest machines (brandonkelly)
|
- Enh #16603: Added `yii\mutex\FileMutex::$isWindows` for Windows file shares on Unix guest machines (brandonkelly)
|
||||||
- Bug #16666: Fixed `yii\helpers\ArrayHelper::merge` (rustamwin)
|
- Bug #16666: Fixed `yii\helpers\ArrayHelper::merge` (rustamwin)
|
||||||
|
|||||||
@ -238,9 +238,7 @@ yii.validation = (function ($) {
|
|||||||
|
|
||||||
trim: function ($form, attribute, options, value) {
|
trim: function ($form, attribute, options, value) {
|
||||||
var $input = $form.find(attribute.input);
|
var $input = $form.find(attribute.input);
|
||||||
var isCheckAble = $input.find('[type=radio]').is('[type=radio]') || $input.find('[type=checkbox]').is('[type=checkbox]');
|
if ($input.is(':checkbox, :radio')) {
|
||||||
|
|
||||||
if (!isCheckAble) {
|
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -172,19 +172,11 @@ class ActiveQuery extends Query implements ActiveQueryInterface
|
|||||||
/* @var $viaQuery ActiveQuery */
|
/* @var $viaQuery ActiveQuery */
|
||||||
list($viaName, $viaQuery) = $this->via;
|
list($viaName, $viaQuery) = $this->via;
|
||||||
if ($viaQuery->multiple) {
|
if ($viaQuery->multiple) {
|
||||||
if ($this->primaryModel->isRelationPopulated($viaName)) {
|
$viaModels = $viaQuery->all();
|
||||||
$viaModels = $this->primaryModel->$viaName;
|
$this->primaryModel->populateRelation($viaName, $viaModels);
|
||||||
} else {
|
|
||||||
$viaModels = $viaQuery->all();
|
|
||||||
$this->primaryModel->populateRelation($viaName, $viaModels);
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
if ($this->primaryModel->isRelationPopulated($viaName)) {
|
$model = $viaQuery->one();
|
||||||
$model = $this->primaryModel->$viaName;
|
$this->primaryModel->populateRelation($viaName, $model);
|
||||||
} else {
|
|
||||||
$model = $viaQuery->one();
|
|
||||||
$this->primaryModel->populateRelation($viaName, $model);
|
|
||||||
}
|
|
||||||
$viaModels = $model === null ? [] : [$model];
|
$viaModels = $model === null ? [] : [$model];
|
||||||
}
|
}
|
||||||
$this->filterByModels($viaModels);
|
$this->filterByModels($viaModels);
|
||||||
|
|||||||
@ -523,7 +523,7 @@ class Container extends Component
|
|||||||
{
|
{
|
||||||
if (is_array($callback)) {
|
if (is_array($callback)) {
|
||||||
$reflection = new \ReflectionMethod($callback[0], $callback[1]);
|
$reflection = new \ReflectionMethod($callback[0], $callback[1]);
|
||||||
} elseif (is_object($callback)) {
|
} elseif (is_object($callback) && !$callback instanceof \Closure) {
|
||||||
$reflection = new \ReflectionMethod($callback, '__invoke');
|
$reflection = new \ReflectionMethod($callback, '__invoke');
|
||||||
} else {
|
} else {
|
||||||
$reflection = new \ReflectionFunction($callback);
|
$reflection = new \ReflectionFunction($callback);
|
||||||
|
|||||||
@ -1214,6 +1214,9 @@ describe('yii.validation', function () {
|
|||||||
var $input = {
|
var $input = {
|
||||||
val: function () {
|
val: function () {
|
||||||
return getInputVal();
|
return getInputVal();
|
||||||
|
},
|
||||||
|
is: function () {
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
var $form = {
|
var $form = {
|
||||||
@ -1274,6 +1277,32 @@ describe('yii.validation', function () {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe('trim filter on checkbox', function () {
|
||||||
|
var attribute = {input: '#input-id'};
|
||||||
|
var getInputVal;
|
||||||
|
var $checkbox = {
|
||||||
|
is: function (selector) {
|
||||||
|
if (selector === ':checked') {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (selector === ':checkbox, :radio') {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
var $form = {
|
||||||
|
find: function () {
|
||||||
|
return $checkbox;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
it('should be left as is', function () {
|
||||||
|
assert.strictEqual(yii.validation.trim($form, attribute, {}, true), true);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
describe('captcha validator', function () {
|
describe('captcha validator', function () {
|
||||||
// Converted using yii\captcha\CaptchaAction generateValidationHash() method
|
// Converted using yii\captcha\CaptchaAction generateValidationHash() method
|
||||||
var hashes = {'Code': 379, 'code': 411};
|
var hashes = {'Code': 379, 'code': 411};
|
||||||
|
|||||||
Reference in New Issue
Block a user