-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add notification warning to editable note mentions
- Loading branch information
1 parent
a421dc5
commit d46a736
Showing
3 changed files
with
80 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,14 +12,26 @@ describe('<EditableNoteMentions />', () => { | |
const note = { | ||
text: 'Hello World!', | ||
}; | ||
const mentionableUsers = [ | ||
{ | ||
key: 'John Doe', | ||
value: 'John.Doe', | ||
email: '[email protected]', | ||
}, | ||
{ | ||
key: 'Mike Smith', | ||
value: 'Mike.Smith', | ||
email: '[email protected]', | ||
}, | ||
]; | ||
let component; | ||
let props; | ||
|
||
beforeEach(() => { | ||
const onCancel = sinon.spy(); | ||
const onChange = sinon.spy(); | ||
const onSave = sinon.spy(); | ||
props = { note, onCancel, onChange, onSave }; | ||
props = { note, onCancel, onChange, onSave, mentionableUsers }; | ||
}); | ||
|
||
describe('rendering', () => { | ||
|
@@ -56,19 +68,6 @@ describe('<EditableNoteMentions />', () => { | |
|
||
describe('with mentionable users', () => { | ||
it('should show mentionable user dropdown on @ trigger', async () => { | ||
const mentionableUsers = [ | ||
{ | ||
key: 'John Doe', | ||
value: 'John.Doe', | ||
email: '[email protected]', | ||
}, | ||
{ | ||
key: 'Mike Smith', | ||
value: 'Mike.Smith', | ||
email: '[email protected]', | ||
}, | ||
]; | ||
props.mentionableUsers = mentionableUsers; | ||
props.note = 'Hey '; | ||
render(<EditableNoteMentions {...props} />); | ||
|
||
|
@@ -218,5 +217,23 @@ describe('<EditableNoteMentions />', () => { | |
assert.equal(note, header.props().note); | ||
}); | ||
}); | ||
|
||
describe('if showMentionsEditNotificationWarning is true', () => { | ||
const warningText = "Notifications aren't sent to mentioned users when notes are edited"; | ||
|
||
it('should render a warning if a user is mentioned', () => { | ||
props.note.text = 'Hello @John.Doe What is up?'; | ||
render(<EditableNoteMentions {...props} showMentionsEditNotificationWarning />); | ||
|
||
expect(screen.getByText(warningText)).toBeTruthy(); | ||
}); | ||
|
||
it('should not render a warning if no users are mentioned', () => { | ||
props.note.text = 'Hello World!'; | ||
render(<EditableNoteMentions {...props} showMentionsEditNotificationWarning />); | ||
|
||
expect(screen.queryByText(warningText)).toBeNull(); | ||
}); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters