scriptable-testlab
Version:
A lightweight, efficient tool designed to manage and update scripts for Scriptable.
103 lines • 3.18 kB
JavaScript
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
var config_exports = {};
__export(config_exports, {
MockConfig: () => MockConfig
});
module.exports = __toCommonJS(config_exports);
var import_scriptable_abstract = require("scriptable-abstract");
const DEFAULT_STATE = {
widgetFamily: "small",
runsInWidget: false,
runsInApp: true,
runsWithSiri: false,
runsInActionExtension: false,
runsInNotification: false,
runsFromHomeScreen: false,
runsInAccessoryWidget: false
};
class MockConfig extends import_scriptable_abstract.AbsConfig {
static get instance() {
return super.instance;
}
static reset() {
if (this._instance) {
this._instance.setState(DEFAULT_STATE);
}
}
constructor() {
super(DEFAULT_STATE);
}
get widgetFamily() {
return this.state.widgetFamily;
}
get runsInWidget() {
return this.state.runsInWidget;
}
get runsInApp() {
return this.state.runsInApp;
}
get runsWithSiri() {
return this.state.runsWithSiri;
}
get runsInActionExtension() {
return this.state.runsInActionExtension;
}
get runsInNotification() {
return this.state.runsInNotification;
}
get runsFromHomeScreen() {
return this.state.runsFromHomeScreen;
}
get runsInAccessoryWidget() {
return this.state.runsInAccessoryWidget;
}
// Testing helpers
setWidgetFamily(family) {
this.setState({ widgetFamily: family });
}
setRunsInWidget(value) {
this.setState({ runsInWidget: value });
}
setRunsInApp(value) {
this.setState({ runsInApp: value });
}
setRunsWithSiri(value) {
this.setState({ runsWithSiri: value });
}
setRunsInActionExtension(value) {
this.setState({ runsInActionExtension: value });
}
setRunsInNotification(value) {
this.setState({ runsInNotification: value });
}
setRunsFromHomeScreen(value) {
this.setState({ runsFromHomeScreen: value });
}
setRunsInAccessoryWidget(value) {
this.setState({ runsInAccessoryWidget: value });
}
}
__publicField(MockConfig, "_instance");
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
MockConfig
});
//# sourceMappingURL=config.js.map