-
-
Notifications
You must be signed in to change notification settings - Fork 135
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
TASK: Move
<I18n/>
-component into separate module
- Loading branch information
1 parent
cd21e93
commit 8647a23
Showing
6 changed files
with
79 additions
and
44 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 |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/* | ||
* This file is part of the Neos.Neos.Ui package. | ||
* | ||
* (c) Contributors of the Neos Project - www.neos.io | ||
* | ||
* This package is Open Source Software. For the full copyright and license | ||
* information, please view the LICENSE file which was distributed with this | ||
* source code. | ||
*/ | ||
import React from 'react'; | ||
import {mount} from 'enzyme'; | ||
|
||
import {i18nRegistry} from '../registry'; | ||
|
||
import {I18n} from './I18n'; | ||
|
||
describe('<I18n/>', () => { | ||
beforeEach(() => { | ||
jest.spyOn(i18nRegistry, 'translate'); | ||
(jest as any) | ||
.mocked(i18nRegistry.translate) | ||
.mockImplementation((key: string) => { | ||
return key; | ||
}); | ||
}); | ||
afterEach(() => { | ||
jest.restoreAllMocks(); | ||
}); | ||
|
||
it(`should render a <span> node.`, () => { | ||
const original = mount(<I18n />); | ||
|
||
expect(original.html()).toBe('<span></span>'); | ||
}); | ||
|
||
it(`should call translation service with key.`, () => { | ||
const original = mount(<I18n id="My key" />); | ||
|
||
expect(original.html()).toBe('<span>My key</span>'); | ||
}); | ||
}); |
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 |
---|---|---|
@@ -0,0 +1,10 @@ | ||
/* | ||
* This file is part of the Neos.Neos.Ui package. | ||
* | ||
* (c) Contributors of the Neos Project - www.neos.io | ||
* | ||
* This package is Open Source Software. For the full copyright and license | ||
* information, please view the LICENSE file which was distributed with this | ||
* source code. | ||
*/ | ||
export {I18n} from './I18n'; |
This file was deleted.
Oops, something went wrong.
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,16 @@ | ||
/* | ||
* This file is part of the Neos.Neos.Ui package. | ||
* | ||
* (c) Contributors of the Neos Project - www.neos.io | ||
* | ||
* This package is Open Source Software. For the full copyright and license | ||
* information, please view the LICENSE file which was distributed with this | ||
* source code. | ||
*/ | ||
export {I18n as default} from './component'; | ||
|
||
export {initializeI18n, setupI18n, teardownI18n} from './global'; | ||
|
||
export type {I18nRegistry} from './registry'; | ||
|
||
export {translate} from './translate'; |