Skip to content

Commit a7cd19c

Browse files
committed
Merge branch 'master' of github.com:webtoolsnz/yii2-widgets
2 parents f9fcba1 + deb2e74 commit a7cd19c

File tree

5 files changed

+92
-4
lines changed

5 files changed

+92
-4
lines changed

composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@
2525
"symfony/intl": "^2.7",
2626
"symfony/yaml": "^2.8",
2727
"bower-asset/font-awesome": "^4.3",
28-
"bower-asset/signature_pad": "^1.5"
28+
"bower-asset/signature_pad": "1.5.3",
29+
"bower-asset/bootbox.js": "4.4.0"
2930
},
3031
"require-dev": {
3132
"phpunit/phpunit": "^4.7.7",

composer.lock

Lines changed: 33 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/BootBoxAsset.php

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<?php
2+
/**
3+
* Asset for bootbox plugin
4+
* @author Brusenskiy Dmitry <brussens@nativeweb.ru>
5+
* @author Christopher Henderson <chris@inspiral.co.nz>
6+
*
7+
* @link https://github.com/webtoolsnz/yii2-widgets
8+
* @link https://github.com/yiiassets/yii2-bootbox-asset
9+
* @link http://bootboxjs.com/
10+
* @copyright 2015 Brusenskiy Dmitry
11+
* @license http://opensource.org/licenses/MIT MIT
12+
*/
13+
14+
namespace webtoolsnz\widgets;
15+
16+
17+
use Yii;
18+
use yii\web\AssetBundle;
19+
20+
class BootBoxAsset extends AssetBundle
21+
{
22+
public $sourcePath = '@vendor/bower/bootbox.js';
23+
24+
public $js = [
25+
'bootbox.js',
26+
];
27+
28+
public $depends = [
29+
'yii\bootstrap\BootstrapAsset',
30+
];
31+
}

src/assets/js/checkbox-button-group.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
}).each(function () {
2727
this.checked = !this.checked;
2828
$(btn).attr('class', this.checked ? activeState : defaultState);
29-
});
29+
}).trigger('change');
3030

3131
});
3232
});

tests/BootBoxTest.php

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<?php
2+
3+
namespace tests;
4+
5+
use Yii;
6+
use webtoolsnz\widgets\BootBoxAsset;
7+
use yii\web\AssetBundle;
8+
9+
class BootBoxAssetTest extends TestCase
10+
{
11+
public function testRegister()
12+
{
13+
$view = Yii::$app->getView();
14+
$this->assertEmpty($view->assetBundles);
15+
16+
BootBoxAsset::register($view);
17+
18+
$this->assertEquals(2, count($view->assetBundles));
19+
$this->assertArrayHasKey('webtoolsnz\\widgets\\BootBoxAsset', $view->assetBundles);
20+
$this->assertTrue($view->assetBundles['webtoolsnz\\widgets\\BootBoxAsset'] instanceof AssetBundle);
21+
22+
$content = $view->renderFile('@tests/views/layouts/raw.php');
23+
$this->assertContains('bootbox.js', $content);
24+
}
25+
}

0 commit comments

Comments
 (0)