started specs for AspectEdit.deletePersonFromAspect
This commit is contained in:
parent
9586ebb67e
commit
6c439608f0
2 changed files with 19 additions and 3 deletions
|
|
@ -83,9 +83,9 @@ var AspectEdit = {
|
||||||
var person_id = person.attr('data-guid');
|
var person_id = person.attr('data-guid');
|
||||||
|
|
||||||
if( $(".person[data-guid='"+ person_id +"']").length == 1) {
|
if( $(".person[data-guid='"+ person_id +"']").length == 1) {
|
||||||
alert("You can not remove the person from the last aspect");
|
AspectEdit.alertUser("You cannot remove the person from the last aspect");
|
||||||
|
}
|
||||||
} else {
|
else {
|
||||||
if (!person.hasClass('request')) {
|
if (!person.hasClass('request')) {
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
|
|
@ -173,6 +173,10 @@ var AspectEdit = {
|
||||||
request_html.replace(/\d+/, old_request_count - 1)
|
request_html.replace(/\d+/, old_request_count - 1)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
alertUser: function(message) {
|
||||||
|
alert(message);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -204,6 +204,18 @@ describe("AspectEdit", function() {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe("deletePersonFromAspect", function() {
|
||||||
|
beforeEach(function() {
|
||||||
|
spyOn($, 'ajax');
|
||||||
|
});
|
||||||
|
it("doesn't let you remove the person from the last aspect they're in", function() {
|
||||||
|
spyOn(AspectEdit, 'alertUser');
|
||||||
|
AspectEdit.deletePersonFromAspect($('li.person'));
|
||||||
|
expect(AspectEdit.alertUser).toHaveBeenCalled();
|
||||||
|
expect($.ajax).not.toHaveBeenCalled();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
describe("decrementRequestsCounter", function() {
|
describe("decrementRequestsCounter", function() {
|
||||||
describe("when there is one request", function() {
|
describe("when there is one request", function() {
|
||||||
it("removes the counter from the new requests div", function() {
|
it("removes the counter from the new requests div", function() {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue