/** * Registers wysihtml5 plugin and the related events */ protected function registerClientScript() { $view = $this->getView(); Wysihtml5Asset::register($view); $id = $this->options['id']; $options = Json::encode($this->clientOptions); $js[] = "jQuery('#{$id}').wysihtml5({$options});"; $view->registerJs(implode("\n", $js)); }
public function testAssetRegister() { $view = Yii::$app->getView(); $this->assertEmpty($view->assetBundles); Wysihtml5Asset::register($view); $this->assertEquals(4, count($view->assetBundles)); $this->assertArrayHasKey('yii\\web\\JqueryAsset', $view->assetBundles); $this->assertTrue($view->assetBundles['webtoolsnz\\widgets\\Wysihtml5Asset'] instanceof AssetBundle); $content = $view->renderFile('@tests/views/layouts/raw.php'); $this->assertContains('bootstrap.css', $content); $this->assertContains('bootstrap3-wysihtml5.css', $content); $this->assertContains('bootstrap.js', $content); $this->assertContains('bootstrap3-wysihtml5.all.min.js', $content); }