0
0
mirror of https://github.com/wagtail/wagtail.git synced 2024-11-25 05:02:57 +01:00

Revise the default SwapController target to the more common '#listing-results'

This commit is contained in:
LB Johnston 2023-07-06 22:04:14 +10:00 committed by LB (Ben Johnston)
parent 09aee38ca9
commit b0dc6c1ea5
2 changed files with 5 additions and 5 deletions

View File

@ -43,7 +43,7 @@ describe('SwapController', () => {
expect(handleError).not.toHaveBeenCalled(); expect(handleError).not.toHaveBeenCalled();
document.body.innerHTML = ` document.body.innerHTML = `
<div id="results"></div> <div id="listing-results"></div>
<input <input
id="search" id="search"
type="text" type="text"
@ -66,7 +66,7 @@ describe('SwapController', () => {
expect(handleError).not.toHaveBeenCalled(); expect(handleError).not.toHaveBeenCalled();
document.body.innerHTML = ` document.body.innerHTML = `
<div id="results"></div> <div id="listing-results"></div>
<input <input
id="search" id="search"
type="text" type="text"
@ -112,7 +112,7 @@ describe('SwapController', () => {
}); });
}); });
describe('fallback on window.headerSearch values if not in HTML', () => { describe('fallback on window.headerSearch values if not in HTML (RemovedInWagtail60)', () => {
it('should set the src & target value from the window.headerSearch if not present', async () => { it('should set the src & target value from the window.headerSearch if not present', async () => {
window.headerSearch = { window.headerSearch = {
termInput: '#search', termInput: '#search',

View File

@ -48,7 +48,7 @@ const getGlobalHeaderSearchOptions = (): {
* data-controller="w-swap" * data-controller="w-swap"
* data-action="input->w-swap#searchLazy" * data-action="input->w-swap#searchLazy"
* data-w-swap-src-value="path/to/search" * data-w-swap-src-value="path/to/search"
* data-w-swap-target-value="#results" * data-w-swap-target-value="#listing-results"
* /> * />
* *
*/ */
@ -63,7 +63,7 @@ export class SwapController extends Controller<
icon: { default: '', type: String }, icon: { default: '', type: String },
loading: { default: false, type: Boolean }, loading: { default: false, type: Boolean },
src: { default: '', type: String }, src: { default: '', type: String },
target: { default: '#results', type: String }, target: { default: '#listing-results', type: String },
wait: { default: 200, type: Number }, wait: { default: 200, type: Number },
}; };