dbxapp 4.1.3
CMS, Shop, Workflows und modulare Geschäftsanwendungen
Loading...
Searching...
No Matches
dbxCmsEditorPerformance_contract_test.php
Go to the documentation of this file.
1<?php
2
3$base = dirname(__DIR__, 2);
4$source = (string)file_get_contents($base . '/js/lib/cms.js');
5$template = (string)file_get_contents($base . '/modules/dbxContent_admin/tpl/htm/cms-admin.htm');
6$failures = array();
7
8$assert = static function(bool $condition, string $message) use (&$failures): void {
9 if (!$condition) $failures[] = $message;
10};
11
13 str_contains($source, '__dbxCmsEditorHeightTimers')
14 && str_contains($source, 'root.__dbxCmsEditorHeightTimers.forEach(timer => window.clearTimeout(timer))'),
15 'Editor height reflow timers are not deduplicated.'
16);
18 !str_contains($source, '[80, 250, 800].forEach(delay => window.setTimeout(() => syncEditorHeight(root), delay))'),
19 'Every editor input still creates three uncancelled layout timers.'
20);
22 str_contains($source, 'function editorInlineMediaSignature(root, html)')
23 && str_contains($source, 'if (signature === root.__dbxCmsMediaRenderSignature) return;'),
24 'The media sidebar is still rebuilt without checking whether media changed.'
25);
27 str_contains($source, '__dbxCmsBootstrapNormalizeTimer')
28 && str_contains($source, 'window.clearTimeout(surface.__dbxCmsBootstrapNormalizeTimer)'),
29 'Bootstrap component normalization is not debounced.'
30);
32 !str_contains($source, 'jodit.e.fire("togglePopup", "dbxMarkerMenu")')
33 && !str_contains($source, 'jodit.e.fire("togglePopup", "dbxBootstrapComponents")')
34 && !str_contains($source, 'jodit.e.fire("togglePopup", "dbxTextStyle")'),
35 'Custom Jodit popup controls still override Jodit popup handling with a competing exec callback.'
36);
38 substr_count($source, 'popup: function (jodit, current, close)') >= 3
39 && !str_contains($source, 'popup: function (jodit, current, control, close)'),
40 'Custom Jodit popup callbacks do not use the installed Jodit close-callback argument order.'
41);
43 str_contains($source, 'if (!node.parentNode || !surface.contains(node))')
44 && str_contains($source, 'nodes.slice().reverse().find(node => node.parentNode && surface.contains(node))'),
45 'The editor caret can still be positioned after a component node removed during normalization.'
46);
48 str_contains($source, 'const inlineMedia = closestElement(target, ".dbx-cms-inline-media")')
49 && str_contains($source, 'if (inlineMedia && surface.contains(inlineMedia)) return inlineMedia;'),
50 'Move actions still target the image element instead of its inline-media block.'
51);
53 str_contains($source, 'bootstrapRowColumns(row).length || qs(row, ".card")')
54 && str_contains($source, 'tabsChildren.some(child => child.classList?.contains("nav-tabs"))')
55 && str_contains($source, 'tabsChildren.some(child => child.classList?.contains("tab-content"))'),
56 'Multi-column, card-row, or tab components are not selected as one movable component.'
57);
59 str_contains($source, 'const el = editorContextBlock(root, target);'),
60 'Ordinary component blocks such as CTA and openWin paragraphs are not movable or removable.'
61);
63 str_contains($template, 'rel="preload" href="dbx/js/lib/cms.js?v=90" as="script" fetchpriority="low"')
64 && str_contains($template, 'rel="preload" href="dbx/vendor/jodit/jodit.fat.min.js?v=90" as="script" fetchpriority="low"')
65 && str_contains($template, 'rel="preload" href="dbx/vendor/jodit/jodit.fat.min.css?v=90" as="style" fetchpriority="low"')
66 && str_contains($template, 'rel="preload" href="dbx/design/{dbx:design}/css/c-cms.css?v=90" as="style" fetchpriority="low"'),
67 'Large CMS/editor assets are not requested early on the CMS page.'
68);
69
70if ($failures !== array()) {
71 fwrite(STDERR, "FAIL\n- " . implode("\n- ", $failures) . "\n");
72 exit(1);
73}
74
75echo 'OK CMS editor layout and media refresh work is deduplicated.' . PHP_EOL;
exit
Definition index.php:146