Merge pull request #97 from whiteout-io/dev/WO-465

[WO-465] clear input
This commit is contained in:
Tankred Hase 2014-07-23 10:41:23 +02:00
commit 2c3347bf84
2 changed files with 14 additions and 0 deletions

View File

@ -84,6 +84,9 @@ define(function(require) {
// generate new code for the user
$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);
// clear input fields of any previous artifacts
$scope.code0 = $scope.code1 = $scope.code2 = $scope.code3 = $scope.code4 = $scope.code5 = '';
};
$scope.generateCode = function() {

View File

@ -112,10 +112,21 @@ define(function(require) {
var generateCodeStub = sinon.stub(scope, 'generateCode');
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();
expect(scope.step).to.equal(1);
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();
});
});