-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refs #944
- Loading branch information
Showing
8 changed files
with
82 additions
and
32 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
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 |
---|---|---|
@@ -1,35 +1,40 @@ | ||
import { mount } from 'enzyme'; | ||
import Intro from './Intro'; | ||
import IntlProvider from '../../../../third-party/wrappers/i18n/IntlProvider'; | ||
|
||
describe('Intro component', () => { | ||
|
||
describe('default options', () => { | ||
test('should not exit on esc', () => { | ||
const wrapper = mount( | ||
<Intro | ||
initialStep={0} | ||
steps={[]} | ||
onExit={()=> {}} | ||
/> | ||
<IntlProvider locale="en"> | ||
<Intro | ||
initialStep={0} | ||
steps={[]} | ||
onExit={()=> {}} | ||
/> | ||
</IntlProvider> | ||
); | ||
|
||
const options = wrapper.find('Steps').props('options'); | ||
|
||
expect(options.exitOnEsc).toBeFalsy(); | ||
}); | ||
|
||
test('should not exit on overlay click', () => { | ||
const wrapper = mount( | ||
<Intro | ||
initialStep={0} | ||
steps={[]} | ||
onExit={()=> {}} | ||
/> | ||
<IntlProvider locale="en"> | ||
<Intro | ||
initialStep={0} | ||
steps={[]} | ||
onExit={()=> {}} | ||
/> | ||
</IntlProvider> | ||
); | ||
|
||
const options = wrapper.find('Steps').props('options'); | ||
|
||
expect(options.exitOnOverlayClick).toBeFalsy(); | ||
}); | ||
}); | ||
}); | ||
}); |
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 |
---|---|---|
@@ -1,28 +1,31 @@ | ||
import { Steps } from 'intro.js-react'; | ||
import { useIntl } from 'react-intl'; | ||
import config from '../../../../config'; | ||
|
||
import 'intro.js/introjs.css'; | ||
import './intro.scss'; | ||
|
||
export default function Intro(props) { | ||
const { isDebug } = config; | ||
const { messages }: any = useIntl(); | ||
|
||
return ( | ||
<Steps | ||
{...props} | ||
options={{ | ||
disableInteraction: true, | ||
showStepNumbers: false, | ||
exitOnEsc: isDebug ? true : false, | ||
exitOnEsc: isDebug, | ||
hidePrev: true, | ||
exitOnOverlayClick: isDebug ? true : false, | ||
exitOnOverlayClick: isDebug, | ||
showButtons: true, | ||
showBullets: false, | ||
showProgress: true, | ||
skipLabel: 'Sair', | ||
nextLabel: 'Próximo', | ||
prevLabel: 'Anterior', | ||
doneLabel: 'Estou pronto!' | ||
skipLabel: messages.intro.exit, | ||
nextLabel: messages.intro.next, | ||
prevLabel: messages.intro.previous, | ||
doneLabel: messages.intro.ready | ||
}} | ||
/> | ||
); | ||
} | ||
} |
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
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
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