Skip to content

Add more tests and test updates - #93

Merged
mreishus merged 6 commits into
mainfrom
reish20260130/test-updates
Jan 30, 2026
Merged

mreishus merged 6 commits into
mainfrom
reish20260130/test-updates

Conversation

@mreishus

@mreishus mreishus commented Jan 30, 2026 •

Copy link
Copy Markdown
Contributor

Run tests locally with: docker compose up --build --abort-on-container-exit --exit-code-from tests

New 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() and test_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_concatenation

Instead 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:

Enqueue: a (with inline style after it) -> b
Expected output: [a], [b]  (two separate tags, not combined)

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-bug so we can still get the green check if everything else passes.

I hope that we can fix these bugs and remove this division soon.

@mreishus
mreishus merged commit 5b76335 into main Jan 30, 2026
3 checks passed
@mreishus
mreishus deleted the reish20260130/test-updates branch February 3, 2026 20:56
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.

1 participant