Prompt.js 1.2 KB

123456789101112131415161718192021222324252627282930
  1. 'use strict';
  2. require('../common');
  3. describe('Prompt', function () {
  4. describe('requestPassword & getPassword', function () {
  5. this.timeout(30000);
  6. jsc.property(
  7. 'returns the password fed into the dialog',
  8. 'string',
  9. function (password) {
  10. password = password.replace(/\r+|\n+/g, '');
  11. const clean = jsdom('', {url: 'ftp://example.com/?0000000000000000'});
  12. $('body').html(
  13. '<div id="passwordmodal" class="modal fade" role="dialog">' +
  14. '<div class="modal-dialog"><div class="modal-content">' +
  15. '<div class="modal-body"><form id="passwordform" role="form">' +
  16. '<div class="form-group"><input id="passworddecrypt" ' +
  17. 'type="password" class="form-control" placeholder="Enter ' +
  18. 'password"></div><button type="submit">Decrypt</button>' +
  19. '</form></div></div></div></div>'
  20. );
  21. $('#passworddecrypt').val(password);
  22. const result = $('#passworddecrypt').val();
  23. clean();
  24. return result === password;
  25. }
  26. );
  27. });
  28. });