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

improve css tests #458

Closed
wants to merge 13 commits into from
Closed

Conversation

lubegasimon
Copy link
Contributor

@lubegasimon lubegasimon commented Mar 26, 2024

Addresses #425

Copy link

vercel bot commented Mar 26, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Ignored Deployment
Name Status Preview Comments Updated (UTC)
styled-ppx ⬜️ Ignored (Inspect) Visit Preview Mar 29, 2024 7:09am

@lubegasimon lubegasimon marked this pull request as ready for review March 28, 2024 13:27
Comment on lines 444 to 479
/* expect([%css("background-image: linear-gradient(5deg, #FF0000 10%)")])->toBe({
"backgroundImage": "linear-gradient(5deg, #FF0000 10%)",
})
expect([%css("background-image: repeating-linear-gradient(6rad, #000000 20%)")])->toBe({
"backgroundImage": "repeating-linear-gradient(6rad, #000000 20%)",
})
expect([%css("background-image: radial-gradient(#FFFF00 30%)")])->toBe({
"backgroundImage": "radial-gradient(#FFFF00 30%)",
})
expect([%css("background-image: repeating-radial-gradient(#FFFF00 30%)")])->toBe({
"backgroundImage": "repeating-radial-gradient(#FFFF00 30%)",
}) */
})
)

/* describe("Gradient background", () =>
test("test values", _ => {
expect([%css("background: linear-gradient(45deg, #FF0000 0, #0000FF 100%)")])->toBe({
"background": "linear-gradient(45deg, #FF0000 0, #0000FF 100%)",
})
expect([%css("background: repeating-linear-gradient(45deg, #FF0000 0, #0000FF 10px)")])->toBe({
"background": "repeating-linear-gradient(45deg, #FF0000 0, #0000FF 10px)",
})
expect([%css("background: radial-gradient(#FF0000 0, #0000FF 100%) ")])->toBe({
"background": "radial-gradient(#FF0000 0, #0000FF 100%)",
})
expect([
%css("background: repeating-radial-gradient(#FF0000 0, #0000FF calc(20% + 5px))"),
])->toBe({
"background": "repeating-radial-gradient(#FF0000 0, #0000FF calc(20% + 5px))",
})
expect([%css("background: conic-gradient(from 45deg, #FF0000 0, #0000FF 100%)")])->toBe({
"background": "conic-gradient(from 45deg, #FF0000 0, #0000FF 100%)",
})
})
) */
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like there are some inconsistencies in the Gradient types

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add this comment on the source?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I can!

@@ -1756,8 +1755,8 @@ let string_of_amount x =
let string_of_filter x =
match x with
| `blur v -> {js|blur(|js} ^ Length.toString v ^ {js|)|js}
| `brightness v -> {js|brightness(|js} ^ string_of_amount v ^ {js|%)|js}
| `contrast v -> {js|contrast(|js} ^ string_of_amount v ^ {js|%)|js}
| `brightness v -> {js|brightness(|js} ^ string_of_amount v ^ {js|)|js}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch

@@ -226,7 +226,7 @@ let backfaceVisibility x =
let backdropFilter x =
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you fix string_of_filter in Css_Legacy_Core as well?

@@ -2038,8 +2038,8 @@ module Filter = struct
let toString x =
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, we have Filter.toString in AtomicTypes. Can you use Filter.toString in Css_Js_Core, Css_Legacy_Core instead of the same implementation of the functions?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, good spot!

@@ -1231,19 +1231,19 @@ and property_margin_block = [%value.rec "[ <'margin-left'> ]{1,2}"]
and property_margin_block_end = [%value.rec "<'margin-left'>"]
and property_margin_block_start = [%value.rec "<'margin-left'>"]
and property_margin_bottom = [%value.rec
"<extended-length> | <extended-percentage> | 'auto'"
"<extended-length> | <extended-percentage> | 'auto' | <var()>"
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of adding var into margin-bottom, can you add it into extended-length/extended-percentage?

]
and property_margin_inline = [%value.rec "[ <'margin-left'> ]{1,2}"]
and property_margin_inline_end = [%value.rec "<'margin-left'>"]
and property_margin_inline_start = [%value.rec "<'margin-left'>"]
and property_margin_left = [%value.rec
"<extended-length> | <extended-percentage> | 'auto'"
"<extended-length> | <extended-percentage> | 'auto' | <var()>"
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same, let's keep var in the "extended-*" values

@lubegasimon lubegasimon changed the title w.i.p: improve css tests improve css tests Mar 28, 2024
@davesnx davesnx closed this May 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants