mirror of
https://github.com/tenrok/OverlayScrollbars.git
synced 2026-06-18 04:20:35 +03:00
create puppeteer setup
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
describe('Google', () => {
|
||||
beforeAll(async () => {
|
||||
await page.goto('https://google.com');
|
||||
});
|
||||
|
||||
it('should be titled "Google"', async () => {
|
||||
await expect(page.title()).resolves.toMatch('Google');
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,4 @@
|
||||
import { Environment } from 'environment';
|
||||
|
||||
// eslint-disable-next-line
|
||||
console.log(new Environment());
|
||||
+13
-12
@@ -54,9 +54,6 @@ const addClass = (elm, className) => {
|
||||
classListAction(elm, className, (classList, clazz) => classList.add(clazz));
|
||||
};
|
||||
|
||||
const hasOwnProperty = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop);
|
||||
const keys = (obj) => (obj ? Object.keys(obj) : []);
|
||||
|
||||
function each(source, callback) {
|
||||
if (isArrayLike(source)) {
|
||||
for (let i = 0; i < source.length; i++) {
|
||||
@@ -65,7 +62,7 @@ function each(source, callback) {
|
||||
}
|
||||
}
|
||||
} else if (source) {
|
||||
each(keys(source), (key) => callback(source[key], key, source));
|
||||
each(Object.keys(source), (key) => callback(source[key], key, source));
|
||||
}
|
||||
|
||||
return source;
|
||||
@@ -83,6 +80,7 @@ const from = (arr) => {
|
||||
};
|
||||
|
||||
const contents = (elm) => (elm ? from(elm.childNodes) : []);
|
||||
const parent = (elm) => (elm ? elm.parentElement : null);
|
||||
|
||||
const before = (parentElm, preferredAnchor, insertedElms) => {
|
||||
if (insertedElms) {
|
||||
@@ -123,10 +121,10 @@ const removeElements = (nodes) => {
|
||||
if (isArrayLike(nodes)) {
|
||||
each(from(nodes), (e) => removeElements(e));
|
||||
} else if (nodes) {
|
||||
const { parentNode } = nodes;
|
||||
const parentElm = parent(nodes);
|
||||
|
||||
if (parentNode) {
|
||||
parentNode.removeChild(nodes);
|
||||
if (parentElm) {
|
||||
parentElm.removeChild(nodes);
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -162,6 +160,9 @@ const clientSize = (elm) =>
|
||||
: zeroObj;
|
||||
const getBoundingClientRect = (elm) => elm.getBoundingClientRect();
|
||||
|
||||
const hasOwnProperty = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop);
|
||||
const keys = (obj) => (obj ? Object.keys(obj) : []);
|
||||
|
||||
const cssNumber = {
|
||||
animationiterationcount: 1,
|
||||
columncount: 1,
|
||||
@@ -217,7 +218,7 @@ const zeroObj$1 = {
|
||||
x: 0,
|
||||
y: 0,
|
||||
};
|
||||
const offset = (elm) => {
|
||||
const absoluteCoordinates = (elm) => {
|
||||
const rect = elm ? getBoundingClientRect(elm) : 0;
|
||||
return rect
|
||||
? {
|
||||
@@ -364,10 +365,10 @@ const rtlScrollBehavior = (parentElm, childElm) => {
|
||||
overflowY: strHidden,
|
||||
});
|
||||
scrollLeft(parentElm, 0);
|
||||
const parentOffset = offset(parentElm);
|
||||
const childOffset = offset(childElm);
|
||||
const parentOffset = absoluteCoordinates(parentElm);
|
||||
const childOffset = absoluteCoordinates(childElm);
|
||||
scrollLeft(parentElm, -999);
|
||||
const childOffsetAfterScroll = offset(childElm);
|
||||
const childOffsetAfterScroll = absoluteCoordinates(childElm);
|
||||
return {
|
||||
i: parentOffset.x === childOffset.x,
|
||||
n: childOffset.x !== childOffsetAfterScroll.x,
|
||||
@@ -436,7 +437,7 @@ class Environment {
|
||||
removeAttr(envElm, 'style');
|
||||
removeElements(envElm);
|
||||
|
||||
if (nativeScrollbarIsOverlaid.x && nativeScrollbarIsOverlaid.y) {
|
||||
if (!nativeScrollbarIsOverlaid.x || !nativeScrollbarIsOverlaid.y) {
|
||||
let size = windowSize();
|
||||
let dpr = windowDPR();
|
||||
|
||||
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+19
-16
@@ -65,13 +65,6 @@
|
||||
});
|
||||
};
|
||||
|
||||
var hasOwnProperty = function hasOwnProperty(obj, prop) {
|
||||
return Object.prototype.hasOwnProperty.call(obj, prop);
|
||||
};
|
||||
var keys = function keys(obj) {
|
||||
return obj ? Object.keys(obj) : [];
|
||||
};
|
||||
|
||||
function each(source, callback) {
|
||||
if (isArrayLike(source)) {
|
||||
for (var i = 0; i < source.length; i++) {
|
||||
@@ -80,7 +73,7 @@
|
||||
}
|
||||
}
|
||||
} else if (source) {
|
||||
each(keys(source), function (key) {
|
||||
each(Object.keys(source), function (key) {
|
||||
return callback(source[key], key, source);
|
||||
});
|
||||
}
|
||||
@@ -102,6 +95,9 @@
|
||||
var contents = function contents(elm) {
|
||||
return elm ? from(elm.childNodes) : [];
|
||||
};
|
||||
var parent = function parent(elm) {
|
||||
return elm ? elm.parentElement : null;
|
||||
};
|
||||
|
||||
var before = function before(parentElm, preferredAnchor, insertedElms) {
|
||||
if (insertedElms) {
|
||||
@@ -144,10 +140,10 @@
|
||||
return removeElements(e);
|
||||
});
|
||||
} else if (nodes) {
|
||||
var parentNode = nodes.parentNode;
|
||||
var parentElm = parent(nodes);
|
||||
|
||||
if (parentNode) {
|
||||
parentNode.removeChild(nodes);
|
||||
if (parentElm) {
|
||||
parentElm.removeChild(nodes);
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -193,6 +189,13 @@
|
||||
return elm.getBoundingClientRect();
|
||||
};
|
||||
|
||||
var hasOwnProperty = function hasOwnProperty(obj, prop) {
|
||||
return Object.prototype.hasOwnProperty.call(obj, prop);
|
||||
};
|
||||
var keys = function keys(obj) {
|
||||
return obj ? Object.keys(obj) : [];
|
||||
};
|
||||
|
||||
var cssNumber = {
|
||||
animationiterationcount: 1,
|
||||
columncount: 1,
|
||||
@@ -254,7 +257,7 @@
|
||||
x: 0,
|
||||
y: 0,
|
||||
};
|
||||
var offset = function offset(elm) {
|
||||
var absoluteCoordinates = function absoluteCoordinates(elm) {
|
||||
var rect = elm ? getBoundingClientRect(elm) : 0;
|
||||
return rect
|
||||
? {
|
||||
@@ -405,10 +408,10 @@
|
||||
overflowY: strHidden,
|
||||
});
|
||||
scrollLeft(parentElm, 0);
|
||||
var parentOffset = offset(parentElm);
|
||||
var childOffset = offset(childElm);
|
||||
var parentOffset = absoluteCoordinates(parentElm);
|
||||
var childOffset = absoluteCoordinates(childElm);
|
||||
scrollLeft(parentElm, -999);
|
||||
var childOffsetAfterScroll = offset(childElm);
|
||||
var childOffsetAfterScroll = absoluteCoordinates(childElm);
|
||||
return {
|
||||
i: parentOffset.x === childOffset.x,
|
||||
n: childOffset.x !== childOffsetAfterScroll.x,
|
||||
@@ -478,7 +481,7 @@
|
||||
removeAttr(envElm, 'style');
|
||||
removeElements(envElm);
|
||||
|
||||
if (nativeScrollbarIsOverlaid.x && nativeScrollbarIsOverlaid.y) {
|
||||
if (!nativeScrollbarIsOverlaid.x || !nativeScrollbarIsOverlaid.y) {
|
||||
var size = windowSize();
|
||||
var dpr = windowDPR();
|
||||
|
||||
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -3,8 +3,7 @@
|
||||
<head>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<meta name="description" content="Server Syncing API Code Challenge" />
|
||||
<title>Server Syncing API</title>
|
||||
<title>OverlayScrollbars</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import { keys } from 'support/utils/object';
|
||||
import { isArrayLike } from 'support/utils/types';
|
||||
import { PlainObject } from 'typings';
|
||||
|
||||
@@ -38,7 +37,7 @@ export function each<T>(
|
||||
}
|
||||
}
|
||||
} else if (source) {
|
||||
each(keys(source), (key) => callback(source[key], key, source));
|
||||
each(Object.keys(source), (key) => callback(source[key], key, source));
|
||||
}
|
||||
return source;
|
||||
}
|
||||
|
||||
@@ -1 +1,3 @@
|
||||
import { Environment } from 'environment/environment';
|
||||
export * from 'environment/environment';
|
||||
export declare type OSEnvironment = Omit<Environment, 'addListener' | 'removeListener'>;
|
||||
|
||||
@@ -8,4 +8,4 @@ export declare const cssCache: {
|
||||
};
|
||||
export declare const cssProperty: (name: string) => string | undefined;
|
||||
export declare const cssPropertyValue: (property: string, values: string, suffix?: string | undefined) => string | undefined;
|
||||
export declare const jsAPI: (name: string) => any;
|
||||
export declare const jsAPI: <T = any>(name: string) => T | undefined;
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
import { XY } from 'support/dom';
|
||||
export declare const offset: (elm: HTMLElement | null) => XY;
|
||||
export declare const position: (elm: HTMLElement | null) => XY;
|
||||
export declare const absoluteCoordinates: (elm: HTMLElement | null) => XY;
|
||||
export declare const offsetCoordinates: (elm: HTMLElement | null) => XY;
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
export declare function extend<T, U>(target: T, object1: U): T & U;
|
||||
export declare function extend<T, U, V>(target: T, object1: U, object2: V): T & U & V;
|
||||
export declare function extend<T, U, V, W>(target: T, object1: U, object2: V, object3: W): T & U & V & W;
|
||||
export declare function extend<T, U, V, W, X>(target: T, object1: U, object2: V, object3: W, object4: X): T & U & V & W & X;
|
||||
export declare function extend<T, U, V, W, X, Y>(target: T, object1: U, object2: V, object3: W, object4: X, object5: Y): T & U & V & W & X & Y;
|
||||
@@ -1,4 +1,3 @@
|
||||
export * from 'support/utils/array';
|
||||
export * from 'support/utils/object';
|
||||
export * from 'support/utils/extend';
|
||||
export * from 'support/utils/types';
|
||||
|
||||
@@ -1,2 +1,7 @@
|
||||
export declare const hasOwnProperty: (obj: any, prop: string | number | symbol) => boolean;
|
||||
export declare const keys: (obj: any) => Array<string>;
|
||||
export declare function assignDeep<T, U>(target: T, object1: U): T & U;
|
||||
export declare function assignDeep<T, U, V>(target: T, object1: U, object2: V): T & U & V;
|
||||
export declare function assignDeep<T, U, V, W>(target: T, object1: U, object2: V, object3: W): T & U & V & W;
|
||||
export declare function assignDeep<T, U, V, W, X>(target: T, object1: U, object2: V, object3: W, object4: X): T & U & V & W & X;
|
||||
export declare function assignDeep<T, U, V, W, X, Y>(target: T, object1: U, object2: V, object3: W, object4: X, object5: Y): T & U & V & W & X & Y;
|
||||
|
||||
Reference in New Issue
Block a user