Commit 835a271b authored by picklesrus's avatar picklesrus

Show the comment status box on project page loads if the user is muted.

Don't show the compose box if they're muted, but do show it, but greyed 
out, if they just posted a comment that resulted in a mute.
parent 5af56069
...@@ -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