kempo-ui 0.0.35 → 0.0.37
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/ThemeSwitcher.js +2 -2
- package/dist/utils/context.js +1 -0
- package/dist/utils/theme.js +1 -0
- package/docs/components/theme-switcher.html +18 -6
- package/docs/index.html +18 -6
- package/docs/nav-1.inc.html +2 -0
- package/docs/nav.inc.html +2 -0
- package/docs/src/components/ThemeSwitcher.js +2 -2
- package/docs/src/utils/context.js +1 -0
- package/docs/src/utils/theme.js +1 -0
- package/docs/utils/context.html +160 -0
- package/docs/utils/theme.html +153 -0
- package/package.json +2 -2
- package/src/components/Table.js +2 -1
- package/src/components/ThemeSwitcher.js +17 -30
- package/src/components/tableControls/PageSelect.js +20 -28
- package/src/utils/context.js +40 -0
- package/src/utils/theme.js +50 -0
- package/tests/components/Accordion.browser-test.js +470 -0
- package/tests/components/Card.browser-test.js +286 -0
- package/tests/components/ColorPicker.browser-test.js +658 -0
- package/tests/components/ContentSlider.browser-test.js +495 -0
- package/tests/components/Dialog.browser-test.js +677 -0
- package/tests/components/FocusCapture.browser-test.js +187 -0
- package/tests/components/HybridComponent.browser-test.js +1 -1
- package/tests/components/Icon.browser-test.js +355 -0
- package/tests/components/Import.browser-test.js +312 -0
- package/tests/components/PhotoViewer.browser-test.js +640 -0
- package/tests/components/Resize.browser-test.js +553 -0
- package/tests/components/ShadowComponent.browser-test.js +3 -3
- package/tests/components/ShowMore.browser-test.js +618 -0
- package/tests/components/SideMenu.browser-test.js +667 -0
- package/tests/components/Sortable.browser-test.js +650 -0
- package/tests/components/Split.browser-test.js +629 -0
- package/tests/components/Table.browser-test.js +1119 -0
- package/tests/components/Tabs.browser-test.js +847 -0
- package/tests/components/Tags.browser-test.js +604 -0
- package/tests/components/ThemeSwitcher.browser-test.js +413 -0
- package/tests/components/Timestamp.browser-test.js +509 -0
- package/tests/components/Toast.browser-test.js +616 -0
- package/tests/components/Toggle.browser-test.js +557 -0
- package/tests/components/Tree.browser-test.js +790 -0
- package/tests/components/tableControls/ExportControls.browser-test.js +307 -0
- package/tests/components/tableControls/FieldSortHide.browser-test.js +347 -0
- package/tests/components/tableControls/Filters.browser-test.js +376 -0
- package/tests/components/tableControls/HiddenCount.browser-test.js +263 -0
- package/tests/components/tableControls/PaginationControls.browser-test.js +514 -0
- package/tests/components/tableControls/RecordControls.browser-test.js +360 -0
- package/tests/components/tableControls/Search.browser-test.js +283 -0
- package/tests/components/tableControls/TableControl.browser-test.js +300 -0
- package/tests/utils/context.test.js +224 -0
- package/tests/utils/cookie.browser-test.js +146 -0
- package/tests/utils/drag.browser-test.js +285 -0
- package/tests/utils/formatTimestamp.test.js +224 -0
- package/tests/utils/object.browser-test.js +378 -0
- package/tests/utils/propConverters.test.js +207 -0
- package/tests/utils/string.test.js +379 -0
- package/tests/utils/theme.browser-test.js +177 -0
- package/tests/utils/type.test.js +211 -0
- package/tests/utils/wait.browser-test.js +19 -0
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
import { typeOf, isType } from '../../src/utils/type.js';
|
|
2
|
+
import typeDefault from '../../src/utils/type.js';
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
'should export typeOf function': ({pass, fail}) => {
|
|
6
|
+
if(typeof typeOf === 'function'){
|
|
7
|
+
pass('typeOf exported correctly');
|
|
8
|
+
} else {
|
|
9
|
+
fail(`Expected function, got ${typeof typeOf}`);
|
|
10
|
+
}
|
|
11
|
+
},
|
|
12
|
+
|
|
13
|
+
'should export isType function': ({pass, fail}) => {
|
|
14
|
+
if(typeof isType === 'function'){
|
|
15
|
+
pass('isType exported correctly');
|
|
16
|
+
} else {
|
|
17
|
+
fail(`Expected function, got ${typeof isType}`);
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
|
|
21
|
+
'should export default object with methods': ({pass, fail}) => {
|
|
22
|
+
if(typeof typeDefault.typeOf === 'function' &&
|
|
23
|
+
typeof typeDefault.isType === 'function'){
|
|
24
|
+
pass('Default export contains all methods');
|
|
25
|
+
} else {
|
|
26
|
+
fail('Default export missing methods');
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
|
|
30
|
+
'typeOf should return "null" for null': ({pass, fail}) => {
|
|
31
|
+
const result = typeOf(null);
|
|
32
|
+
if(result === 'null'){
|
|
33
|
+
pass('null detected correctly');
|
|
34
|
+
} else {
|
|
35
|
+
fail(`Expected 'null', got '${result}'`);
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
|
|
39
|
+
'typeOf should return "array" for arrays': ({pass, fail}) => {
|
|
40
|
+
const result = typeOf([1, 2, 3]);
|
|
41
|
+
if(result === 'array'){
|
|
42
|
+
pass('array detected correctly');
|
|
43
|
+
} else {
|
|
44
|
+
fail(`Expected 'array', got '${result}'`);
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
|
|
48
|
+
'typeOf should return "array" for empty array': ({pass, fail}) => {
|
|
49
|
+
const result = typeOf([]);
|
|
50
|
+
if(result === 'array'){
|
|
51
|
+
pass('empty array detected correctly');
|
|
52
|
+
} else {
|
|
53
|
+
fail(`Expected 'array', got '${result}'`);
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
|
|
57
|
+
'typeOf should return "string" for strings': ({pass, fail}) => {
|
|
58
|
+
const result = typeOf('hello');
|
|
59
|
+
if(result === 'string'){
|
|
60
|
+
pass('string detected correctly');
|
|
61
|
+
} else {
|
|
62
|
+
fail(`Expected 'string', got '${result}'`);
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
|
|
66
|
+
'typeOf should return "number" for numbers': ({pass, fail}) => {
|
|
67
|
+
const result = typeOf(42);
|
|
68
|
+
if(result === 'number'){
|
|
69
|
+
pass('number detected correctly');
|
|
70
|
+
} else {
|
|
71
|
+
fail(`Expected 'number', got '${result}'`);
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
|
|
75
|
+
'typeOf should return "number" for NaN': ({pass, fail}) => {
|
|
76
|
+
const result = typeOf(NaN);
|
|
77
|
+
if(result === 'number'){
|
|
78
|
+
pass('NaN detected as number');
|
|
79
|
+
} else {
|
|
80
|
+
fail(`Expected 'number', got '${result}'`);
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
|
|
84
|
+
'typeOf should return "boolean" for booleans': ({pass, fail}) => {
|
|
85
|
+
if(typeOf(true) === 'boolean' && typeOf(false) === 'boolean'){
|
|
86
|
+
pass('boolean detected correctly');
|
|
87
|
+
} else {
|
|
88
|
+
fail('boolean not detected correctly');
|
|
89
|
+
}
|
|
90
|
+
},
|
|
91
|
+
|
|
92
|
+
'typeOf should return "undefined" for undefined': ({pass, fail}) => {
|
|
93
|
+
const result = typeOf(undefined);
|
|
94
|
+
if(result === 'undefined'){
|
|
95
|
+
pass('undefined detected correctly');
|
|
96
|
+
} else {
|
|
97
|
+
fail(`Expected 'undefined', got '${result}'`);
|
|
98
|
+
}
|
|
99
|
+
},
|
|
100
|
+
|
|
101
|
+
'typeOf should return "function" for functions': ({pass, fail}) => {
|
|
102
|
+
const result = typeOf(() => {});
|
|
103
|
+
if(result === 'function'){
|
|
104
|
+
pass('function detected correctly');
|
|
105
|
+
} else {
|
|
106
|
+
fail(`Expected 'function', got '${result}'`);
|
|
107
|
+
}
|
|
108
|
+
},
|
|
109
|
+
|
|
110
|
+
'typeOf should return "function" for arrow functions': ({pass, fail}) => {
|
|
111
|
+
const fn = x => x;
|
|
112
|
+
const result = typeOf(fn);
|
|
113
|
+
if(result === 'function'){
|
|
114
|
+
pass('arrow function detected correctly');
|
|
115
|
+
} else {
|
|
116
|
+
fail(`Expected 'function', got '${result}'`);
|
|
117
|
+
}
|
|
118
|
+
},
|
|
119
|
+
|
|
120
|
+
'typeOf should return "object" for plain objects': ({pass, fail}) => {
|
|
121
|
+
const result = typeOf({a: 1});
|
|
122
|
+
if(result === 'object'){
|
|
123
|
+
pass('object detected correctly');
|
|
124
|
+
} else {
|
|
125
|
+
fail(`Expected 'object', got '${result}'`);
|
|
126
|
+
}
|
|
127
|
+
},
|
|
128
|
+
|
|
129
|
+
'typeOf should return "object" for empty object': ({pass, fail}) => {
|
|
130
|
+
const result = typeOf({});
|
|
131
|
+
if(result === 'object'){
|
|
132
|
+
pass('empty object detected correctly');
|
|
133
|
+
} else {
|
|
134
|
+
fail(`Expected 'object', got '${result}'`);
|
|
135
|
+
}
|
|
136
|
+
},
|
|
137
|
+
|
|
138
|
+
'typeOf should return "symbol" for symbols': ({pass, fail}) => {
|
|
139
|
+
const result = typeOf(Symbol('test'));
|
|
140
|
+
if(result === 'symbol'){
|
|
141
|
+
pass('symbol detected correctly');
|
|
142
|
+
} else {
|
|
143
|
+
fail(`Expected 'symbol', got '${result}'`);
|
|
144
|
+
}
|
|
145
|
+
},
|
|
146
|
+
|
|
147
|
+
'typeOf should return "bigint" for BigInt': ({pass, fail}) => {
|
|
148
|
+
const result = typeOf(BigInt(123));
|
|
149
|
+
if(result === 'bigint'){
|
|
150
|
+
pass('bigint detected correctly');
|
|
151
|
+
} else {
|
|
152
|
+
fail(`Expected 'bigint', got '${result}'`);
|
|
153
|
+
}
|
|
154
|
+
},
|
|
155
|
+
|
|
156
|
+
'isType should return true for matching type': ({pass, fail}) => {
|
|
157
|
+
if(isType('hello', 'string')){
|
|
158
|
+
pass('isType returns true for matching type');
|
|
159
|
+
} else {
|
|
160
|
+
fail('isType should return true for matching type');
|
|
161
|
+
}
|
|
162
|
+
},
|
|
163
|
+
|
|
164
|
+
'isType should return false for non-matching type': ({pass, fail}) => {
|
|
165
|
+
if(!isType('hello', 'number')){
|
|
166
|
+
pass('isType returns false for non-matching type');
|
|
167
|
+
} else {
|
|
168
|
+
fail('isType should return false for non-matching type');
|
|
169
|
+
}
|
|
170
|
+
},
|
|
171
|
+
|
|
172
|
+
'isType should work with null': ({pass, fail}) => {
|
|
173
|
+
if(isType(null, 'null')){
|
|
174
|
+
pass('isType works with null');
|
|
175
|
+
} else {
|
|
176
|
+
fail('isType should work with null');
|
|
177
|
+
}
|
|
178
|
+
},
|
|
179
|
+
|
|
180
|
+
'isType should work with array': ({pass, fail}) => {
|
|
181
|
+
if(isType([1, 2], 'array')){
|
|
182
|
+
pass('isType works with array');
|
|
183
|
+
} else {
|
|
184
|
+
fail('isType should work with array');
|
|
185
|
+
}
|
|
186
|
+
},
|
|
187
|
+
|
|
188
|
+
'isType should work with object': ({pass, fail}) => {
|
|
189
|
+
if(isType({}, 'object')){
|
|
190
|
+
pass('isType works with object');
|
|
191
|
+
} else {
|
|
192
|
+
fail('isType should work with object');
|
|
193
|
+
}
|
|
194
|
+
},
|
|
195
|
+
|
|
196
|
+
'isType should distinguish array from object': ({pass, fail}) => {
|
|
197
|
+
if(!isType([], 'object') && isType([], 'array')){
|
|
198
|
+
pass('isType distinguishes array from object');
|
|
199
|
+
} else {
|
|
200
|
+
fail('isType should distinguish array from object');
|
|
201
|
+
}
|
|
202
|
+
},
|
|
203
|
+
|
|
204
|
+
'isType should distinguish null from object': ({pass, fail}) => {
|
|
205
|
+
if(!isType(null, 'object') && isType(null, 'null')){
|
|
206
|
+
pass('isType distinguishes null from object');
|
|
207
|
+
} else {
|
|
208
|
+
fail('isType should distinguish null from object');
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Note: The wait.js module appears to have issues:
|
|
3
|
+
- Uses 'new Timeout' instead of 'setTimeout'
|
|
4
|
+
- Function name 'waitFrmaes' is misspelled
|
|
5
|
+
- No exports are defined
|
|
6
|
+
These tests document the expected behavior once the module is fixed.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
export default {
|
|
10
|
+
'wait.js module needs to be fixed - missing exports': ({pass, fail, log}) => {
|
|
11
|
+
log('The wait.js module currently has no exports.');
|
|
12
|
+
log('Expected exports: wait, waitFrames');
|
|
13
|
+
log('Issues found:');
|
|
14
|
+
log(' - "new Timeout(resolve, ms)" should be "setTimeout(resolve, ms)"');
|
|
15
|
+
log(' - "waitFrmaes" should be "waitFrames"');
|
|
16
|
+
log(' - No export statements');
|
|
17
|
+
pass('Documented issues with wait.js module');
|
|
18
|
+
}
|
|
19
|
+
};
|