diff options
-rw-r--r-- | src/js/index.js | 8 | ||||
-rw-r--r-- | tests.js | 30 |
2 files changed, 38 insertions, 0 deletions
diff --git a/src/js/index.js b/src/js/index.js index a12e442..b1876cb 100644 --- a/src/js/index.js +++ b/src/js/index.js | |||
@@ -1167,6 +1167,14 @@ | |||
1167 | 1167 | ||
1168 | var networks = [ | 1168 | var networks = [ |
1169 | { | 1169 | { |
1170 | name: "BCH - Bitcoin Cash", | ||
1171 | bip49available: false, | ||
1172 | onSelect: function() { | ||
1173 | network = bitcoinjs.bitcoin.networks.bitcoin; | ||
1174 | setHdCoin(145); | ||
1175 | }, | ||
1176 | }, | ||
1177 | { | ||
1170 | name: "BTC - Bitcoin", | 1178 | name: "BTC - Bitcoin", |
1171 | bip49available: true, | 1179 | bip49available: true, |
1172 | onSelect: function() { | 1180 | onSelect: function() { |
@@ -872,6 +872,36 @@ page.open(url, function(status) { | |||
872 | }); | 872 | }); |
873 | }, | 873 | }, |
874 | 874 | ||
875 | // Network can be set to bitcoin cash | ||
876 | function() { | ||
877 | page.open(url, function(status) { | ||
878 | // set the phrase and coin | ||
879 | var expected = "1JKvb6wKtsjNoCRxpZ4DGrbniML7z5U16A"; | ||
880 | page.evaluate(function() { | ||
881 | $(".phrase").val("abandon abandon ability"); | ||
882 | $(".phrase").trigger("input"); | ||
883 | $(".network option[selected]").removeAttr("selected"); | ||
884 | $(".network option").filter(function() { | ||
885 | return $(this).html() == "BCH - Bitcoin Cash"; | ||
886 | }).prop("selected", true); | ||
887 | $(".network").trigger("change"); | ||
888 | }); | ||
889 | // check the address is generated correctly | ||
890 | waitForGenerate(function() { | ||
891 | var actual = page.evaluate(function() { | ||
892 | return $(".address:first").text(); | ||
893 | }); | ||
894 | if (actual != expected) { | ||
895 | console.log("Bitcoin Cash address is incorrect"); | ||
896 | console.log("Expected: " + expected); | ||
897 | console.log("Actual: " + actual); | ||
898 | fail(); | ||
899 | } | ||
900 | next(); | ||
901 | }); | ||
902 | }); | ||
903 | }, | ||
904 | |||
875 | // BIP39 seed is set from phrase | 905 | // BIP39 seed is set from phrase |
876 | function() { | 906 | function() { |
877 | page.open(url, function(status) { | 907 | page.open(url, function(status) { |