[Improvement] add utils test cases (#380)
This commit is contained in:
@@ -19,9 +19,10 @@ export function get(object, path) {
|
||||
|
||||
const camelizeRE = /-(\w)/g;
|
||||
export function camelize(str) {
|
||||
return str.replace(camelizeRE, (_, c) => c ? c.toUpperCase() : '');
|
||||
return str.replace(camelizeRE, (_, c) => c.toUpperCase());
|
||||
}
|
||||
|
||||
export function isAndroid() {
|
||||
/* istanbul ignore next */
|
||||
return isServer ? false : /android/.test(navigator.userAgent.toLowerCase());
|
||||
}
|
||||
|
||||
@@ -5,6 +5,8 @@
|
||||
import { isServer } from './index';
|
||||
|
||||
let prev = Date.now();
|
||||
|
||||
/* istanbul ignore next */
|
||||
function fallback(fn) {
|
||||
const curr = Date.now();
|
||||
const ms = Math.max(0, 16 - (curr - prev));
|
||||
@@ -13,11 +15,16 @@ function fallback(fn) {
|
||||
return id;
|
||||
}
|
||||
|
||||
/* istanbul ignore next */
|
||||
const global = isServer ? global : window;
|
||||
|
||||
/* istanbul ignore next */
|
||||
const iRaf =
|
||||
global.requestAnimationFrame ||
|
||||
global.webkitRequestAnimationFrame ||
|
||||
fallback;
|
||||
|
||||
/* istanbul ignore next */
|
||||
const iCancel =
|
||||
global.cancelAnimationFrame ||
|
||||
global.webkitCancelAnimationFrame ||
|
||||
|
||||
Reference in New Issue
Block a user