From d1b2c25453dcbeed8e3383a084c53e8fc6a85bee Mon Sep 17 00:00:00 2001 From: vave Date: Sun, 19 May 2019 11:32:11 +0200 Subject: [PATCH] AngularTest.php missing array in testSortRelationArrayDirective (#297) * Update AngularTest.php a small typo, a defined list is missing from directives.js * @var object $options Provides options to build the sort relation array: * * ```js * { * 'sourceData': [ * {'value': 1, 'label': 'Source Entry #1'} * {'value': 2, 'label': 'Source Entry #2'} * {'value': 3, 'label': 'Source Entry #3'} * {'value': 4, 'label': 'Source Entry #4'} * ] * } * ``` * Update Angular.php * Ensure value and label as keys * Update Angular.php * Update AngularTest.php --- src/helpers/Angular.php | 2 +- tests/admin/helpers/AngularTest.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/helpers/Angular.php b/src/helpers/Angular.php index 4ce9cdd734..0fc79956ef 100644 --- a/src/helpers/Angular.php +++ b/src/helpers/Angular.php @@ -141,7 +141,7 @@ public static function directive($name, array $options = []) */ public static function sortRelationArray($ngModel, $label, array $sourceData, array $options = []) { - return self::injector(TypesInterface::TYPE_SORT_RELATION_ARRAY, $ngModel, $label, ['sourceData' => $sourceData], $options); + return self::injector(TypesInterface::TYPE_SORT_RELATION_ARRAY, $ngModel, $label, ['sourceData' => static::optionsArrayInput($sourceData)], $options); } /** diff --git a/tests/admin/helpers/AngularTest.php b/tests/admin/helpers/AngularTest.php index d4d11fb5b4..b1ce7e47e5 100644 --- a/tests/admin/helpers/AngularTest.php +++ b/tests/admin/helpers/AngularTest.php @@ -21,8 +21,8 @@ public function testTextDirective() public function testSortRelationArrayDirective() { - $this->assertSame('', Angular::sortRelationArray('the-model', 'the-label', ['foo' => 'bar'])->render()); - $this->assertSame('', Angular::sortRelationArray('the-model', 'the-label', ['foo' => 'bar'], ['classAtr' => 'value'])->render()); + $this->assertSame('', Angular::sortRelationArray('the-model', 'the-label', ['foo' => 'bar'])->render()); + $this->assertSame('', Angular::sortRelationArray('the-model', 'the-label', ['foo' => 'bar'], ['classAtr' => 'value'])->render()); } public function testCheckbox()