Skip to content

Commit 0521541

Browse files
committed
Add missing options & add a test to compare options from docs with the ones in the bundle
1 parent b3d2759 commit 0521541

File tree

3 files changed

+132
-70
lines changed

3 files changed

+132
-70
lines changed

composer.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@
3535
"phpstan/phpstan": "^1.6.8",
3636
"phpstan/phpstan-deprecation-rules": "^1.0.0",
3737
"phpunit/phpunit": "^9.5.10",
38+
"symfony/css-selector": "^5.4 || ^6.0",
39+
"symfony/dom-crawler": "^5.4 || ^6.0",
3840
"symfony/yaml": "^5.4 || ^6.0"
3941
},
4042
"scripts": {

src/Utility/UConfiguration.php

Lines changed: 98 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -11,25 +11,30 @@ final class UConfiguration
1111
public const OPTIONS_BOOLEAN = [
1212
'attribution' => null,
1313
'autofocus' => null,
14+
'autoStart' => null,
1415
'charCounterCount' => null,
1516
'codeBeautifier' => null,
1617
'codeMirror' => null,
18+
'colorsHEXInput' => null,
1719
'disableRightClick' => null,
1820
'documentReady' => null,
21+
'dragInline' => null,
1922
'editInPopup' => null,
2023
'editorClass' => null,
2124
'emoticonsUseImage' => null,
2225
'fileUpload' => null,
2326
'fileUseSelectedText' => null,
2427
'fontFamilySelection' => null,
2528
'fontSizeSelection' => null,
29+
'formMultipleStyles' => null,
2630
'fullPage' => null,
2731
'htmlAllowComments' => null,
2832
'htmlExecuteScripts' => null,
2933
'htmlSimpleAmpersand' => null,
3034
'htmlUntouched' => null,
3135
'iframe' => null,
3236
'imageAddNewLine' => null,
37+
'imageManagerToggleTags' => null,
3338
'imageMove' => null,
3439
'imageMultipleStyles' => null,
3540
'imagePaste' => null,
@@ -58,11 +63,13 @@ final class UConfiguration
5863
'paragraphMultipleStyles' => null,
5964
'pasteAllowLocalImages' => null,
6065
'pastePlain' => null,
66+
'quickInsertEnabled' => null,
6167
'requestWithCredentials' => null,
6268
'requestWithCORS' => null,
6369
'shortcutsHint' => null,
6470
'spellcheck' => null,
6571
'tableCellMultipleStyles' => null,
72+
'tableInsertHelper' => null,
6673
'tableMultipleStyles' => null,
6774
'tableResizer' => null,
6875
'toolbarBottom' => null,
@@ -78,7 +85,7 @@ final class UConfiguration
7885
'videoSplitHTML' => null,
7986
'videoTextNear' => null,
8087
'videoUpload' => null,
81-
'wordPasteKeepFormatting ' => null,
88+
'wordPasteKeepFormatting' => null,
8289
'wordPasteModal' => null,
8390
];
8491

@@ -90,78 +97,88 @@ final class UConfiguration
9097
];
9198

9299
public const OPTIONS_INTEGER = [
93-
'charCounterMax' => null,
94-
'colorsStep' => null,
95-
'emoticonsStep' => null,
96-
'fileMaxSize' => null,
97-
'filesManagerMaxSize' => null,
98-
'height' => null,
99-
'heightMax' => null,
100-
'heightMin' => null,
101-
'imageDefaultWidth' => null,
102-
'imageManagerPageSize' => null,
103-
'imageManagerScrollOffset' => null,
104-
'imageMaxSize' => null,
105-
'imageMinWidth' => null,
106-
'indentMargin' => null,
107-
'lineBreakerOffset' => null,
108-
'saveInterval' => null,
109-
'tabIndex' => null,
110-
'tabSpaces' => null,
111-
'tableColorsStep' => null,
112-
'tableInsertMaxSize' => null,
113-
'tableResizerOffset' => null,
114-
'tableResizingLimit' => null,
115-
'toolbarStickyOffset' => null,
116-
'typingTimer' => null,
117-
'videoDefaultWidth' => null,
118-
'videoMaxSize' => null,
119-
'zIndex' => null,
100+
'charCounterMax' => null,
101+
'colorsStep' => null,
102+
'emoticonsStep' => null,
103+
'fileMaxSize' => null,
104+
'filesManagerMaxSize' => null,
105+
'height' => null,
106+
'heightMax' => null,
107+
'heightMin' => null,
108+
'imageDefaultMargin' => null,
109+
'imageDefaultWidth' => null,
110+
'imageManagerPageSize' => null,
111+
'imageManagerScrollOffset' => null,
112+
'imageMaxSize' => null,
113+
'imageMinWidth' => null,
114+
'indentMargin' => null,
115+
'lineBreakerHorizontalOffset' => null,
116+
'lineBreakerOffset' => null,
117+
'saveInterval' => null,
118+
'tabIndex' => null,
119+
'tabSpaces' => null,
120+
'tableColorsStep' => null,
121+
'tableInsertHelperOffset' => null,
122+
'tableInsertMaxSize' => null,
123+
'tableResizerOffset' => null,
124+
'tableResizingLimit' => null,
125+
'toolbarStickyOffset' => null,
126+
'typingTimer' => null,
127+
'videoDefaultWidth' => null,
128+
'videoMaxSize' => null,
129+
'zIndex' => null,
120130
];
121131

