diff options
author | Ian Coleman <coleman.ian@gmail.com> | 2017-09-20 10:31:28 +1000 |
---|---|---|
committer | Ian Coleman <coleman.ian@gmail.com> | 2017-09-20 11:25:21 +1000 |
commit | ee0981f1ecc4c6e78831f538ef77396c1e4fbe91 (patch) | |
tree | 9abba5e09307c9dc62c52b371576d73e369672dd /tests.js | |
parent | 6024e655a8b6d3c35ef189013f8cd2de605171fa (diff) | |
download | BIP39-ee0981f1ecc4c6e78831f538ef77396c1e4fbe91.tar.gz BIP39-ee0981f1ecc4c6e78831f538ef77396c1e4fbe91.tar.zst BIP39-ee0981f1ecc4c6e78831f538ef77396c1e4fbe91.zip |
Detect and warn of filtered entropy
Diffstat (limited to 'tests.js')
-rw-r--r-- | tests.js | 38 |
1 files changed, 38 insertions, 0 deletions
@@ -4306,6 +4306,44 @@ page.open(url, function(status) { | |||
4306 | }); | 4306 | }); |
4307 | }, | 4307 | }, |
4308 | 4308 | ||
4309 | // github issue 99 | ||
4310 | // https://github.com/iancoleman/bip39/issues/99#issuecomment-327094159 | ||
4311 | // "warn me emphatically when they have detected invalid input" to the entropy field | ||
4312 | // A warning is shown when entropy is filtered and discarded | ||
4313 | function() { | ||
4314 | page.open(url, function(status) { | ||
4315 | // use entropy | ||
4316 | page.evaluate(function() { | ||
4317 | $(".use-entropy").prop("checked", true).trigger("change"); | ||
4318 | $(".entropy").val("00000000 00000000 00000000 00000000").trigger("input"); | ||
4319 | }); | ||
4320 | // check the filter warning does not show | ||
4321 | waitForGenerate(function() { | ||
4322 | var warningIsHidden = page.evaluate(function() { | ||
4323 | return $(".entropy-container .filter-warning").hasClass("hidden"); | ||
4324 | }); | ||
4325 | if (!warningIsHidden) { | ||
4326 | console.log("Entropy filter warning is showing when it should not"); | ||
4327 | fail(); | ||
4328 | } | ||
4329 | page.evaluate(function() { | ||
4330 | $(".entropy").val("10000000 zxcvbn 00000000 00000000 00000000").trigger("input"); | ||
4331 | }); | ||
4332 | // check the filter warning shows | ||
4333 | waitForEntropyFeedback(function() { | ||
4334 | var warningIsHidden = page.evaluate(function() { | ||
4335 | return $(".entropy-container .filter-warning").hasClass("hidden"); | ||
4336 | }); | ||
4337 | if (warningIsHidden) { | ||
4338 | console.log("Entropy filter warning is not showing when it should"); | ||
4339 | fail(); | ||
4340 | } | ||
4341 | next(); | ||
4342 | }); | ||
4343 | }); | ||
4344 | }); | ||
4345 | }, | ||
4346 | |||
4309 | // If you wish to add more tests, do so here... | 4347 | // If you wish to add more tests, do so here... |
4310 | 4348 | ||
4311 | // Here is a blank test template | 4349 | // Here is a blank test template |