diff --git a/composer.json b/composer.json index 211ae65..66663c1 100644 --- a/composer.json +++ b/composer.json @@ -1,26 +1,27 @@ { - "name": "packaged/dispatch", - "license": "MIT", - "authors": [ + "name": "packaged/dispatch", + "license": "MIT", + "authors": [ { "name": "Brooke Bryan", "email": "brooke@bajb.net" } ], - "bin": [ + "bin": [ "bin/dispatch" ], - "require": { + "require": { "php": ">=5.4.0", "packaged/helpers": "0.*", "packaged/config": "0.*", "symfony/http-kernel": "2.*", - "symfony/console": "2.*" + "symfony/console": "2.*", + "tedivm/jshrink": "~1.0" }, - "require-dev": { + "require-dev": { "phpunit/phpunit": "*" }, - "autoload": { + "autoload": { "psr-4": { "Packaged\\Dispatch\\": "src" } diff --git a/src/Assets/JavascriptAsset.php b/src/Assets/JavascriptAsset.php index 347f641..fdcb29f 100644 --- a/src/Assets/JavascriptAsset.php +++ b/src/Assets/JavascriptAsset.php @@ -1,6 +1,7 @@ assertEquals('js', $asset->getExtension()); $this->assertEquals('text/javascript', $asset->getContentType()); } + + /** + * @ref Issue 2 + * @link https://github.com/packaged/dispatch/issues/2 + */ + public function testSingleLineCommands() + { + $raw = '$(document).ready(function(){ + + $(window).scroll(function () { + + var max_scroll = 273; //height to scroll before hitting nav-bar + + var navbar = $(".main-nav"); + }); +});'; + + $asset = new \Packaged\Dispatch\Assets\JavascriptAsset(); + $asset->setContent($raw); + $this->assertEquals( + '$(document).ready(function(){$(window).scroll(function()' + . '{var max_scroll=273;var navbar=$(".main-nav");});});', + $asset->getContent() + ); + } }