122132
public const OPTIONS_STRING = [
123-
'aviaryKey' => null,
124-
'colorsDefaultTab' => null,
125-
'direction' => null,
126-
'embedlyScriptPath' => null,
127-
'enter' => null,
128-
'entities' => null,
129-
'fileUploadMethod' => null,
130-
'fileUploadParam' => null,
131-
'fileUploadURL' => 'leapt_froala_editor_upload_file',
132-
'filesManagerUploadURL' => null,
133-
'fontAwesomeTemplate' => null,
134-
'fontSizeUnit' => null,
135-
'iconsTemplate' => null,
136-
'iframeDefaultStyle' => null,
137-
'iframeStyle' => null,
138-
'imageCORSProxy' => null,
139-
'imageDefaultAlign' => null,
140-
'imageDefaultDisplay' => null,
141-
'imageManagerDeleteMethod' => null,
142-
'imageManagerDeleteURL' => 'leapt_froala_editor_delete_image',
143-
'imageManagerLoadMethod' => null,
144-
'imageManagerLoadURL' => 'leapt_froala_editor_load_images',
145-
'imageManagerPreloader' => null,
146-
'imageUploadMethod' => null,
147-
'imageUploadParam' => null,
148-
'imageUploadURL' => 'leapt_froala_editor_upload_image',
149-
'language' => null,
150-
'linkAutoPrefix' => null,
151-
'placeholderText' => null,
152-
'saveMethod' => null,
153-
'saveParam' => null,
154-
'saveURL' => null,
155-
'scaytCustomerId' => null,
156-
'scrollableContainer' => null,
157-
'tableDefaultWidth' => null,
158-
'theme' => null,
159-
'videoDefaultAlign' => null,
160-
'videoDefaultDisplay' => null,
161-
'videoUploadMethod' => null,
162-
'videoUploadParam' => null,
163-
'videoUploadURL' => 'leapt_froala_editor_upload_video',
164-
'width' => null,
133+
'apiKey' => null,
134+
'app' => null,
135+
'aviaryKey' => null,
136+
'colorsDefaultTab' => null,
137+
'direction' => null,
138+
'docId' => null,
139+
'embedlyKey' => null,
140+
'embedlyScriptPath' => null,
141+
'enter' => null,
142+
'entities' => null,
143+
'fileUploadMethod' => null,
144+
'fileUploadParam' => null,
145+
'fileUploadURL' => 'leapt_froala_editor_upload_file',
146+
'filesManagerUploadURL' => null,
147+
'fontAwesomeTemplate' => null,
148+
'fontFamilyDefaultSelection' => null,
149+
'fontSizeDefaultSelection' => null,
150+
'fontSizeUnit' => null,
151+
'iconsTemplate' => null,
152+
'iframeDefaultStyle' => null,
153+
'iframeStyle' => null,
154+
'imageCORSProxy' => null,
155+
'imageDefaultAlign' => null,
156+
'imageDefaultDisplay' => null,
157+
'imageManagerDeleteMethod' => null,
158+
'imageManagerDeleteURL' => 'leapt_froala_editor_delete_image',
159+
'imageManagerLoadMethod' => null,
160+
'imageManagerLoadURL' => 'leapt_froala_editor_load_images',
161+
'imageManagerPreloader' => null,
162+
'imageUploadMethod' => null,
163+
'imageUploadParam' => null,
164+
'imageUploadURL' => 'leapt_froala_editor_upload_image',
165+
'language' => null,
166+
'linkAutoPrefix' => null,
167+
'placeholderText' => null,
168+
'saveMethod' => null,
169+
'saveParam' => null,
170+
'saveURL' => null,
171+
'scaytCustomerId' => null,
172+
'scrollableContainer' => null,
173+
'tableDefaultWidth' => null,
174+
'theme' => null,
175+
'username' => null,
176+
'videoDefaultAlign' => null,
177+
'videoDefaultDisplay' => null,
178+
'videoUploadMethod' => null,
179+
'videoUploadParam' => null,
180+
'videoUploadURL' => 'leapt_froala_editor_upload_video',
181+
'width' => null,
165182
];
166183

