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
+12 -5

No files matched your search

+3 -1
View File
@@ -306,7 +306,9 @@
var sourceOptions = String(context.sourceOptions || '');
var itemsPathValue = context.itemsPath !== undefined
? 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 || '');
return {
+9 -4
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']]) {
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 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('.', '\\.') + '"'));
}
}
const explicitContext = editor.renderEditorCard({
const explicitContext = editor.renderEditorCard(editor.buildEditorCardContext({
...context,
itemsPath: 'other.players',
config: { ...context.config, items_path: 'data.players' }
});
}, {}, []));
assert.match(explicitContext, /name="region_api_items_path_23"[^>]*value="other\.players"/);
});