1
0
mirror of https://github.com/moparisthebest/mail synced 2024-12-01 13:22:16 -05:00

[WO-465] clear input

This commit is contained in:
Felix Hammerl 2014-07-22 21:32:11 +02:00
parent 26f62668c6
commit a9db71a8b9
2 changed files with 14 additions and 0 deletions

View File

@ -63,6 +63,9 @@ define(function(require) {
// generate new code for the user // generate new code for the user
$scope.code = $scope.generateCode(); $scope.code = $scope.generateCode();
$scope.displayedCode = $scope.code.slice(0, 4) + '-' + $scope.code.slice(4, 8) + '-' + $scope.code.slice(8, 12) + '-' + $scope.code.slice(12, 16) + '-' + $scope.code.slice(16, 20) + '-' + $scope.code.slice(20, 24); $scope.displayedCode = $scope.code.slice(0, 4) + '-' + $scope.code.slice(4, 8) + '-' + $scope.code.slice(8, 12) + '-' + $scope.code.slice(12, 16) + '-' + $scope.code.slice(16, 20) + '-' + $scope.code.slice(20, 24);
// clear input fields of any previous artifacts
$scope.code0 = $scope.code1 = $scope.code2 = $scope.code3 = $scope.code4 = $scope.code5 = '';
}; };
$scope.generateCode = function() { $scope.generateCode = function() {

View File

@ -92,10 +92,21 @@ define(function(require) {
var generateCodeStub = sinon.stub(scope, 'generateCode'); var generateCodeStub = sinon.stub(scope, 'generateCode');
generateCodeStub.returns('asdf'); generateCodeStub.returns('asdf');
// add some artifacts from a previous key input
scope.code0 = scope.code1 = scope.code2 = scope.code3 = scope.code4 = scope.code5 = 'asdasd';
scope.displayUploadUi(); scope.displayUploadUi();
expect(scope.step).to.equal(1); expect(scope.step).to.equal(1);
expect(scope.code).to.equal('asdf'); expect(scope.code).to.equal('asdf');
// artifacts should be cleared
expect(scope.code0).to.be.empty;
expect(scope.code1).to.be.empty;
expect(scope.code2).to.be.empty;
expect(scope.code3).to.be.empty;
expect(scope.code4).to.be.empty;
expect(scope.code5).to.be.empty;
generateCodeStub.restore(); generateCodeStub.restore();
}); });
}); });