Skip to content

Commit dfe738d

Browse files
committed
reset_multifield
1 parent 7c163ea commit dfe738d

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

apps/remix-ide-e2e/src/tests/transactionExecution.test.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -202,10 +202,10 @@ module.exports = {
202202
.addFile('Storage.sol', sources[6]['Storage.sol'])
203203
.addFile('Owner.sol', sources[6]['Owner.sol'])
204204
.clickLaunchIcon('udapp')
205-
.createContract('42')
205+
.createContract('42, 24')
206206
.openFile('Storage.sol')
207207
.clickLaunchIcon('udapp')
208-
.createContract('') // this creation will fail if the component hasn't been properly reset.
208+
.createContract('102') // this creation will fail if the component hasn't been properly reset.
209209
.clickInstance(1)
210210
.clickFunction('store - transact (not payable)', { types: 'uint256 num', values: '24' })
211211
.testFunction('last', // we check if the contract is actually reachable.
@@ -375,7 +375,7 @@ contract C {
375375
/**
376376
* @dev Set contract deployer as owner
377377
*/
378-
constructor(uint p) {
378+
constructor(uint p, uint o) {
379379
owner = msg.sender; // 'msg.sender' is sender of current call, contract deployer for a constructor
380380
emit OwnerSet(address(0), owner);
381381
}
@@ -412,6 +412,10 @@ contract C {
412412
413413
uint256 number;
414414
415+
constructor(uint p) {
416+
417+
}
418+
415419
/**
416420
* @dev Store value in variable
417421
* @param num value to store

libs/remix-ui/run-tab/src/lib/components/contractGUI.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ export function ContractGUI (props: ContractGUIProps) {
1616
dataId: string
1717
}>({ title: '', content: '', classList: '', dataId: '' })
1818
const multiFields = useRef<Array<HTMLInputElement | null>>([])
19+
const basicInputRef = useRef<HTMLInputElement>()
1920

2021
useEffect(() => {
2122
if (props.title) {
@@ -26,6 +27,10 @@ export function ContractGUI (props: ContractGUIProps) {
2627
setTitle(props.funcABI.type === 'receive' ? '(receive)' : '(fallback)')
2728
}
2829
setBasicInput('')
30+
// we have the reset the fields before reseting the previous references.
31+
basicInputRef.current.value = ''
32+
multiFields.current.filter((el) => el !== null && el !== undefined).forEach((el) => el.value = '')
33+
multiFields.current = []
2934
}, [props.title, props.funcABI])
3035

3136
useEffect(() => {
@@ -166,6 +171,7 @@ export function ContractGUI (props: ContractGUIProps) {
166171
placeholder={props.inputs}
167172
title={props.funcABI.type === 'fallback' || props.funcABI.type === 'receive' ? `'(${props.funcABI.type}')` : props.inputs}
168173
onChange={handleBasicInput}
174+
ref={basicInputRef}
169175
style={{ visibility: !((props.funcABI.inputs && props.funcABI.inputs.length > 0) || (props.funcABI.type === 'fallback') || (props.funcABI.type === 'receive')) ? 'hidden' : 'visible' }} />
170176
<i
171177
className="fas fa-angle-down udapp_methCaret"

0 commit comments

Comments
 (0)