Skip to content
This repository was archived by the owner on Mar 4, 2025. It is now read-only.

SUP-2883, URL should be removed after successful adding as web link. #619

Merged
merged 2 commits into from
Dec 22, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@
$log.debug("Web link added: " + JSON.stringify(data));
data.data.provider = data.provider;
$scope.linkedAccounts.push(data.data);
// reset the form when it is successfully added
$scope.addWebLinkFrm.$setPristine();
$scope.url = null;
toaster.pop('success', "Success", "Your link has been added. Data from your link will be visible on your profile shortly.");
})
.catch(function(resp) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,24 +90,29 @@ describe('ExternalWebLinks Directive', function() {
});
expect(topcoderLink).to.exist;
expect(topcoderLink.status).to.exist.to.equal('PENDING');
expect(element.isolateScope().url).not.to.exist;
expect(toasterSvc.pop).to.have.been.calledWith('success').calledOnce;
});

it('should NOT add new weblink to linkedAccounts', function() {
var urlToAdd = 'https://www.topcoder.com';
element.isolateScope().userHandle = 'throwError';
element.isolateScope().url = 'https://www.topcoder.com';
element.isolateScope().url = urlToAdd;
element.isolateScope().addWebLink();
scope.$digest();
expect(scope.linkedAccounts).to.have.length(1);
expect(element.isolateScope().url).to.exist.to.equal(urlToAdd);
expect(toasterSvc.pop).to.have.been.calledWith('error').calledOnce;
});

it('should NOT add new weblink to linkedAccounts', function() {
var urlToAdd = 'https://www.topcoder.com';
element.isolateScope().userHandle = 'alreadyExistsError';
element.isolateScope().url = 'https://www.topcoder.com';
element.isolateScope().url = urlToAdd;
element.isolateScope().addWebLink();
scope.$digest();
expect(scope.linkedAccounts).to.have.length(1);
expect(element.isolateScope().url).to.exist.to.equal(urlToAdd);
expect(toasterSvc.pop).to.have.been.calledWith('error').calledOnce;
});

Expand Down