Repository navigation
Add more tests and test updates - #93
Merged
Merged
Conversation
3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Run tests locally with:
docker compose up --build --abort-on-container-exit --exit-code-from testsNew changes:
Disabling concat should preserve order
If you enqueue a.css then b.css sheets, but disable concat for a.css, a.css should still come first. Instead, we're seeing a large bundle containing b.css, and then a.css separated but after, which is wrong.
There are two ways to disable - via option and via filter - both of them are falling to this bug.
test_exclusion_list_prevents_concatenation_of_handle()andtest_css_do_concat_filter_can_disable_concatenation()are updated to check the ordering. They are failing and are also marked with@group css-order-bug.Better filter cleanup in
test_css_do_concat_filter_can_disable_concatenationInstead of
remove_all_filters(), now we just remove the specific filter we added at the end of the test.Order test for external first
We currently have a test for a (local) -> b (external cdn) -> c (local), but also added one for a (external CDN) -> b (local) -> c (local). A has to be first.
Inline test now tests for the inline appearing in the right spot
Before, we were testing:
Now an additional criteria is the inline css has to be before B.
New tests to confirm that concatenation resumes after doing a break
For example, if a (local) -> ext (external) -> b (local) -> c (local), B and C should still be concatted.
Known failing order bug tests
These are the failing tests describing currently failing behavior:
❌ test_exclusion_list_prevents_concatenation_of_handle
Admins can configure specific handles to be excluded from concatenation via the
page_optimize-css-exclude option.
Enqueue order: a (excluded) -> b
Expected output order: [a], [b] (a first, in its own tag)
Bug: [b], [a] (excluded handle pushed to end)
❌ test_css_do_concat_filter_can_disable_concatenation
Developers can programmatically exclude handles using the css_do_concat filter hook.
Enqueue order: a (filtered to be excluded) -> b
Expected output order: [a], [b] (a first, in its own tag)
Bug: [b], [a] (excluded handle pushed to end)
❌ test_nonconcat_item_breaks_concat_run_and_preserves_order
When an external/CDN stylesheet appears between two local stylesheets, the concatenation must be split.
Enqueue order: a (local) -> b (external CDN) -> c (local)
Expected output: [a], [b], [c] (three separate tags)
❌ test_external_stylesheet_first_preserves_order
When an external/CDN stylesheet is enqueued first, it must remain first in the output.
Enqueue order: a (external CDN) -> b (local) -> c (local)
Expected output: [a], [b, c] or [a], [b], [c] (a must be first)
❌ test_media_interleaving_must_not_reorder_handles
When stylesheets have different media attributes, concatenation must respect the original order.
Enqueue order: a (media="all") -> b (media="screen") -> c (media="all")
Expected output order: a, b, c (not a+c combined, then b)
❌ test_inline_style_should_break_concat_boundary
When a stylesheet has inline CSS added via add_inline_style(), it can't be concatenated with subsequent stylesheets.
Enqueue: a (with inline style after it) -> b
Expected output: [a], [b] (two separate tags, not combined)
❌ test_concatenation_resumes_after_nonconcat_boundary
After a non-concatenatable item breaks a run, subsequent local stylesheets
should still be concatenated together.
This catches over-correction where fixing ordering bugs leads to giving up
on concatenation entirely after any boundary.
Enqueue order: a (local) -> ext (external) -> b (local) -> c (local)
Expected: [a], [ext], [b, c] (order preserved, b+c still concatenated)
❌ test_same_media_stylesheets_concatenate_within_run
Stylesheets with the same media attribute should still be concatenated
within their run, even when different media types cause boundaries.
This ensures the fix for media interleaving doesn't accidentally prevent
concatenation within same-media runs.
Enqueue order: a (all) -> b (screen) -> c (screen) -> d (all)
Expected: [a], [b, c], [d] (order preserved, b+c concatenated)
❌ test_rtl_stylesheet_breaks_concat_run_and_preserves_order
a -> b(rtl) -> c
❌ test_non_static_css_url_breaks_concat_run_and_preserves_order
a -> b(dynamic - style.php?theme=dark) -> c
They are tagged with
@group css-order-bugso we can still get the green check if everything else passes.I hope that we can fix these bugs and remove this division soon.