Commit 7533720b authored by Sheetal Umesh Kumar's avatar Sheetal Umesh Kumar

do not toggle close reply container after publishing a reply

added missing new line.

don't attempt toggleCollapsed if no parent available

adding a test and a comment

simplifying assert
parent 833c203a
...@@ -734,6 +734,12 @@ function link(scope, elem, attrs, controllers) { ...@@ -734,6 +734,12 @@ function link(scope, elem, attrs, controllers) {
if (threadFilter) { if (threadFilter) {
threadFilter.freeze(false); threadFilter.freeze(false);
} }
// Ensure that the just-edited annotation remains visible.
if (thread.parent) {
thread.parent.toggleCollapsed(false);
}
} }
}); });
......
...@@ -153,7 +153,10 @@ describe('annotation', function() { ...@@ -153,7 +153,10 @@ describe('annotation', function() {
}; };
mockThreadController = { mockThreadController = {
collapsed: true, collapsed: true,
toggleCollapsed: sinon.stub() toggleCollapsed: sinon.stub(),
parent: {
toggleCollapsed: sinon.stub()
}
}; };
mockThreadFilterController = { mockThreadFilterController = {
active: sinon.stub(), active: sinon.stub(),
...@@ -263,6 +266,18 @@ describe('annotation', function() { ...@@ -263,6 +266,18 @@ describe('annotation', function() {
true, true,
mockThreadFilterController.freeze.lastCall.calledWithExactly(false)); mockThreadFilterController.freeze.lastCall.calledWithExactly(false));
}); });
it('does not collapse parent thread after edit', function() {
mockAnnotationController.editing.returns(true);
link(scope, mockElement, mockAttributes, mockControllers);
scope.$digest();
mockAnnotationController.editing.returns(false);
scope.$digest();
assert.calledWith(mockThreadController.parent.toggleCollapsed, false);
});
}); });
describe('AnnotationController', function() { describe('AnnotationController', function() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment