Ejemplo n.º 1
0
 /**
  * Registers wysihtml5 plugin and the related events
  */
 protected function registerClientScript()
 {
     $view = $this->getView();
     DatePickerAsset::register($view);
     JuiAsset::register($view);
     $id = $this->options['id'];
     $options = Json::encode($this->clientOptions);
     $view->registerJs("jQuery('#{$id}').progressiveDatePicker('{$this->options['formattedValue']}', {$options});");
 }
Ejemplo n.º 2
0
 public function testAssetRegister()
 {
     $view = Yii::$app->getView();
     $this->assertEmpty($view->assetBundles);
     DatePickerAsset::register($view);
     $this->assertEquals(4, count($view->assetBundles));
     $this->assertArrayHasKey('yii\\web\\JqueryAsset', $view->assetBundles);
     $this->assertArrayHasKey('yii\\jui\\JuiAsset', $view->assetBundles);
     $this->assertArrayHasKey('webtoolsnz\\widgets\\ModernizrAsset', $view->assetBundles);
     $this->assertTrue($view->assetBundles['webtoolsnz\\widgets\\ModernizrAsset'] instanceof AssetBundle);
     $this->assertTrue($view->assetBundles['webtoolsnz\\widgets\\DatePickerAsset'] instanceof AssetBundle);
     $content = $view->renderFile('@tests/views/layouts/raw.php');
     $this->assertContains('jquery.js', $content);
     $this->assertContains('jquery-ui.js', $content);
     $this->assertContains('modernizr.js', $content);
     $this->assertContains('progressive-datepicker.js', $content);
 }