Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix PropertySkip value missing px wrap #26

Merged
merged 1 commit into from
Jul 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/Css/Functions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ internal static string FormatValue<T>(string key, T value)
float v => Wrap(key, v, v != 0),
double v => Wrap(key, v, v != 0),
Keyframe v => v.ToString(),
PropertySkip v => v.GetValue(key),
_ => value?.ToString()
};
}
Expand Down
7 changes: 7 additions & 0 deletions src/Css/IProperty.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,14 @@ public interface IProperty
public struct PropertySkip
{
public bool SkipCheck { get; set; }

public Property<string, double> Value { get; set; }

public string GetValue(string key)
{
return Value.GetValue(key);
}

public override string ToString()
{
return Value.ToString();
Expand Down
21 changes: 20 additions & 1 deletion test/CssInCSharp.Tests/CSSObjectTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -80,5 +80,24 @@ public void Animation()
});
messageMoveIn.ToString().ShouldBe("MessageMoveIn;@keyframes MessageMoveIn{0%{padding:0;transform:translateY(-100%);opacity:0;}100%{padding:100px;transform:translateY(0);opacity:1;}}");
}
}

[Fact]
public void Should_Property_Skip_Pxwrap()
{
new CSSObject()
{
[".test"] = new CSSObject()
{
Left = new PropertySkip()
{
SkipCheck = true,
Value = 12
}
}
}
.ToString()
.ShouldBe(".test{left:12px;}");
}

}
}
Loading