Preserve API item paths while building editor context
Publish Docker Image / build-and-push-existing-registry (./build/Dockerfile, web, pulse-signage-web) (push) Successful in 1m19s
Publish Docker Image / build-and-push-existing-registry (./build/Dockerfile.player, player, pulse-signage-player) (push) Successful in 34s

This commit is contained in:
lzstealth committed 2026-10-26 01:38:09 +00:00
1 parent 1851187076
commit 5b5af1a7b9
2 files changed
+10 -3

No files matched your search

+2
View File
@@ -306,6 +306,8 @@
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)
: config.items_path !== undefined
? String(config.items_path === null ? '' : config.items_path)
: String(config.default_items_path || ''); : String(config.default_items_path || '');
var sampleDataPreview = String(context.sampleDataPreview || ''); var sampleDataPreview = String(context.sampleDataPreview || '');
+8 -3
View File
@@ -256,15 +256,20 @@ test('API editor preserves saved item paths instead of replacing them with the s
}; };
for (const [savedPath, expectedPath] of [['data.players', 'data.players'], ['', ''], [null, ''], [undefined, 'data']]) { for (const [savedPath, expectedPath] of [['data.players', 'data.players'], ['', ''], [null, ''], [undefined, 'data']]) {
const markup = editor.renderEditorCard({ ...context, config: { ...context.config, items_path: savedPath } }); const savedContext = { ...context, config: { ...context.config, items_path: savedPath } };
const builtContext = editor.buildEditorCardContext(savedContext, {}, []);
assert.equal(builtContext.itemsPath, expectedPath);
for (const cardContext of [savedContext, builtContext]) {
const markup = editor.renderEditorCard(cardContext);
assert.match(markup, new RegExp('name="region_api_items_path_23"[^>]*value="' + expectedPath.replace('.', '\\.') + '"')); assert.match(markup, new RegExp('name="region_api_items_path_23"[^>]*value="' + expectedPath.replace('.', '\\.') + '"'));
} }
}
const explicitContext = editor.renderEditorCard({ const explicitContext = editor.renderEditorCard(editor.buildEditorCardContext({
...context, ...context,
itemsPath: 'other.players', itemsPath: 'other.players',
config: { ...context.config, items_path: 'data.players' } config: { ...context.config, items_path: 'data.players' }
}); }, {}, []));
assert.match(explicitContext, /name="region_api_items_path_23"[^>]*value="other\.players"/); assert.match(explicitContext, /name="region_api_items_path_23"[^>]*value="other\.players"/);
}); });