Skip to content

Commit 583356d

Browse files
committed
changed default favicon behaviour to be png
1 parent a38cfed commit 583356d

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

Razor Blades Tests/HtmlTagsTests/IconTests/IconSets.cs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,25 @@ public void DefaultSet()
1616
var path = "/path/icon.png";
1717
var set = Connect.Razor.Internals.HtmlPage.IconSet.GenerateIconSet(path);
1818
Assert.AreEqual(4, set.Count, "expected 3 items in set");
19+
Is($"<link rel='{Icon.RelIcon}' type='{Mime.MimeTypes["png"]}' href='{path}'>",
20+
set[0]);
21+
Is($"<link rel='{Icon.RelShortcut}' type='{Mime.MimeTypes["png"]}' href='{path}'>",
22+
set[1]);
23+
Is($"<link rel='{Icon.RelApple}' type='{Mime.MimeTypes["png"]}' href='{path}'>",
24+
set[2]);
25+
Is(
26+
$"<link rel='{Icon.RelShortcut}' type='{Mime.MimeTypes["png"]}' href='{path}'>",
27+
set[3]);
28+
}
29+
30+
[TestMethod]
31+
public void WithoutDefaultFav()
32+
{
33+
var path = "/path/icon.png";
34+
35+
var set = Connect.Razor.Internals.HtmlPage.IconSet.GenerateIconSet(path, true);
36+
Assert.AreEqual(4, set.Count, "expected 3 items in set");
37+
1938
Is($"<link rel='{Icon.RelIcon}' type='{Mime.MimeTypes["png"]}' href='{path}'>",
2039
set[0]);
2140
Is($"<link rel='{Icon.RelShortcut}' type='{Mime.MimeTypes["png"]}' href='{path}'>",
@@ -27,6 +46,7 @@ public void DefaultSet()
2746
set[3]);
2847
}
2948

49+
3050
[TestMethod]
3151
public void WithoutFav()
3252
{

Razor.Blade/Internals/HtmlPage/IconSet.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ internal static List<Icon> GenerateIconSet(string path, object favicon = null, I
2929
switch (favicon)
3030
{
3131
case null:
32+
result.Add(new Icon(path, Icon.RelShortcut));
33+
break;
3234
case bool favBool when favBool:
3335
result.Add(new Icon(Icon.RootFavicon, Icon.RelShortcut));
3436
break;

0 commit comments

Comments
 (0)