Use configurable content type for detection of minifiable content.

Squashed changes:

  - Prevent side effects of content type testing.
  - Test for inline minification in PHP files.
This commit is contained in:
Andrew Kvalheim 2014-10-12 15:44:16 -07:00
parent fbe71f51e4
commit 049dabbf15
12 changed files with 276 additions and 46 deletions

View file

@ -88,7 +88,7 @@ Feature: Minify Javascript
</script>
"""
Scenario: Rendering inline css with a passthrough minifier using activate-style compressor
Scenario: Rendering inline JS with a passthrough minifier using activate-style compressor
Given a fixture app "passthrough-app"
And a file named "config.rb" with:
"""
@ -148,6 +148,42 @@ Feature: Minify Javascript
</script>
"""
Scenario: Rendering inline js in a PHP document
Given a fixture app "minify-js-app"
And a file named "config.rb" with:
"""
activate :minify_javascript, :inline => true
"""
And the Server is running at "minify-js-app"
When I go to "/inline-js.php"
Then I should see:
"""
<?='Hello'?>
<script>
!function(){should(),all.be(),on={one:line}}();
</script>
<script type='text/javascript'>
//<!--
!function(){one,line(),here()}();
//-->
</script>
<script type='text/html'>
I'm a jQuery {{template}}.
</script>
"""
Scenario: Rendering inline js in a proxied resource
Given a fixture app "minify-js-app"
And a file named "config.rb" with:
"""
activate :minify_javascript, :inline => true
proxy '/inline-js-proxy', '/inline-js.html', ignore: true
"""
And the Server is running at "minify-js-app"
When I go to "/inline-js-proxy"
Then I should see "14" lines
Scenario: Rendering external js with the feature enabled
Given a fixture app "minify-js-app"
And a file named "config.rb" with:
@ -160,6 +196,17 @@ Feature: Minify Javascript
When I go to "/more-js/other.js"
Then I should see "1" lines
Scenario: Rendering external js in a proxied resource
Given a fixture app "minify-js-app"
And a file named "config.rb" with:
"""
activate :minify_javascript
proxy '/js-proxy', '/javascripts/js_test.js', ignore: true
"""
And the Server is running at "minify-js-app"
When I go to "/js-proxy"
Then I should see "1" lines
Scenario: Rendering external js with a passthrough minifier
And the Server is running at "passthrough-app"
When I go to "/javascripts/js_test.js"