2sic RazorBlade
2sic RazorBlade
icon.png
diff --git a/ToSic.RazorBladeTests/Blade/HtmlTagService/HtmlTagServiceImplementationTests.cs b/ToSic.RazorBladeTests/Blade/HtmlTagService/HtmlTagServiceImplementationTests.cs
index 962476db..b32e4e98 100644
--- a/ToSic.RazorBladeTests/Blade/HtmlTagService/HtmlTagServiceImplementationTests.cs
+++ b/ToSic.RazorBladeTests/Blade/HtmlTagService/HtmlTagServiceImplementationTests.cs
@@ -14,5 +14,11 @@ public void H1Test()
Is("", HtmlTagsService.H1());
Is("content
", HtmlTagsService.H1("content"));
}
+
+ [TestMethod()]
+ public void AttributesHaveSpaces()
+ {
+ Is(" name='value' ", HtmlTagsService.Attr("name", "value"));
+ }
}
}
\ No newline at end of file
diff --git a/ToSic.RazorBladeTests/TagBuilderTests/AttributeBuilderTests.cs b/ToSic.RazorBladeTests/TagBuilderTests/AttributeBuilderTests.cs
index 87b1c1ab..a3b1c74c 100644
--- a/ToSic.RazorBladeTests/TagBuilderTests/AttributeBuilderTests.cs
+++ b/ToSic.RazorBladeTests/TagBuilderTests/AttributeBuilderTests.cs
@@ -6,11 +6,25 @@ namespace ToSic.RazorBladeTests.TagBuilderTests
[TestClass]
public class AttributeBuilderTests
{
+ ///
+ /// Test accessor to reduce use-count
+ ///
+ public Attribute NewAttribute(string name, object? value = default, AttributeOptions? options = default)
+ => new Attribute(name, value, options);
+
[TestMethod]
public void BasicAttributes()
{
- Assert.AreEqual("name='value'", new Attribute("name", "value").ToString());
- Assert.AreEqual("something='other'", new Attribute("something", "other").ToString());
+ Assert.AreEqual("name='value'", NewAttribute("name", "value").ToString());
+ Assert.AreEqual("something='other'", NewAttribute("something", "other").ToString());
+ }
+
+ [TestMethod] public void BasicAttributesStandalone()
+ {
+ var o = AttributeOptions.StandaloneOptions;
+ Assert.AreEqual(" name='value' ", NewAttribute("name", "value", o).ToString());
+ Assert.AreEqual(" something='other' ", NewAttribute("something", "other", o).ToString());
+
}
[TestMethod]
@@ -18,9 +32,9 @@ public void BasicAttributesQuote()
{
var options = new AttributeOptions(quote: "\"");
Assert.AreEqual("name=\"value\"",
- new Attribute("name", "value", options).ToString());
+ NewAttribute("name", "value", options).ToString());
Assert.AreEqual("something=\"other\"",
- new Attribute("something", "other", options).ToString());
+ NewAttribute("something", "other", options).ToString());
}
[TestMethod]
@@ -28,18 +42,18 @@ public void UnEncodeQuote()
{
var options = new AttributeOptions(encodeQuotes: true);
Assert.AreEqual("name='{\"name\":\"daniel\"}'",
- new Attribute("name", "{\"name\":\"daniel\"}").ToString());
+ NewAttribute("name", "{\"name\":\"daniel\"}").ToString());
Assert.AreEqual("name='{"name":"daniel"}'",
- new Attribute("name", "{\"name\":\"daniel\"}", options).ToString());
+ NewAttribute("name", "{\"name\":\"daniel\"}", options).ToString());
options = new AttributeOptions(quote: "\"");
Assert.AreEqual("name=\"{"name":"daniel"}\"",
- new Attribute("name", "{\"name\":\"daniel\"}", options).ToString(),
+ NewAttribute("name", "{\"name\":\"daniel\"}", options).ToString(),
"with a different quote and encodeQuotes false");
options = new AttributeOptions(encodeQuotes: true, quote: "\"");
Assert.AreEqual("name=\"{"name":"daniel"}\"",
- new Attribute("name", "{\"name\":\"daniel\"}", options).ToString(),
+ NewAttribute("name", "{\"name\":\"daniel\"}", options).ToString(),
"with a different quote and encodeQuotes = true");
}
@@ -49,17 +63,17 @@ public void UnEncodeApostropheInValue()
{
var options = new AttributeOptions(quote: "\"");
Assert.AreEqual("name=\"isn't it ironic\"",
- new Attribute("name", "isn't it ironic", options).ToString(),
+ NewAttribute("name", "isn't it ironic", options).ToString(),
"apostrophe with a different quote and encodeQuotes = false");
options = new AttributeOptions(encodeQuotes: true);
Assert.AreEqual("name='isn't it ironic'",
- new Attribute("name", "isn't it ironic", options).ToString(),
+ NewAttribute("name", "isn't it ironic", options).ToString(),
"apostrophe with a different quote and encodeQuotes = true");
options = new AttributeOptions(encodeQuotes: true, quote: "\"");
Assert.AreEqual("name=\"isn't it ironic\"",
- new Attribute("name", "isn't it ironic", options).ToString(),
+ NewAttribute("name", "isn't it ironic", options).ToString(),
"apostrophe with a different quote and encodeQuotes = true");
}
@@ -68,16 +82,16 @@ public void UnEncodeApostropheInValue()
public void BasicAttributesEmpty()
{
Assert.AreEqual("name=''",
- new Attribute("name", "").ToString());
+ NewAttribute("name", "").ToString());
Assert.AreEqual("name",
- new Attribute("name", null).ToString());
+ NewAttribute("name", null).ToString());
Assert.AreEqual("name=''",
- new Attribute("name", null,
+ NewAttribute("name", null,
new AttributeOptions(dropValueIfNull: false)).ToString());
var options = new AttributeOptions(keepEmpty: false);
Assert.AreEqual("",
- new Attribute("name", "", options).ToString());
+ NewAttribute("name", "", options).ToString());
}
[TestMethod]
@@ -85,11 +99,11 @@ public void ObjectValues()
{
//var options = new AttributeOptions { KeepEmpty = false };
Assert.AreEqual("name='54'",
- new Attribute("name", 54).ToString());
+ NewAttribute("name", 54).ToString());
Assert.AreEqual("name='{\"Name\":\"Daniel\"}'",
- new Attribute("name", new { Name = "Daniel" }).ToString());
+ NewAttribute("name", new { Name = "Daniel" }).ToString());
Assert.AreEqual("name='Daniel'",
- new Attribute("name", "Daniel" as object).ToString());
+ NewAttribute("name", "Daniel" as object).ToString());
}
}
diff --git a/ToSic.RazorBladeTests/TagTests/TagAttributeTests.cs b/ToSic.RazorBladeTests/TagTests/TagAttributeTests.cs
index c3f71262..6cb73f75 100644
--- a/ToSic.RazorBladeTests/TagTests/TagAttributeTests.cs
+++ b/ToSic.RazorBladeTests/TagTests/TagAttributeTests.cs
@@ -28,11 +28,18 @@ public void TagAttributeContainingPTag()
}
[TestMethod]
- public void TagAttributeStandalone()
+ public void TagAttributeWithoutValue()
{
Is("", TestDiv().Attr("data-fancybox").TagStart);
}
+ [TestMethod]
+ public void TagAttributeOnly()
+ {
+ Is(" name='value' ", Tag.Attr("name", "value"));
+ }
+
+
[TestMethod]
public void TagAttributeMultiple()
{
diff --git a/docs/manifest.json b/docs/manifest.json
index 891f67f3..fff58d9b 100644
--- a/docs/manifest.json
+++ b/docs/manifest.json
@@ -1,6 +1,6 @@
{
"homepages": [],
- "source_base_path": "A:/razor-blade/DocFx Generator",
+ "source_base_path": "C:/Projects/razor-blades/DocFx Generator",
"xrefmap": "xrefmap.yml",
"files": [
{
@@ -141,6 +141,9 @@
"version": ""
},
{
+ "log_codes": [
+ "UidNotFound"
+ ],
"type": "Conceptual",
"source_relative_path": "index.md",
"output": {
@@ -1777,11 +1780,11 @@
{
"status": {
"can_incremental": false,
- "details": "Disable incremental build by force rebuild option.",
+ "details": "Cannot build incrementally because last build info is missing.",
"incrementalPhase": "build",
"total_file_count": 0,
"skipped_file_count": 0,
- "full_build_reason_code": "ForceRebuild"
+ "full_build_reason_code": "NoAvailableBuildCache"
},
"processors": {
"ConceptualDocumentProcessor": {