Skip to content

Commit d459a9e

Browse files
committed
chore: reformat with prettier
1 parent 9891e95 commit d459a9e

File tree

11 files changed

+466
-215
lines changed

11 files changed

+466
-215
lines changed

src/browser/client-scripts/build.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ const bundleScript = async opts => {
2121
{
2222
sourcemap: false,
2323
global: true,
24-
compress: false,// { screw_ie8: false }, // eslint-disable-line camelcase
24+
compress: false, // { screw_ie8: false }, // eslint-disable-line camelcase
2525
mangle: false, // { screw_ie8: false }, // eslint-disable-line camelcase
2626
output: { screw_ie8: false } // eslint-disable-line camelcase
2727
},

src/browser/client-scripts/index.js

Lines changed: 173 additions & 82 deletions
Large diffs are not rendered by default.

src/browser/client-scripts/rect.js

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -162,13 +162,17 @@ exports.getAbsoluteClientRect = function getAbsoluteClientRect(element, opts, lo
162162
height: heightRatio > 0 && heightRatio < 1 ? opts.documentHeight : coords.height
163163
});
164164

165-
logger('getAbsoluteClientRect, client rect: ', clientRect);
165+
logger("getAbsoluteClientRect, client rect: ", clientRect);
166166

167-
var scrollLeft = util.isRootElement(opts.scrollElem) ? util.getScrollLeft(window) : util.getScrollLeft(opts.scrollElem) + util.getScrollLeft(window);
168-
var scrollTop = util.isRootElement(opts.scrollElem) ? util.getScrollTop(window) : util.getScrollTop(opts.scrollElem) + util.getScrollTop(window);
167+
var scrollLeft = util.isRootElement(opts.scrollElem)
168+
? util.getScrollLeft(window)
169+
: util.getScrollLeft(opts.scrollElem) + util.getScrollLeft(window);
170+
var scrollTop = util.isRootElement(opts.scrollElem)
171+
? util.getScrollTop(window)
172+
: util.getScrollTop(opts.scrollElem) + util.getScrollTop(window);
169173

170-
logger('getAbsoluteClientRect, is scroll element window? : ', util.isRootElement(opts.scrollElem));
171-
logger('getAbsoluteClientRect, scrollTop: ', scrollTop);
174+
logger("getAbsoluteClientRect, is scroll element window? : ", util.isRootElement(opts.scrollElem));
175+
logger("getAbsoluteClientRect, scrollTop: ", scrollTop);
172176

173177
return clientRect.translate(scrollLeft, scrollTop);
174178
};

src/browser/client-scripts/util.js

Lines changed: 29 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"use strict";
22

3-
var lib = require("./lib")
3+
var lib = require("./lib");
44

55
var SCROLL_DIR_NAME = {
66
top: "scrollTop",
@@ -152,19 +152,19 @@ exports.createDebugLogger = function createDebugLogger(opts) {
152152
try {
153153
log += JSON.stringify(arguments[i], null, 2) + "\n";
154154
} catch (e) {
155-
log += 'failed to log message due to an error: ' + e;
155+
log += "failed to log message due to an error: " + e;
156156
}
157157
} else {
158158
log += arguments[i] + "\n";
159159
}
160160
}
161161

162162
return log;
163-
}
163+
};
164164
}
165165

166166
return function () {};
167-
}
167+
};
168168

169169
function getParentNode(node) {
170170
if (!node) return null;
@@ -174,7 +174,7 @@ function getParentNode(node) {
174174
return node.parentElement || (root instanceof ShadowRoot ? root.host : null);
175175
}
176176
return node.parentNode; // for Text/Comment nodes
177-
};
177+
}
178178

179179
exports.getScrollParent = function getScrollParent(element, logger) {
180180
if (element === null) {
@@ -192,46 +192,55 @@ exports.getScrollParent = function getScrollParent(element, logger) {
192192
return getScrollParent(getParentNode(element), logger);
193193
}
194194

195-
var canBeScrolled = computedStyleOverflowY === 'auto' || computedStyleOverflowY === 'scroll' || computedStyleOverflowY === 'overlay';
195+
var canBeScrolled =
196+
computedStyleOverflowY === "auto" ||
197+
computedStyleOverflowY === "scroll" ||
198+
computedStyleOverflowY === "overlay";
196199

197200
if (hasOverflow && canBeScrolled) {
198-
if (element.tagName === 'BODY') {
201+
if (element.tagName === "BODY") {
199202
return window;
200203
}
201204
return element;
202205
} else {
203206
return getScrollParent(getParentNode(element), logger);
204207
}
205-
}
208+
};
206209

207210
exports.isRootElement = function (element) {
208211
return element === window || element.parentElement === null;
209-
}
212+
};
210213

211214
/* Returns an element relative to which given absolutely positioned element is positioned */
212215
exports.findContainingBlock = function findContainingBlock(element) {
213216
var parent = element.parentElement;
214217
while (parent) {
215218
var style = lib.getComputedStyle(parent);
216-
if (["relative", "absolute", "fixed", "sticky"].includes(style.position) || style.transform !== "none" || style.perspective !== "none") {
219+
if (
220+
["relative", "absolute", "fixed", "sticky"].includes(style.position) ||
221+
style.transform !== "none" ||
222+
style.perspective !== "none"
223+
) {
217224
return parent;
218225
}
219226
parent = parent.parentElement;
220227
}
221228
return document.documentElement;
222-
}
229+
};
223230

224231
function _isCreatingStackingContext(computedStyle) {
225232
var position = computedStyle.position;
226233
var zIndexStr = computedStyle.zIndex;
227234

228-
return (position !== 'static' && zIndexStr !== 'auto') ||
235+
return (
236+
(position !== "static" && zIndexStr !== "auto") ||
229237
parseFloat(computedStyle.opacity) < 1 ||
230-
computedStyle.transform !== 'none' ||
231-
computedStyle.filter !== 'none' ||
232-
computedStyle.perspective !== 'none' ||
233-
position === 'fixed' ||
234-
position === 'sticky';
238+
computedStyle.transform !== "none" ||
239+
computedStyle.filter !== "none" ||
240+
computedStyle.perspective !== "none" ||
241+
position === "fixed" ||
242+
position === "sticky"
243+
);
235244
}
236245

237246
function _getStackingContextRoot(element) {
@@ -257,7 +266,7 @@ function _getEffectiveZIndex(element) {
257266
var zIndexStr = style.zIndex;
258267
var createsStackingContext = _isCreatingStackingContext(style);
259268

260-
if (zIndexStr !== 'auto') {
269+
if (zIndexStr !== "auto") {
261270
var num = parseFloat(zIndexStr);
262271

263272
return isNaN(num) ? 0 : num;
@@ -291,7 +300,7 @@ exports.buildZChain = function buildZChain(element) {
291300
}
292301

293302
return chain;
294-
}
303+
};
295304

296305
exports.isChainBehind = function isChainBehind(candChain, targetChain) {
297306
// Algorithm:
@@ -307,4 +316,4 @@ exports.isChainBehind = function isChainBehind(candChain, targetChain) {
307316
}
308317

309318
return false;
310-
}
319+
};

src/browser/commands/assert-view/index.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ const RuntimeConfig = require("../../../config/runtime-config");
1212
const AssertViewResults = require("./assert-view-results");
1313
const { BaseStateError } = require("./errors/base-state-error");
1414
const { AssertViewError } = require("./errors/assert-view-error");
15-
const { assertCorrectCaptureAreaBounds } = require("../../screen-shooter/validation");
1615

1716
const makeDebug = require("debug");
1817
const debug = makeDebug("testplane:screenshots:assert-view");
@@ -59,8 +58,12 @@ module.exports.default = browser => {
5958
const test = session.executionContext.ctx.currentTest;
6059
testplaneCtx.assertViewResults = testplaneCtx.assertViewResults || AssertViewResults.create();
6160

62-
let debugId = 'debugId';
63-
try { debugId = `${test.fullTitle()}.${browser.id}.${state}`; } catch { /**/ }
61+
let debugId = "debugId";
62+
try {
63+
debugId = `${test.fullTitle()}.${browser.id}.${state}`;
64+
} catch {
65+
/**/
66+
}
6467
debug(`[${debugId}] assertView selectors: %O`, selectors);
6568
debug(`[${debugId}] assertView opts: %O`, opts);
6669

@@ -74,7 +77,7 @@ module.exports.default = browser => {
7477
const { tempOpts } = RuntimeConfig.getInstance();
7578
temp.attach(tempOpts);
7679

77-
const {image: currImgInst, meta: currImgMeta} = await screenShooter
80+
const { image: currImgInst, meta: currImgMeta } = await screenShooter
7881
.capture(selectors, opts)
7982
.finally(() => browser.cleanupScreenshot(opts));
8083
const currSize = await currImgInst.getSize();

0 commit comments

Comments
 (0)