public function testRegisterClientScript() { $class = new \ReflectionClass('webtoolsnz\\widgets\\RadioButtonGroup'); $method = $class->getMethod('registerClientScript'); $method->setAccessible(true); $widget = RadioButtonGroup::begin(['name' => 'test-widget-name', 'items' => Payment::$statuses]); $view = Yii::$app->getView(); $widget->setView($view); $method->invoke($widget); $expected = <<<JS jQuery(\\'#radio_button_w1\\').radioButtonGroup({\\"activeState\\":\\"active btn btn-success\\",\\"defaultState\\":\\"btn btn-default\\",\\"buttons\\":[]}); JS; $this->assertContains($expected, VarDumper::dumpAsString($view->js)); }
<?php echo $form->field($model, 'started_at', ['inputOptions' => ['disabled' => 'disabled']]); ?> <?php } ?> <?php echo $form->field($model, 'last_run', ['inputOptions' => ['disabled' => 'disabled']]); ?> <?php echo $form->field($model, 'next_run', ['inputOptions' => ['disabled' => 'disabled']]); ?> <?php echo $form->field($model, 'active')->widget(RadioButtonGroup::className(), ['items' => [1 => 'Yes', 0 => 'No'], 'itemOptions' => ['buttons' => [0 => ['activeState' => 'btn active btn-danger']]]]); ?> <?php echo Html::submitButton('<span class="glyphicon glyphicon-check"></span> ' . ($model->isNewRecord ? Yii::t('app', 'Create') : Yii::t('app', 'Save')), ['id' => 'save-' . $model->formName(), 'class' => 'btn btn-primary']); ?> <?php ActiveForm::end(); ?> <?php $this->endBlock(); ?>