forked from mastodon/mastodon
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add test for AutosuggestEmoji (mastodon#8805)
- Loading branch information
1 parent
e046a98
commit a72a939
Showing
2 changed files
with
56 additions
and
0 deletions.
There are no files selected for viewing
27 changes: 27 additions & 0 deletions
27
app/javascript/mastodon/components/__tests__/__snapshots__/autosuggest_emoji-test.js.snap
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 |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`<AutosuggestEmoji /> renders emoji with custom url 1`] = ` | ||
<div | ||
className="autosuggest-emoji" | ||
> | ||
<img | ||
alt="foobar" | ||
className="emojione" | ||
src="http://example.com/emoji.png" | ||
/> | ||
:foobar: | ||
</div> | ||
`; | ||
|
||
exports[`<AutosuggestEmoji /> renders native emoji 1`] = ` | ||
<div | ||
className="autosuggest-emoji" | ||
> | ||
<img | ||
alt="💙" | ||
className="emojione" | ||
src="/emoji/1f499.svg" | ||
/> | ||
:foobar: | ||
</div> | ||
`; |
29 changes: 29 additions & 0 deletions
29
app/javascript/mastodon/components/__tests__/autosuggest_emoji-test.js
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 |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import React from 'react'; | ||
import renderer from 'react-test-renderer'; | ||
import AutosuggestEmoji from '../autosuggest_emoji'; | ||
|
||
describe('<AutosuggestEmoji />', () => { | ||
it('renders native emoji', () => { | ||
const emoji = { | ||
native: '💙', | ||
colons: ':foobar:', | ||
}; | ||
const component = renderer.create(<AutosuggestEmoji emoji={emoji} />); | ||
const tree = component.toJSON(); | ||
|
||
expect(tree).toMatchSnapshot(); | ||
}); | ||
|
||
it('renders emoji with custom url', () => { | ||
const emoji = { | ||
custom: true, | ||
imageUrl: 'http://example.com/emoji.png', | ||
native: 'foobar', | ||
colons: ':foobar:', | ||
}; | ||
const component = renderer.create(<AutosuggestEmoji emoji={emoji} />); | ||
const tree = component.toJSON(); | ||
|
||
expect(tree).toMatchSnapshot(); | ||
}); | ||
}); |