Innovenergy_trunk/frontend/node_modules/testcafe-browser-tools/lib/api/is-maximized.js

33 lines
3.8 KiB
JavaScript

"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const os_family_1 = __importDefault(require("os-family"));
const os_1 = require("os");
const find_window_1 = __importDefault(require("./find-window"));
const exec_1 = require("../utils/exec");
const binaries_1 = __importDefault(require("../binaries"));
/**
* Checks if the specified browser window is maximized.
* @function
* @async
* @name isMaximized
* @param {string | object} windowDescriptor - The title of the web page opened in the window or a descriptor returned by findWindow.
* @return {boolean} `true` if the browser window is maximized
**/
async function default_1(windowDescriptor) {
var windowDescription = typeof windowDescriptor === 'string' ? await find_window_1.default(windowDescriptor) : windowDescriptor;
if (!windowDescription)
return false;
var commandArguments = void 0;
// TODO: implement for macOS
if (os_family_1.default.win)
commandArguments = [windowDescription.hwnd];
else
return false;
var result = await exec_1.execFile(binaries_1.default.maximize, commandArguments.concat('status'));
return result.replace(os_1.EOL, '').toLowerCase() === 'true';
}
exports.default = default_1;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaXMtbWF4aW1pemVkLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL2FwaS9pcy1tYXhpbWl6ZWQuanMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7QUFBQSwwREFBMkI7QUFDM0IsMkJBQXlCO0FBQ3pCLGdFQUF1QztBQUN2Qyx3Q0FBeUM7QUFDekMsMkRBQW1DO0FBR25DOzs7Ozs7O0lBT0k7QUFDVyxLQUFLLG9CQUFXLGdCQUFnQjtJQUMzQyxJQUFJLGlCQUFpQixHQUFHLE9BQU8sZ0JBQWdCLEtBQUssUUFBUSxDQUFDLENBQUMsQ0FBQyxNQUFNLHFCQUFVLENBQUMsZ0JBQWdCLENBQUMsQ0FBQyxDQUFDLENBQU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