Commit 1881587
authored
32952 fakerjs (#33056)
### Proposed Changes
This pull request refactors the usage and location of the `FieldUtil`
utility and related test helpers across the codebase. The main goal is
to move `FieldUtil` from the testing utilities into the main utilities
library, ensuring consistent usage in both production and test code.
Additionally, some test helpers are updated to use more specific field
creators, and minor code cleanups are performed.
Key changes include:
**Refactoring and relocation of FieldUtil:**
* Moved `FieldUtil` from `@dotcms/utils-testing` to `@dotcms/utils`,
updating all imports across the codebase to use the new location. This
affects multiple components, services, and test files related to content
type fields.
[[1]](diffhunk://#diff-68265dbaa48f0d088fb144f7cd1d3bdf5de62807350ff08098becc2086c909bdL1-R5)
[[2]](diffhunk://#diff-eed6eb3b744d97d82e3e08ddbe4d1caa3d2638239b5637b2b89eef8cc5e5349aR7)
[[3]](diffhunk://#diff-9ab5f7453058fb177f148e614b6ad8e8864543f824713a0d24ab570c12d737f1L41)
[[4]](diffhunk://#diff-1eb2ec9164ddd81069ea68f09a2101536b6fa645ac5541bbda106ce4594921d2L1-R1)
[[5]](diffhunk://#diff-f84382de3a3f4b0acad278da4d85bd63c44fa77a221a647e116e6757e795895dL6-R6)
[[6]](diffhunk://#diff-071c449a7eb3a0aec4deb1488aa21e344fa74755d4923842f82bdda2b98fee8aL5-R5)
[[7]](diffhunk://#diff-613673a154d00a52abad3ef967e298ddb3fb36304a5e1c0537cb2a0b14445950L10-R10)
[[8]](diffhunk://#diff-f0119127a051b02bbf50323b94f33be9e6203fd63e6907a3be68166fdd27953eL11-R12)
[[9]](diffhunk://#diff-c699a0270b0ddb9f06480224ce811b1bc47335d275fe9ffa9c3da396c065e400L37-R37)
[[10]](diffhunk://#diff-d3c22cf0ac2d57f6d02b13c6120b253c92d8c8f5a3948dfe8e19a29d61f1fb2aL17-R18)
[[11]](diffhunk://#diff-c4c77fba3abe168b6fcc536e786ae05dc32bc3f04bd31a2effecc79decab5fb2L51-L59)
[[12]](diffhunk://#diff-b1988fdbb798b95d236e7d8fe4d0225c7ae7d153a4490f8a7eb2a7cb197be6d9R24-R31)
* Updated the implementation of `FieldUtil.isColumnBreak` usage to
directly compare with `DotCMSClazzes.COLUMN_BREAK` instead of calling
the method, simplifying the logic.
**Test helper improvements:**
* Replaced generic `createFakeTextField` calls in calendar field tests
with more specific helpers (`createFakeDateField`,
`createFakeDateTimeField`, `createFakeTimeField`) for better clarity and
accuracy in test cases. (Fd7ae35aL1,
[[1]](diffhunk://#diff-35a422266bdff3888f61420da49b048cd4bca48cd1303e85ffeee171839162f3L511-R517)
[[2]](diffhunk://#diff-35a422266bdff3888f61420da49b048cd4bca48cd1303e85ffeee171839162f3L534-R539)
[[3]](diffhunk://#diff-35a422266bdff3888f61420da49b048cd4bca48cd1303e85ffeee171839162f3L553-R557)
[[4]](diffhunk://#diff-35a422266bdff3888f61420da49b048cd4bca48cd1303e85ffeee171839162f3L580-R581)
[[5]](diffhunk://#diff-35a422266bdff3888f61420da49b048cd4bca48cd1303e85ffeee171839162f3L613-R615)
**Other code cleanups:**
* Removed unused imports (e.g., `faker`) from component files and
replaced random number generation with standard JavaScript functions
where appropriate.
[[1]](diffhunk://#diff-b6e7f5a1ad7c221178b3ddf3f3dfc06021ba87b4e18ef9d7f6c6c9a6eab016d3L1-L2)
[[2]](diffhunk://#diff-b6e7f5a1ad7c221178b3ddf3f3dfc06021ba87b4e18ef9d7f6c6c9a6eab016d3L111-R109)
* Moved the definition of `EMPTY_ROWS_VALUE` from a mock file into the
main gridstack utilities file for better accessibility and
maintainability.
[[1]](diffhunk://#diff-f3792a46b295fb618b6d4a8d8f4ecef72ec5e3c41a470d6a44886881a6b93659L5-L6)
[[2]](diffhunk://#diff-f3792a46b295fb618b6d4a8d8f4ecef72ec5e3c41a470d6a44886881a6b93659R17-R44)
* Fixed import of `EMPTY_FIELD` in test files to use the main utilities
package.
### Checklist
- [ ] Tests
- [ ] Translations
- [ ] Security Implications Contemplated (add notes if applicable)
### Additional Info
** any additional useful context or info **
### Screenshots
![Uploading share.png…]()
This PR fixes: #329521 parent 190b703 commit 1881587
File tree
19 files changed
+1193
-236
lines changed- core-web
- libs
- dotcms-models/src/lib
- edit-content/src/lib/fields
- dot-edit-content-calendar-field
- dot-edit-content-file-field/components/dot-select-existing-file/components/dot-sidebar
- template-builder/src/lib/components/template-builder/utils
- utils-testing/src
- lib
- utils/src
19 files changed
+1193
-236
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
48 | 48 | | |
49 | 49 | | |
50 | 50 | | |
51 | | - | |
| 51 | + | |
52 | 52 | | |
53 | 53 | | |
54 | 54 | | |
55 | 55 | | |
56 | 56 | | |
57 | 57 | | |
58 | 58 | | |
59 | | - | |
60 | 59 | | |
61 | 60 | | |
62 | 61 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
| 24 | + | |
24 | 25 | | |
25 | 26 | | |
26 | 27 | | |
27 | 28 | | |
28 | 29 | | |
29 | 30 | | |
30 | | - | |
31 | | - | |
| 31 | + | |
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
| |||
114 | 114 | | |
115 | 115 | | |
116 | 116 | | |
117 | | - | |
| 117 | + | |
118 | 118 | | |
119 | 119 | | |
120 | 120 | | |
| |||
Lines changed: 2 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
17 | | - | |
18 | | - | |
19 | | - | |
20 | | - | |
21 | | - | |
| 17 | + | |
| 18 | + | |
22 | 19 | | |
23 | 20 | | |
24 | 21 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
| 5 | + | |
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
| 6 | + | |
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| 11 | + | |
11 | 12 | | |
12 | 13 | | |
13 | 14 | | |
14 | | - | |
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| |||
Lines changed: 2 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | | - | |
| 11 | + | |
| 12 | + | |
12 | 13 | | |
13 | 14 | | |
14 | 15 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | | - | |
| 10 | + | |
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| |||
Lines changed: 1 addition & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
37 | | - | |
38 | | - | |
| 37 | + | |
39 | 38 | | |
40 | 39 | | |
41 | 40 | | |
| |||
0 commit comments