Opened 5 weeks ago
Closed 4 weeks ago
#65193 closed enhancement (fixed)
Tests: Add unit tests for wp_page_reload_on_back_button_js()
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| Milestone: | 7.1 | Priority: | normal |
| Severity: | normal | Version: | |
| Component: | Administration | Keywords: | has-patch has-unit-tests |
| Focuses: | tests | Cc: |
Description
This ticket adds unit tests for the wp_page_reload_on_back_button_js() function in wp-admin/includes/misc.php. The tests will verify the correct HTML/JavaScript output.
Change History (4)
This ticket was mentioned in PR #11753 on WordPress/wordpress-develop by @pbearne.
5 weeks ago
#1
- Keywords has-patch has-unit-tests added
Note: See
TracTickets for help on using
tickets.
Description:
This PR adds unit tests for the
wp_page_reload_on_back_button_js()function inwp-admin/includes/misc.php. This function outputs a small JavaScript snippet designed to force a page reload if the user navigates to the page using the browser's back or forward buttons, ensuring that content (like post titles and editor state) is not stale.The tests cover:
<script>tag output.performance.navigation.type === 2check (which detects back/forward navigation).document.location.reload( true )call.Trac ticket: https://core.trac.wordpress.org/ticket/65193
AI Disclosure: