Add test for AutosuggestEmoji (#8805)
This commit is contained in:
		
				
					committed by
					
						 Eugen Rochko
						Eugen Rochko
					
				
			
			
				
	
			
			
			
						parent
						
							e046a987f6
						
					
				
				
					commit
					a72a939334
				
			| @@ -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> | ||||
| `; | ||||
| @@ -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(); | ||||
|   }); | ||||
| }); | ||||
		Reference in New Issue
	
	Block a user