From 1cfa2b024f0d155e87355f561def52c206c314d4 Mon Sep 17 00:00:00 2001 From: yann300 Date: Wed, 4 Oct 2017 14:03:14 +0200 Subject: [PATCH 1/2] fix decode response + add tests --- src/app/execution/txFormat.js | 6 +----- test-browser/tests/compiling.js | 32 +++++++++++++++++++------------- 2 files changed, 20 insertions(+), 18 deletions(-) diff --git a/src/app/execution/txFormat.js b/src/app/execution/txFormat.js index aba5f32825..9d8e32e110 100644 --- a/src/app/execution/txFormat.js +++ b/src/app/execution/txFormat.js @@ -159,11 +159,7 @@ module.exports = { var json = {} for (i = 0; i < outputTypes.length; i++) { var name = fnabi.outputs[i].name - if (name.length > 0) { - json[outputTypes[i] + ' ' + name] = decodedObj[i] - } else { - json[outputTypes[i]] = decodedObj[i] - } + json[i] = outputTypes[i] + ': ' + (name ? name + ' ' + decodedObj[i] : decodedObj[i]) } return json diff --git a/test-browser/tests/compiling.js b/test-browser/tests/compiling.js index 6b44a87027..1606b1d0fc 100644 --- a/test-browser/tests/compiling.js +++ b/test-browser/tests/compiling.js @@ -6,7 +6,13 @@ var sauce = require('./sauce') var sources = { 'sources': { 'browser/Untitled.sol': `pragma solidity ^0.4.0; - contract TestContract { function f() returns (uint) { return 8; } }` + contract TestContract { function f() returns (uint) { return 8; } + function g() returns (uint, string, bool, uint) { + uint payment = 345; + bool payed = true; + string memory comment = "comment_comment_"; + uint month = 4; + return (payment, comment, payed, month); } }` } } @@ -35,18 +41,18 @@ function runTests (browser) { .waitForElementPresent('#editor-container div[class^="terminal"] span[id="tx0xa178c603400a184ce5fedbcfab392d9b77822f6ffa7facdec693aded214523bc"]') .assert.containsText('#editor-container div[class^="terminal"] span[id="tx0xa178c603400a184ce5fedbcfab392d9b77822f6ffa7facdec693aded214523bc"]', '[vm] from:0xca3...a733c, to:browser/Untitled.sol:TestContract.f() 0x692...77b3a, value:0 wei, data:0x261...21ff0, 0 logs, hash:0xa17...523bc') .click('#editor-container div[class^="terminal"] span[id="tx0xa178c603400a184ce5fedbcfab392d9b77822f6ffa7facdec693aded214523bc"] button[class^="details"]') - .assert.containsText('#editor-container div[class^="terminal"] span[id="tx0xa178c603400a184ce5fedbcfab392d9b77822f6ffa7facdec693aded214523bc"] table[class^="txTable"] #decodedoutput', '"uint256": "8"') + .assert.containsText('#editor-container div[class^="terminal"] span[id="tx0xa178c603400a184ce5fedbcfab392d9b77822f6ffa7facdec693aded214523bc"] table[class^="txTable"] #decodedoutput', `{ + "0": "uint256: 8" +}`) + .click('.instance button[title="g - transact (not payable)"]') + .waitForElementPresent('#editor-container div[class^="terminal"] span[id="tx0xb1532162e2e31397dc1e07ed0a1cf08f728e9b4487c6f9ed79d2f39410c92781"]') + .click('#editor-container div[class^="terminal"] span[id="tx0xb1532162e2e31397dc1e07ed0a1cf08f728e9b4487c6f9ed79d2f39410c92781"] button[class^="details"]') + .assert.containsText('#editor-container div[class^="terminal"] span[id="tx0xb1532162e2e31397dc1e07ed0a1cf08f728e9b4487c6f9ed79d2f39410c92781"] table[class^="txTable"] #decodedoutput', `{ + "0": "uint256: 345", + "1": "string: comment_comment_", + "2": "bool: true", + "3": "uint256: 4" +}`) .end() - /* - @TODO: need to check now the return value of the function - .waitForElementPresent('.output .returned') - .assert.containsText('.output .returned', '0x0000000000000000000000000000000000000000000000000000000000000008') - .execute(function () { - document.querySelector('.output .decoded li').scrollIntoView() - }, [], function () { - browser.assert.containsText('.output .decoded li', 'uint256: 8') - .end() - }) - */ }) } From f6a5d3704642e450ebcf857f47f02f92cdd90c01 Mon Sep 17 00:00:00 2001 From: yann300 Date: Wed, 4 Oct 2017 14:04:00 +0200 Subject: [PATCH 2/2] fix input dom --- src/app/panels/terminal.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/panels/terminal.js b/src/app/panels/terminal.js index 29345149e6..f9342ea59c 100644 --- a/src/app/panels/terminal.js +++ b/src/app/panels/terminal.js @@ -210,7 +210,7 @@ class Terminal { ${self._view.dropdown} - + ${self._view.icon}