Unverified Commit 287426c3 authored by picklesrus's avatar picklesrus Committed by GitHub

Merge pull request #4721 from picklesrus/comment-status

Show the comment status box on project page loads if the user is muted.
parents 4f870a67 2d5e9a63
...@@ -26,9 +26,11 @@ describe('Compose Comment test', () => { ...@@ -26,9 +26,11 @@ describe('Compose Comment test', () => {
store = mockStore({ store = mockStore({
session: { session: {
session: { session: {
user: {} user: {},
permissions: {
mute_status: {}
}
} }
} }
}); });
}); });
...@@ -74,14 +76,15 @@ describe('Compose Comment test', () => { ...@@ -74,14 +76,15 @@ describe('Compose Comment test', () => {
expect(component.find('FlexRow.compose-error-row').exists()).toEqual(false); expect(component.find('FlexRow.compose-error-row').exists()).toEqual(false);
}); });
test('Comment Status shows when mute expiration in the future ', () => { test('Comment Status shows but compose box does not when mute expiration in the future ', () => {
const realDateNow = Date.now.bind(global.Date); const realDateNow = Date.now.bind(global.Date);
global.Date.now = () => 0; global.Date.now = () => 0;
const component = getComposeCommentWrapper({}); const component = getComposeCommentWrapper({});
const commentInstance = component.instance(); const commentInstance = component.instance();
commentInstance.setState({muteExpiresAt: 100}); commentInstance.setState({muteExpiresAt: 100});
component.update(); component.update();
expect(component.find('FlexRow.compose-comment').exists()).toEqual(true); // Compose box should be hidden if muted unless they got muted due to a comment they just posted.
expect(component.find('FlexRow.compose-comment').exists()).toEqual(false);
expect(component.find('MuteModal').exists()).toEqual(false); expect(component.find('MuteModal').exists()).toEqual(false);
expect(component.find('CommentingStatus').exists()).toEqual(true); expect(component.find('CommentingStatus').exists()).toEqual(true);
global.Date.now = realDateNow; global.Date.now = realDateNow;
...@@ -99,7 +102,7 @@ describe('Compose Comment test', () => { ...@@ -99,7 +102,7 @@ describe('Compose Comment test', () => {
expect(component.find('FlexRow.compose-comment').exists()).toEqual(true); expect(component.find('FlexRow.compose-comment').exists()).toEqual(true);
expect(component.find('MuteModal').exists()).toEqual(false); expect(component.find('MuteModal').exists()).toEqual(false);
expect(component.find('CommentingStatus').exists()).toEqual(true); expect(component.find('CommentingStatus').exists()).toEqual(true);
// Compose box is disabled // Compose box exists but is disabled
expect(component.find('InplaceInput.compose-input').exists()).toEqual(true); expect(component.find('InplaceInput.compose-input').exists()).toEqual(true);
expect(component.find('InplaceInput.compose-input').props().disabled).toBe(true); expect(component.find('InplaceInput.compose-input').props().disabled).toBe(true);
global.Date.now = realDateNow; global.Date.now = realDateNow;
......
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