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
@@ -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"/);
|
||||
});
|
||||
|
||||
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', () => {
|
||||
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');
|
||||
|
||||
Reference in new issue
Block a user