Skip to content

Commit

Permalink
Updated conditional comments with Andrew's recommendations
Browse files Browse the repository at this point in the history
  • Loading branch information
thecontrarycat committed Mar 5, 2012
1 parent 4ff1bb8 commit 5bdfaa3
Show file tree
Hide file tree
Showing 12 changed files with 25 additions and 11 deletions.
14 changes: 14 additions & 0 deletions src/Cassette.IntegrationTests/CassetteApplication.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,19 @@ public CassetteApplicationTests()
readonly Mock<HttpContextBase> httpContext;
readonly Dictionary<string, object> httpContextItems;

[Fact]
public void MhtmlStylesheetHasCorrectContentType()
{
using (CreateApplication(bundles => bundles.Add<StylesheetBundle>("Styles", b => b.Processor = new StylesheetPipeline().EmbedImages(ImageEmbedType.Mhtml))))
{
using (var http = new HttpTestHarness(routes))
{
http.Get("~/_cassette/stylesheetbundle/styles");
Assert.Equal<string>(http.Response.Object.ContentType,"message/rfc822");
}
}
}

[Fact]
public void CanGetScriptBundleA()
{
Expand Down Expand Up @@ -204,6 +217,7 @@ public HttpTestHarness(RouteCollection routes)
Response.Setup(r => r.ApplyAppPathModifier(It.IsAny<string>())).Returns<string>(r => r);
Response.SetupGet(r => r.OutputStream).Returns(ResponseOutputStream);
Response.SetupGet(r => r.Cache).Returns(ResponseCache.Object);
Response.SetupProperty(r => r.ContentType);
}

RouteCollection routes;
Expand Down
2 changes: 0 additions & 2 deletions src/Cassette/Bundle.cs
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,6 @@ internal void Process(CassetteSettings settings)
IsProcessed = true;
}

internal ConditionalRenderer ConditionalRenderer { get { return conditionalRenderer; } }

protected abstract void ProcessCore(CassetteSettings settings);

internal bool IsProcessed { get; private set; }
Expand Down
2 changes: 1 addition & 1 deletion src/Cassette/Scripts/DebugScriptBundleHtmlRenderer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public string Render(ScriptBundle bundle)

if (bundle.HasCondition)
{
return bundle.ConditionalRenderer.RenderCondition(bundle.Condition, html.ToString());
return new ConditionalRenderer().RenderCondition(bundle.Condition, html.ToString());
}
else
{
Expand Down
2 changes: 1 addition & 1 deletion src/Cassette/Scripts/ExternalScriptBundleHtmlRenderer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public string Render(ScriptBundle bundle)

if (bundle.HasCondition)
{
return bundle.ConditionalRenderer.RenderCondition(bundle.Condition, html.ToString());
return new ConditionalRenderer().RenderCondition(bundle.Condition, html.ToString());
}
else
{
Expand Down
2 changes: 1 addition & 1 deletion src/Cassette/Scripts/InlineScriptBundle.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ internal override string Render()

if (HasCondition)
{
return ConditionalRenderer.RenderCondition(Condition, html.ToString());
return new ConditionalRenderer().RenderCondition(Condition, html.ToString());
}
else
{
Expand Down
2 changes: 1 addition & 1 deletion src/Cassette/Scripts/ScriptBundle.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ protected ScriptBundle()
/// </summary>
public string Condition { get; set; }

public bool HasCondition
internal bool HasCondition
{
get { return !String.IsNullOrEmpty(Condition); }
}
Expand Down
2 changes: 1 addition & 1 deletion src/Cassette/Scripts/ScriptBundleHtmlRenderer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public string Render(ScriptBundle bundle)

if (bundle.HasCondition)
{
return bundle.ConditionalRenderer.RenderCondition(bundle.Condition, html.ToString());
return new ConditionalRenderer().RenderCondition(bundle.Condition, html.ToString());
}
else
{
Expand Down
2 changes: 1 addition & 1 deletion src/Cassette/Stylesheets/DebugStylesheetHtmlRenderer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public string Render(StylesheetBundle bundle)

if (bundle.HasCondition)
{
return bundle.ConditionalRenderer.RenderCondition(bundle.Condition, html.ToString());
return new ConditionalRenderer().RenderCondition(bundle.Condition, html.ToString());
}
else
{
Expand Down
2 changes: 1 addition & 1 deletion src/Cassette/Stylesheets/ExternalStylesheetHtmlRenderer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public string Render(StylesheetBundle bundle)

if (bundle.HasCondition)
{
return bundle.ConditionalRenderer.RenderCondition(bundle.Condition, html.ToString());
return new ConditionalRenderer().RenderCondition(bundle.Condition, html.ToString());
}
else
{
Expand Down
2 changes: 1 addition & 1 deletion src/Cassette/Stylesheets/StylesheetBundle.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public StylesheetBundle(string applicationRelativePath)
/// </summary>
public string Condition { get; set; }

public bool HasCondition
internal bool HasCondition
{
get { return !String.IsNullOrEmpty(Condition); }
}
Expand Down
2 changes: 1 addition & 1 deletion src/Cassette/Stylesheets/StylesheetHtmlRenderer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public string Render(StylesheetBundle bundle)

if (bundle.HasCondition)
{
return bundle.ConditionalRenderer.RenderCondition(bundle.Condition, html.ToString());
return new ConditionalRenderer().RenderCondition(bundle.Condition, html.ToString());
}
else
{
Expand Down
2 changes: 2 additions & 0 deletions src/Cassette/Stylesheets/StylesheetPipelineExtensions.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using Cassette.BundleProcessing;

namespace Cassette.Stylesheets
{
Expand All @@ -14,6 +15,7 @@ public static StylesheetPipeline EmbedImages(this StylesheetPipeline pipeline, F
if (type == ImageEmbedType.Mhtml)
{
// TODO: MHTML support
pipeline.InsertBefore<ExpandCssUrls>(new AssignContentType("message/rfc822"));
}
else
{
Expand Down

0 comments on commit 5bdfaa3

Please sign in to comment.