-
Notifications
You must be signed in to change notification settings - Fork 2
/
index.test.js
32 lines (23 loc) · 1.08 KB
/
index.test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import classes from './index.js';
const IS_WRAPPER_VISIBLE_FALSE = false;
const IS_WRAPPER_VISIBLE_TRUE = true;
const STYLE = {wrapper: 'wrapper'};
const STYLE_MODAL = {modal: 'modal'};
describe("Test react-style-classes function", () => {
test('Test with boolean value FALSE', () => {
const styles = classes('container', IS_WRAPPER_VISIBLE_FALSE && STYLE.wrapper);
expect(styles === 'container').toBeTruthy();
});
test('Test with boolean value TRUE', () => {
const styles = classes('container', IS_WRAPPER_VISIBLE_TRUE && STYLE.wrapper);
expect(styles === 'container wrapper').toBeTruthy();
});
test('Combinated values test', () => {
const styles = classes('container', IS_WRAPPER_VISIBLE_TRUE && STYLE.wrapper, STYLE_MODAL.modal);
expect(styles === 'container wrapper modal').toBeTruthy();
});
test('combine string and array classnames', () => {
const styles = classes('container', ["containerFixed", "containerFixed"]);
expect(styles === 'container containerFixed containerFixed').toBeTruthy();
});
});