]> git.immae.eu Git - perso/Immae/Projets/Cryptomonnaies/BIP39.git/commitdiff
feat(test): add bip85 test
authorAndreasGassmann <andreas@andreasgassmann.ch>
Sun, 8 Nov 2020 23:46:58 +0000 (00:46 +0100)
committerAndreasGassmann <andreas@andreasgassmann.ch>
Sun, 8 Nov 2020 23:46:58 +0000 (00:46 +0100)
src/js/index.js
tests/spec/tests.js

index 80b78bca7f42065f53f9bbf1c8c2069f74e41c58..7aa021704f633ea44448aaeece1870b23a22d6fd 100644 (file)
     function toggleBip85() {
       if (DOM.showBip85.prop('checked')) {
         DOM.bip85.removeClass('hidden');
-        toggleBip85Fields();
+        calcBip85();
       } else {
         DOM.bip85.addClass('hidden');
       }
     }
   
     function calcBip85() {
+      if (!DOM.showBip85.prop('checked')) {
+        return
+      }
+
       toggleBip85Fields();
   
       var app = DOM.bip85application.val();
index efb395f1ef011626caf9148ac8acf1f8629301a3..9d07edb46f5e244bd996fd3b1ca912644c486aef 100644 (file)
@@ -4960,6 +4960,24 @@ it('Shows split prase cards', function(done) {
     });
 });
 
+// Pull Request 454 https://github.com/iancoleman/bip39/pull/454
+// Add BIP85 support
+it('Show BIP85', function(done) {
+  var originalPhrase = "install scatter logic circle pencil average fall shoe quantum disease suspect usage";
+  driver.findElement(By.css('.phrase'))
+      .sendKeys(originalPhrase);
+  driver.sleep(generateDelay).then(function() {
+    driver.findElement(By.css('.showBip85')).click();
+    driver.findElement(By.css('.showBip85')).isSelected().then(function(isSelected) {
+      expect(isSelected).toBe(true)
+      driver.findElement(By.css('#bip85Field')).getAttribute("value").then(function(childMnemonic) {
+        expect(childMnemonic).toBe('girl mad pet galaxy egg matter matrix prison refuse sense ordinary nose')
+        done();
+      })
+    });
+  });
+});
+
 // It allows manually specifying the entropy type
 it('Allows entropy type to be manually selected', function(done) {
     driver.findElement(By.css('.use-entropy'))