Skip to content

Commit

Permalink
PCHR-2395: PR Feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
igorpavlov committed Jul 13, 2017
1 parent 7a7ef9a commit 726cf8a
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1029,12 +1029,10 @@ define([
// When in Admin Dashboard
return Contact.all()
.then(function (contacts) {
var self = this;

this.managedContacts = _.remove(contacts.list, function (contact) {
// Removes the manager/admin from the list of managees
return contact.id !== self.directiveOptions.contactId;
});
// Removes the admin from the list of managees
return contact.id !== this.directiveOptions.contactId;
}.bind(this));
}.bind(this));
} else {
// Everywhere else
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1205,6 +1205,33 @@
});

describe('admin opens leave request popup in create mode', function () {
var adminId = 206;

beforeEach(function () {
$ctrl.request.contact_id = adminId.toString();

role = 'admin';
initTestController({
contactId: adminId
});
});

describe('on initialization', function () {
it('is in create mode', function () {
expect($ctrl.isMode('create')).toBeTruthy();
});

it('has admin role', function () {
expect($ctrl.isRole('admin')).toBeTruthy();
});

it('does not contain admin in the list of managees', function () {
expect(_.find($ctrl.managedContacts, { 'id': adminId })).toBeUndefined();
});
});
});

describe('admin opens leave request popup in create mode for a pre-selected contact', function () {
var selectedContactId = 208;
var adminId = 206;

Expand Down

0 comments on commit 726cf8a

Please sign in to comment.