Repository navigation
wp-env: Enable pretty permalinks by default in Docker runtime #75688
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
Changes from 4 commits
6347d02
d51c4c2
744edf4
78ca02a
1c82d20
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -598,6 +598,7 @@ class LinkControl { | |
|
|
||
| return result | ||
| .locator( '.components-menu-item__item' ) // this is the only way to get the label text without the URL. | ||
| .last() | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How is this change related?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same as above, the LinkControl component shows both the slug and the name of the page when pretty permalinks are enabled, this means that there are two "components-menuitem__item" per element. |
||
| .innerText(); | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -35,7 +35,20 @@ test.describe( 'Preload', () => { | |
| urlObject.searchParams.delete( '_locale' ); | ||
| requests.push( restRoute + urlObject.search ); | ||
| } else { | ||
| requests.push( url ); | ||
| // With pretty permalinks, REST API calls use | ||
| // the /wp-json/ prefix instead of ?rest_route=. | ||
| const wpJsonPrefix = '/wp-json'; | ||
| const wpJsonIndex = | ||
| urlObject.pathname.indexOf( wpJsonPrefix ); | ||
| if ( wpJsonIndex !== -1 ) { | ||
| const route = urlObject.pathname.substring( | ||
| wpJsonIndex + wpJsonPrefix.length | ||
| ); | ||
| urlObject.searchParams.delete( '_locale' ); | ||
| requests.push( route + urlObject.search ); | ||
| } else { | ||
| requests.push( url ); | ||
| } | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For simplicity, we could extract and match just the path, like 20 lines of code that processes the request URL are not justified here, let's cut them to something like 2 lines. The evolution of this test is generally unfortunate. The description says "should make no requests" but as the preload requests have been creeping in, here we are checking that there are in fact four request 🙁 |
||
| } | ||
| } | ||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How is this related? There doesn't seem to be any URL in the text we're matching.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The "LinkControl" component shows both the slug and the title within each suggestion when pretty permalinks are enabled. This means that the "name" of the DOM element changes a bit.