'use strict'; require('../common'); describe('Prompt', function () { // TODO: this does not test the prompt() fallback, since that isn't available // in nodejs -> replace the prompt in the "page" template with a modal describe('requestPassword & getPassword', function () { this.timeout(30000); jsc.property( 'returns the password fed into the dialog', 'string', function (password) { password = password.replace(/\r+/g, ''); var clean = jsdom('', {url: 'ftp://example.com/?0000000000000000'}); $('body').html( '' ); $.PrivateBin.Model.reset(); $.PrivateBin.Model.init(); $.PrivateBin.Prompt.init(); $.PrivateBin.Prompt.requestPassword(); $('#passworddecrypt').val(password); // TODO triggers error messages in current jsDOM version, find better solution //$('#passwordform').submit(); //var result = $.PrivateBin.Prompt.getPassword(); var result = $('#passworddecrypt').val(); $.PrivateBin.Model.reset(); clean(); return result === password; } ); }); });