-
Notifications
You must be signed in to change notification settings - Fork 556
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enabled HTML formatting for flashMessages (#1017)
Enabled HTML formatting for flashMessages
- Loading branch information
1 parent
25c3c7c
commit 5e75710
Showing
4 changed files
with
65 additions
and
3 deletions.
There are no files selected for viewing
25 changes: 25 additions & 0 deletions
25
src/__tests__/ui/box/__snapshots__/global_message.test.jsx.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,25 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`GlobalMessage renders correctly given a success type 1`] = ` | ||
<div | ||
className="auth0-global-message auth0-global-message-success" | ||
> | ||
<span | ||
className="animated fadeInUp" | ||
> | ||
Success! | ||
</span> | ||
</div> | ||
`; | ||
|
||
exports[`GlobalMessage renders correctly given an error type 1`] = ` | ||
<div | ||
className="auth0-global-message auth0-global-message-error" | ||
> | ||
<span | ||
className="animated fadeInUp" | ||
> | ||
An error occurred. | ||
</span> | ||
</div> | ||
`; |
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,32 @@ | ||
import React from 'react'; | ||
import { mount } from 'enzyme'; | ||
|
||
import { expectComponent } from '../../testUtils'; | ||
|
||
import GlobalMessage from 'ui/box/global_message'; | ||
|
||
describe('GlobalMessage', () => { | ||
it('renders correctly given a success type', () => { | ||
expectComponent(<GlobalMessage type="success" message="Success!" />).toMatchSnapshot(); | ||
}); | ||
it('renders correctly given an error type', () => { | ||
expectComponent(<GlobalMessage type="error" message="An error occurred." />).toMatchSnapshot(); | ||
}); | ||
it('should NOT strip out HTML tags if given a React node', () => { | ||
const message = React.createElement('span', { | ||
dangerouslySetInnerHTML: { __html: '<b>Success!</b>' } | ||
}); | ||
const wrapper = mount(<GlobalMessage type="success" message={message} />); | ||
expect(wrapper.html()).toBe( | ||
'<div class="auth0-global-message auth0-global-message-success"><span class="animated fadeInUp">' + | ||
'<span><b>Success!</b></span></span></div>' | ||
); | ||
}); | ||
it('should strip out HTML tags if given a string', () => { | ||
const wrapper = mount(<GlobalMessage type="success" message="<b>Success!</b>" />); | ||
expect(wrapper.html()).toBe( | ||
'<div class="auth0-global-message auth0-global-message-success"><span class="animated fadeInUp">' + | ||
'<b>Success!</b></span></div>' | ||
); | ||
}); | ||
}); |
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