Repository navigation
Try to fix unique id issue #3263
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
Crabcyborg
wants to merge
15
commits into
master
Choose a base branch
from
try_to_fix_unique_id_issue
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
d971432
Try to fix unique id issue
Crabcyborg 571e894
Merge remote-tracking branch 'origin/master' into try_to_fix_unique_i…
Crabcyborg 05b9c7d
Keep reserved field orders unique after click insert and save
Crabcyborg 7dd392c
Merge master into try_to_fix_unique_id_issue
Crabcyborg ad7c20c
fix(builder): count fields when reserving order
Crabcyborg 632a792
test(builder): align reservation fixture lint
Crabcyborg dfcd1ed
Merge branch 'master' into try_to_fix_unique_id_issue
Crabcyborg 7c5b44e
Merge remote-tracking branch 'origin/master' into HEAD
Crabcyborg 9c2cea2
Integrate current master and rebuild page-specific admin scripts
Crabcyborg afbf1a6
Integrate current master and rebuild page-specific admin scripts
Crabcyborg b5a1094
Merge remote-tracking branch 'origin/master' into try_to_fix_unique_i…
Crabcyborg 20afb6f
Rebuild formidable_builder.js after merging master
Crabcyborg 52cb280
Merge master into try_to_fix_unique_id_issue
Crabcyborg 59f7282
Merge remote-tracking branch 'origin/master' into try_to_fix_unique_i…
Crabcyborg 17c3f8b
Merge origin/master into try_to_fix_unique_id_issue
Crabcyborg File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| /* oxlint-disable import/no-nodejs-modules -- Tests run with the Node test runner. */ | ||
| import assert from 'node:assert/strict'; | ||
| import fs from 'node:fs'; | ||
| import { test } from 'node:test'; | ||
| import vm from 'node:vm'; | ||
|
|
||
| const builder = fs.readFileSync( new URL( '../../js/src/admin/builder/dragDrop.js', import.meta.url ), 'utf8' ); | ||
|
|
||
| test( 'the builder reserves distinct orders and follows the server response', () => { | ||
| const functions = [ 'reserveFieldOrder', 'syncFieldOrderWithResponse' ].map( name => { | ||
| const match = builder.match( new RegExp( `\\tfunction ${ name }\\([^\\n]*\\n[\\s\\S]*?\\n\\t}` ) ); | ||
| assert.ok( match, name ); | ||
| return match[ 0 ]; | ||
| } ); | ||
| const document = { | ||
| querySelectorAll( selector ) { | ||
| assert.equal( selector, '#frm-show-fields li.edit_form_item.frm_field_box' ); | ||
| return { length: 4 }; | ||
| }, | ||
| }; | ||
| const div = () => ( { | ||
| querySelectorAll( selector ) { | ||
| assert.equal( selector, 'input[name^="field_options[field_order_"]' ); | ||
| return [ { value: '3' } ]; | ||
| }, | ||
| querySelector( selector ) { | ||
| assert.equal( selector, '#frm-last-row-fields-order' ); | ||
| return { value: '{"9":7}' }; | ||
| }, | ||
| } ); | ||
| // eslint-disable-next-line sonarjs/code-eval -- Runs only the checked-in builder functions. | ||
| const api = vm.runInNewContext( | ||
| `let nextFieldOrder = 0;\n${ functions.join( '\n' ) }\n({ reserveFieldOrder, syncFieldOrderWithResponse });`, | ||
| { document, div } | ||
| ); | ||
|
|
||
| assert.equal( api.reserveFieldOrder( 1 ), 0 ); | ||
| api.syncFieldOrderWithResponse( '' ); | ||
| assert.equal( api.reserveFieldOrder( 1 ), 8 ); | ||
| assert.equal( api.reserveFieldOrder( 1 ), 10 ); | ||
| api.syncFieldOrderWithResponse( '' ); | ||
| assert.equal( api.reserveFieldOrder( 0 ), 12 ); | ||
| } ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A variable has been used but not defined, which may result in warnings during program execution. This can also cause bugs since the intended usage scope of the variable is not known.