test(actions): verify active workspace scoping for safe adapters
This commit is contained in:
@@ -15,6 +15,11 @@ includesAll(adapters, [
|
||||
'uxSafeActionAdaptersReady',
|
||||
'uxSafeActionAdaptersRegistered',
|
||||
'window.VendooActions',
|
||||
'window.VendooNavigation?.currentView',
|
||||
'workspaceVisible',
|
||||
"workspaceVisible('admin', 'admin-modules-panel')",
|
||||
"workspaceVisible('history')",
|
||||
"workspaceVisible('media-library')",
|
||||
'actions.registerMany',
|
||||
"surfaces: ['command-palette']",
|
||||
"danger: 'none'",
|
||||
@@ -110,8 +115,8 @@ function verifyRuntime() {
|
||||
querySelector: query => query === '.history-article-title' ? articleTitle : null,
|
||||
};
|
||||
const articleTarget = element({ parent: articleRow });
|
||||
|
||||
const mediaPreview = element({ selector: '[data-media-preview]' });
|
||||
|
||||
const selectorMap = new Map([
|
||||
['#module-manager-refresh', refreshButton],
|
||||
['[data-ux-module-group="modules"][data-ux-module-filter="all"]', moduleAll],
|
||||
@@ -134,6 +139,7 @@ function verifyRuntime() {
|
||||
querySelector(selector) { return selectorMap.get(selector) || null; },
|
||||
};
|
||||
const windowObject = {
|
||||
VendooNavigation: { currentView: 'admin' },
|
||||
VendooActions: {
|
||||
registerMany(actions) { registered.push(...actions); },
|
||||
refresh() {},
|
||||
@@ -157,16 +163,23 @@ function verifyRuntime() {
|
||||
expect(registered.every(action => action.surfaces?.includes('command-palette')), 'Runtime: Command-Palette-Surface fehlt');
|
||||
|
||||
const byId = id => registered.find(action => action.id === id);
|
||||
expect(byId('workspace:modules:refresh')?.visible() === true, 'Runtime: Modulaktion ist in Verwaltung nicht sichtbar');
|
||||
expect(byId('workspace:articles:view-list')?.visible() === false, 'Runtime: Artikelaktion ist außerhalb des Artikelbereichs sichtbar');
|
||||
expect(byId('workspace:modules:refresh')?.handler() === true && refreshButton.clicks === 1, 'Runtime: Modul-Refresh delegiert nicht an bestehenden Button');
|
||||
expect(byId('workspace:modules:filter-problems')?.handler() === true && moduleProblems.clicks === 1, 'Runtime: Problemfilter delegiert nicht an bestehenden Button');
|
||||
expect(byId('workspace:articles:view-list')?.handler() === true && listButton.clicks === 1, 'Runtime: Listenansicht delegiert nicht an bestehenden Button');
|
||||
expect(byId('workspace:media:density-comfortable')?.handler() === true && densityButton.clicks === 1, 'Runtime: Galeriedichte delegiert nicht an bestehenden Button');
|
||||
expect(byId('workspace:media:reset-filters')?.handler() === true && mediaReset.clicks === 1, 'Runtime: Medienfilter-Reset delegiert nicht an bestehenden Button');
|
||||
|
||||
windowObject.VendooNavigation.currentView = 'history';
|
||||
expect(byId('workspace:modules:refresh')?.visible() === false, 'Runtime: Modulaktion bleibt außerhalb der Verwaltung sichtbar');
|
||||
expect(byId('workspace:articles:view-list')?.visible() === true, 'Runtime: Artikelaktion ist im Artikelbereich nicht sichtbar');
|
||||
expect(byId('workspace:articles:view-list')?.handler() === true && listButton.clicks === 1, 'Runtime: Listenansicht delegiert nicht an bestehenden Button');
|
||||
documentListeners.get('focusin')?.({ target: articleTarget });
|
||||
expect(byId('workspace:articles:open-current')?.enabled() === true, 'Runtime: fokussierter Artikel wird nicht als ausführbar erkannt');
|
||||
expect(byId('workspace:articles:open-current')?.handler() === true && articleTitle.clicks === 1, 'Runtime: Artikel öffnen delegiert nicht an bestehenden Titel-Handler');
|
||||
|
||||
windowObject.VendooNavigation.currentView = 'media-library';
|
||||
expect(byId('workspace:media:density-comfortable')?.visible() === true, 'Runtime: Medienaktion ist im Medienbereich nicht sichtbar');
|
||||
expect(byId('workspace:media:density-comfortable')?.handler() === true && densityButton.clicks === 1, 'Runtime: Galeriedichte delegiert nicht an bestehenden Button');
|
||||
expect(byId('workspace:media:reset-filters')?.handler() === true && mediaReset.clicks === 1, 'Runtime: Medienfilter-Reset delegiert nicht an bestehenden Button');
|
||||
documentListeners.get('pointerdown')?.({ target: mediaPreview });
|
||||
expect(byId('workspace:media:open-current-preview')?.enabled() === true, 'Runtime: fokussierte Medienvorschau wird nicht als ausführbar erkannt');
|
||||
expect(byId('workspace:media:open-current-preview')?.handler() === true && mediaPreview.clicks === 1, 'Runtime: Medienvorschau delegiert nicht an bestehenden Preview-Handler');
|
||||
|
||||
Reference in New Issue
Block a user