Preserve saved API region item paths
This commit is contained in:
1 parent
1e8bcae72a
commit
1851187076
3 files changed
+30
-1
No files matched your search
@@ -7,6 +7,7 @@ All notable changes to this project will be documented in this file.
|
|||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
- Fixed playlist schedule summaries showing weekday text and omitting boundary times when dates are returned as `Date` objects.
|
- Fixed playlist schedule summaries showing weekday text and omitting boundary times when dates are returned as `Date` objects.
|
||||||
|
- Preserved saved API region items-path overrides when reopening the slide editor instead of replacing them with the source default.
|
||||||
|
|
||||||
## 2.20.4 - 2026-10-25
|
## 2.20.4 - 2026-10-25
|
||||||
|
|
||||||
|
|||||||
@@ -227,7 +227,9 @@
|
|||||||
var sourceOptions = String(context.sourceOptions || '');
|
var sourceOptions = String(context.sourceOptions || '');
|
||||||
var itemsPathValue = context.itemsPath !== undefined
|
var itemsPathValue = context.itemsPath !== undefined
|
||||||
? String(context.itemsPath === null ? '' : context.itemsPath)
|
? String(context.itemsPath === null ? '' : context.itemsPath)
|
||||||
: String(config.default_items_path || '');
|
: config.items_path !== undefined
|
||||||
|
? String(config.items_path === null ? '' : config.items_path)
|
||||||
|
: String(config.default_items_path || '');
|
||||||
var sampleDataPreview = String(context.sampleDataPreview || '');
|
var sampleDataPreview = String(context.sampleDataPreview || '');
|
||||||
return '' +
|
return '' +
|
||||||
'<div class="card card-outline card-secondary admin-form-card template-field-card mb-3" data-region-id="' + region.id + '" style="position:relative;overflow:visible !important;">' +
|
'<div class="card card-outline card-secondary admin-form-card template-field-card mb-3" data-region-id="' + region.id + '" style="position:relative;overflow:visible !important;">' +
|
||||||
|
|||||||
@@ -242,6 +242,32 @@ test('API region results panel exposes its open control without resize buttons',
|
|||||||
assert.match(expandedMarkup, /name="region_api_sort_by_24"[^>]*value="stats\.kills"/);
|
assert.match(expandedMarkup, /name="region_api_sort_by_24"[^>]*value="stats\.kills"/);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('API editor preserves saved item paths instead of replacing them with the source default', () => {
|
||||||
|
const editor = loadApiEditor();
|
||||||
|
const context = {
|
||||||
|
region: { id: 23 },
|
||||||
|
current: { value: '{{0.name}}' },
|
||||||
|
config: { source_id: 11, default_items_path: 'data' },
|
||||||
|
sourceOptions: '',
|
||||||
|
placeholderFields: [],
|
||||||
|
placeholderChips: '',
|
||||||
|
sampleDataPreview: '[]',
|
||||||
|
fontSize: 32
|
||||||
|
};
|
||||||
|
|
||||||
|
for (const [savedPath, expectedPath] of [['data.players', 'data.players'], ['', ''], [null, ''], [undefined, 'data']]) {
|
||||||
|
const markup = editor.renderEditorCard({ ...context, config: { ...context.config, items_path: savedPath } });
|
||||||
|
assert.match(markup, new RegExp('name="region_api_items_path_23"[^>]*value="' + expectedPath.replace('.', '\\.') + '"'));
|
||||||
|
}
|
||||||
|
|
||||||
|
const explicitContext = editor.renderEditorCard({
|
||||||
|
...context,
|
||||||
|
itemsPath: 'other.players',
|
||||||
|
config: { ...context.config, items_path: 'data.players' }
|
||||||
|
});
|
||||||
|
assert.match(explicitContext, /name="region_api_items_path_23"[^>]*value="other\.players"/);
|
||||||
|
});
|
||||||
|
|
||||||
test('API results preview always includes the first result completely', () => {
|
test('API results preview always includes the first result completely', () => {
|
||||||
let source = fs.readFileSync(path.join(__dirname, '../src/web/public/js/slides/slide-form-regions.js'), 'utf8');
|
let source = fs.readFileSync(path.join(__dirname, '../src/web/public/js/slides/slide-form-regions.js'), 'utf8');
|
||||||
source = source.replace("import { createSlideFormPreviewHelpers } from '/assets/js/slides/slide-form-preview.js';", '').replace('export function createSlideFormRegionHelpers', 'function createSlideFormRegionHelpers');
|
source = source.replace("import { createSlideFormPreviewHelpers } from '/assets/js/slides/slide-form-preview.js';", '').replace('export function createSlideFormRegionHelpers', 'function createSlideFormRegionHelpers');
|
||||||
|
|||||||
Reference in new issue
Block a user