Skip to content

Commit

Permalink
chore: add tests for firing collapse events
Browse files Browse the repository at this point in the history
  • Loading branch information
BeksOmega committed Apr 3, 2024
1 parent 73602a9 commit 37f3155
Showing 1 changed file with 39 additions and 0 deletions.
39 changes: 39 additions & 0 deletions tests/mocha/workspace_comment_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,5 +94,44 @@ suite('Workspace comment', function () {
this.workspace.id,
);
});

test('collapse events are fired when a comment is collapsed', function() {
this.renderedComment = new Blockly.comments.RenderedWorkspaceComment(
this.workspace,
);
const spy = createChangeListenerSpy(this.workspace);

this.renderedComment.setCollapsed(true);

assertEventFired(
spy,
Blockly.Events.CommentCollapse,
{
commentId: this.renderedComment.id,
newCollapsed: true,
},
this.workspace.id,
);
});

test('collapse events are fired when a comment is uncollapsed', function() {
this.renderedComment = new Blockly.comments.RenderedWorkspaceComment(
this.workspace,
);
this.renderedComment.setCollapsed(true);
const spy = createChangeListenerSpy(this.workspace);

this.renderedComment.setCollapsed(false);

assertEventFired(
spy,
Blockly.Events.CommentCollapse,
{
commentId: this.renderedComment.id,
newCollapsed: false,
},
this.workspace.id,
);
});
});
});

0 comments on commit 37f3155

Please sign in to comment.