Skip to content

Commit

Permalink
changed default favicon behaviour to be png
Browse files Browse the repository at this point in the history
  • Loading branch information
iJungleboy committed Oct 15, 2019
1 parent a38cfed commit 583356d
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
20 changes: 20 additions & 0 deletions Razor Blades Tests/HtmlTagsTests/IconTests/IconSets.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,25 @@ public void DefaultSet()
var path = "/path/icon.png";
var set = Connect.Razor.Internals.HtmlPage.IconSet.GenerateIconSet(path);
Assert.AreEqual(4, set.Count, "expected 3 items in set");
Is($"<link rel='{Icon.RelIcon}' type='{Mime.MimeTypes["png"]}' href='{path}'>",
set[0]);
Is($"<link rel='{Icon.RelShortcut}' type='{Mime.MimeTypes["png"]}' href='{path}'>",
set[1]);
Is($"<link rel='{Icon.RelApple}' type='{Mime.MimeTypes["png"]}' href='{path}'>",
set[2]);
Is(
$"<link rel='{Icon.RelShortcut}' type='{Mime.MimeTypes["png"]}' href='{path}'>",
set[3]);
}

[TestMethod]
public void WithoutDefaultFav()
{
var path = "/path/icon.png";

var set = Connect.Razor.Internals.HtmlPage.IconSet.GenerateIconSet(path, true);
Assert.AreEqual(4, set.Count, "expected 3 items in set");

Is($"<link rel='{Icon.RelIcon}' type='{Mime.MimeTypes["png"]}' href='{path}'>",
set[0]);
Is($"<link rel='{Icon.RelShortcut}' type='{Mime.MimeTypes["png"]}' href='{path}'>",
Expand All @@ -27,6 +46,7 @@ public void DefaultSet()
set[3]);
}


[TestMethod]
public void WithoutFav()
{
Expand Down
2 changes: 2 additions & 0 deletions Razor.Blade/Internals/HtmlPage/IconSet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ internal static List<Icon> GenerateIconSet(string path, object favicon = null, I
switch (favicon)
{
case null:
result.Add(new Icon(path, Icon.RelShortcut));
break;
case bool favBool when favBool:
result.Add(new Icon(Icon.RootFavicon, Icon.RelShortcut));
break;
Expand Down

0 comments on commit 583356d

Please sign in to comment.