Skip to content

Commit e3f23f4

Browse files
refactor(ThemeProvider): Rewrite test to use hook instead of HOC (#141)
[ci skip]
1 parent c501c67 commit e3f23f4

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

lerna.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"packages": [
33
"packages/*"
44
],
5-
"version": "0.6.1-rc.0",
5+
"version": "0.6.0-rc.0",
66
"npmClient": "yarn",
77
"useWorkspaces": true,
88
"command": {

packages/main/src/components/ThemeProvider/ThemeProvider.test.tsx

+6-4
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,18 @@
1-
import { withStyles } from '@ui5/webcomponents-react-base/lib/withStyles';
1+
import { ThemeProvider } from '@ui5/webcomponents-react/lib/ThemeProvider';
22
import { mount } from 'enzyme';
33
import React from 'react';
4-
import { ThemeProvider } from '@ui5/webcomponents-react/lib/ThemeProvider';
4+
import { useTheme } from 'react-jss';
5+
import { JSSTheme } from '../../interfaces/JSSTheme';
56

67
describe('ThemeProvider', () => {
78
it('Provides Correct Context', (done) => {
8-
const InnerComponent = withStyles(() => {})(({ theme }) => {
9+
const InnerComponent = () => {
10+
const theme = useTheme() as JSSTheme;
911
expect(theme.theme).toEqual('sap_fiori_3');
1012
expect(theme.contentDensity).toEqual('Cozy');
1113
done();
1214
return null;
13-
});
15+
};
1416

1517
mount(
1618
<ThemeProvider>

0 commit comments

Comments
 (0)