From ab9b9c4b26478d402762bf96b74eabe7b48f190f Mon Sep 17 00:00:00 2001 From: Wilmer Arambula Date: Wed, 28 Feb 2024 06:28:57 -0300 Subject: [PATCH] Update asset dependencies. --- src/Asset/DateTimePickerAsset.php | 5 +---- src/Asset/JQueryProviderAsset.php | 5 +++++ src/DateTimePicker.php | 2 +- tests/AssetTest.php | 4 ++-- 4 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/Asset/DateTimePickerAsset.php b/src/Asset/DateTimePickerAsset.php index 4c44c76..7bf7688 100644 --- a/src/Asset/DateTimePickerAsset.php +++ b/src/Asset/DateTimePickerAsset.php @@ -17,10 +17,7 @@ final class DateTimePickerAsset extends AssetBundle /** * @phpstan-var array */ - public $depends = [ - PopperAsset::class, - JQueryProviderAsset::class, - ]; + public $depends = [PopperAsset::class]; public function __construct() { diff --git a/src/Asset/JQueryProviderAsset.php b/src/Asset/JQueryProviderAsset.php index 15f9872..82fafee 100644 --- a/src/Asset/JQueryProviderAsset.php +++ b/src/Asset/JQueryProviderAsset.php @@ -13,6 +13,11 @@ final class JQueryProviderAsset extends AssetBundle { public $sourcePath = '@npm/eonasdan--tempus-dominus/dist/js'; + /** + * @phpstan-var array + */ + public $depends = [DateTimePickerAsset::class]; + public function __construct() { parent::__construct(); diff --git a/src/DateTimePicker.php b/src/DateTimePicker.php index af16229..4b512bd 100644 --- a/src/DateTimePicker.php +++ b/src/DateTimePicker.php @@ -195,7 +195,7 @@ private function registerClientScript(): void match ($this->cdn) { true => Asset\DateTimePickerCdnAsset::register($view), - default => Asset\DateTimePickerAsset::register($view), + default => Asset\JQueryProviderAsset::register($view), }; $view->registerJs($this->getScript()); diff --git a/tests/AssetTest.php b/tests/AssetTest.php index bcb4a85..0303dd8 100644 --- a/tests/AssetTest.php +++ b/tests/AssetTest.php @@ -30,7 +30,7 @@ public function testDateTimePickerAssetSimpleDependency(): void { $this->assertEmpty($this->view->assetBundles); - DateTimePickerAsset::register($this->view); + JQueryProviderAsset::register($this->view); $this->assertCount(3, $this->view->assetBundles); @@ -43,7 +43,7 @@ public function testDateTimePickerAssetRegister(): void { $this->assertEmpty($this->view->assetBundles); - DateTimePickerAsset::register($this->view); + JQueryProviderAsset::register($this->view); $this->assertCount(3, $this->view->assetBundles);