167184
public const OPTIONS_STRING_CUSTOM = [
@@ -180,14 +197,21 @@ final class UConfiguration
180197
public const OPTIONS_ARRAY = [
181198
'codeViewKeepActiveButtons' => [],
182199
'colorsBackground' => [],
200+
'colorsButtons' => [],
183201
'colorsText' => [],
202+
'embedlyEditButtons' => [],
203+
'embedlyInsertButtons' => [],
184204
'emoticonsSet' => [],
185205
'emoticonsButtons' => [],
186206
'faButtons' => [],
187207
'fileAllowedTypes' => [],
208+
'fileInsertButtons' => [],
188209
'filesManagerAllowedTypes' => [],
189210
'fontAwesomeSets' => [],
211+
'fontAwesome5Sets' => [],
190212
'fontSize' => [],
213+
'formEditButtons' => [],
214+
'formUpdateButtons' => [],
191215
'htmlAllowedAttrs' => [],
192216
'htmlAllowedEmptyTags' => [],
193217
'htmlAllowedStyleProps' => [],
@@ -212,6 +236,7 @@ final class UConfiguration
212236
'quickInsertButtons' => [],
213237
'quickInsertTags' => [],
214238
'shortcutsEnabled' => [],
239+
'specialCharButtons' => [],
215240
'tableColors' => [],
216241
'tableColorsButtons' => [],
217242
'tableEditButtons' => [],
@@ -239,11 +264,13 @@ final class UConfiguration
239264
'aviaryOptions' => [],
240265
'codeMirrorOptions' => [],
241266
'codeBeautifierOptions' => [],
267+
'codoxOptions' => [],
242268
'fileUploadParams' => [],
243269
'filesManagerUploadParams' => [],
244270
'fileUploadToS3' => [],
245271
'filesManagerUploadToS3' => [],
246272
'fontFamily' => [],
273+
'formStyles' => [],
247274
'googleOptions' => [],
248275
'helpSets' => [],
249276
'imageManagerDeleteParams' => [],
@@ -262,6 +289,7 @@ final class UConfiguration
262289
'requestHeaders' => [],
263290
'saveParams' => [],
264291
'scaytOptions' => [],
292+
'specialCharactersSets' => [],
265293
'tableStyles' => [],
266294
'tableCellStyles' => [],
267295
'videoUploadParams' => [],
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Leapt\FroalaEditorBundle\Tests\Utility;
6+
7+
use Leapt\FroalaEditorBundle\Utility\UConfiguration;
8+
use PHPUnit\Framework\TestCase;
9+
use Symfony\Component\DomCrawler\Crawler;
10+
use Symfony\Component\HttpClient\HttpClient;
11+
12+
final class UConfigurationTest extends TestCase
13+
{
14+
public function testAllOptionsAreRegistered(): void
15+
{
16+
$url = 'https://froala.com/wysiwyg-editor/docs/options/';
17+
$httpClient = HttpClient::create();
18+
$crawler = new Crawler($httpClient->request('GET', $url)->getContent());
19+
$optionsFromDocs = $crawler->filter('.docs-data-list.block-box a');
20+
$registeredOptions = UConfiguration::getArrOptionAll();
21+
$proxyOrIgnoredOptions = ['Key', 'editor'];
22+
$missingOptions = [];
23+
24+
foreach ($optionsFromDocs as $option) {
25+
if (!\in_array($option->textContent, $registeredOptions, true) && !\in_array($option->textContent, $proxyOrIgnoredOptions, true)) {
26+
$missingOptions[] = $option->textContent;
27+
}
28+
}
29+
30+
self::assertSame([], $missingOptions);
31+
}
32+
}

0 commit comments

Comments
 (0)