Join our webinar on Wednesday, June 26, at 1pm EDTHow Chia Mitigates Risk in the Crypto Industry.Register
Socket
Socket
Sign inDemoInstall

@desk-framework/frame-test

Package Overview
Dependencies
2
Maintainers
1
Versions
29
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 4.0.0-dev.28 to 4.0.0-dev.29

dist/app/TestNavigationContext.d.ts

8

.test-run/tests/app.js

@@ -1,2 +0,2 @@

import { Activity, StringConvertible, ViewComposite, app, bound, ui, } from "@desk-framework/frame-core";
import { $activity, $view, Activity, StringConvertible, ViewComposite, app, ui, } from "@desk-framework/frame-core";
import { describe, expect, test, useTestContext } from "../../dist/index.js";

@@ -6,3 +6,3 @@ // ... from "@desk-framework/frame-test"

createView() {
return new (ui.page(ui.cell(ui.textField({ value: bound("count"), onInput: "SetCount" }), ui.button("+", "CountUp"))))();
return new (ui.page(ui.cell(ui.textField({ value: $activity.string("count"), onInput: "SetCount" }), ui.button("+", "CountUp"))))();
}

@@ -29,3 +29,3 @@ navigationPageId = "count";

test("Single view is rendered", async (t) => {
const MyView = ViewComposite.define({ title: StringConvertible.EMPTY }, ui.label(bound("title")));
const MyView = ViewComposite.define({ title: StringConvertible.EMPTY }, ui.label($view.bind("title")));
let Preset = ui.use(MyView, { title: "TEST" });

@@ -41,3 +41,3 @@ let myView = new Preset();

// initial path should be set directly
expect(app.activities.navigationController.pageId).toBe("count");
expect(app.navigation.pageId).toBe("count");
// setting another path takes some time

@@ -44,0 +44,0 @@ app.navigate("/another/path/here");

import { ActivityContext, ConfigOptions, GlobalContext } from "@desk-framework/frame-core";
import { TestNavigationController } from "./TestNavigationController.js";
import { TestNavigationContext } from "./TestNavigationContext.js";
import { TestRenderer } from "../renderer/TestRenderer.js";

@@ -7,5 +7,4 @@ /** Type definition for the global {@link app} context with test-specific render and activity contexts, set by the {@link useTestContext} function */

renderer: TestRenderer;
activities: ActivityContext & {
navigationController: TestNavigationController;
};
activities: ActivityContext;
navigation: TestNavigationContext;
};

@@ -12,0 +11,0 @@ /**

import { ConfigOptions, app, } from "@desk-framework/frame-core";
import { TestScope } from "../TestScope.js";
import { TestTheme } from "../style/TestTheme.js";
import { TestNavigationController } from "./TestNavigationController.js";
import { TestNavigationContext } from "./TestNavigationContext.js";
import { TestRenderer } from "../renderer/TestRenderer.js";

@@ -62,4 +62,4 @@ import { TestViewportContext } from "./TestViewportContext.js";

// create test navigation path and set initial path
app.activities.navigationController = new TestNavigationController(options);
app.navigation = new TestNavigationContext(options);
return app;
}
import { ManagedObject } from "@desk-framework/frame-core";
// TODO(feature): make this do something interesting, use options to set w/h
// TODO(feature): make this do something interesting, use options to set grid
/** @internal */

@@ -8,9 +8,13 @@ export class TestViewportContext extends ManagedObject {

portrait = false;
narrow = false;
wide = false;
short = false;
tall = false;
setBreakpoints() {
col2 = false;
col3 = false;
col4 = false;
col5 = false;
row2 = false;
row3 = false;
row4 = false;
row5 = false;
setGridSize(colSize, rowSize) {
// do nothing
}
}

@@ -359,4 +359,4 @@ import { val2str } from "./log.js";

}
catch {
return new Assertion(undefined, "[function threw error async]");
catch (err) {
return new Assertion(err, "[Caught error async]");
}

@@ -363,0 +363,0 @@ throw Error(msg[10 /* ASSERT.toThrowError */](this.name + " (async)"));

@@ -6,3 +6,3 @@ import { Assertion, NegatedAssertion } from "./Assertion.js";

export { Assertion, NegatedAssertion, TestCase, TestScope, TestResult, TestResultsData, };
export * from "./app/TestNavigationController.js";
export * from "./app/TestNavigationContext.js";
export * from "./app/OutputAssertion.js";

@@ -9,0 +9,0 @@ export * from "./app/TestOutputElement.js";

@@ -5,3 +5,3 @@ import { Assertion, NegatedAssertion } from "./Assertion.js";

export { Assertion, NegatedAssertion, TestCase, TestScope, };
export * from "./app/TestNavigationController.js";
export * from "./app/TestNavigationContext.js";
export * from "./app/OutputAssertion.js";

@@ -8,0 +8,0 @@ export * from "./app/TestOutputElement.js";

@@ -10,6 +10,6 @@ import { RenderContext, UICell, UIColumn, UIRow, UIScrollContainer, app, } from "@desk-framework/frame-core";

if (observed instanceof UIRow) {
this.observeProperties("height", "align");
this.observeProperties("height", "align", "reverse");
}
if (observed instanceof UIColumn) {
this.observeProperties("width", "align");
this.observeProperties("width", "align", "reverse");
}

@@ -42,2 +42,5 @@ // observe content changes

return;
case "reverse":
this.scheduleUpdate(this.element);
return;
}

@@ -79,3 +82,7 @@ super.propertyChange(property, value);

// NOTE: spacing/separators are ignored here because they can't be tested;
this.contentUpdater.update(container.content);
let reverse = false;
if (container instanceof UIRow || container instanceof UIColumn) {
reverse = container.reverse;
}
this.contentUpdater.update(container.content, reverse);
}

@@ -134,3 +141,3 @@ contentUpdater;

/** Update the output element with output from given list of content views (or current) */
update(content = this.content) {
update(content = this.content, reverse) {
// resolve the current update promise, or create a resolved promise right away

@@ -146,8 +153,8 @@ if (this._updateResolve)

// go through all content items and get their output
let outputs = [];
let elements = [];
if (reverse)
content = [...content].reverse();
for (let it of content) {
let output = this.getItemOutput(it);
if (output && output.element instanceof TestOutputElement) {
outputs.push(output);
elements.push(output.element);

@@ -154,0 +161,0 @@ output.element.parent = this.element;

@@ -1,2 +0,2 @@

import { ViewComposite, app, bound, ui, } from "@desk-framework/frame-core";
import { $view, ViewComposite, app, ui, } from "@desk-framework/frame-core";
/** @internal Limited implementation of a dialog controller */

@@ -11,3 +11,3 @@ export class TestDialog extends ViewComposite {

return new (ui.cell(ui.renderView({
view: bound("dialogView"),
view: $view.bind("dialogView"),
onViewUnlinked: "DialogViewUnlinked",

@@ -14,0 +14,0 @@ })))();

@@ -332,9 +332,6 @@ import { app } from "@desk-framework/frame-core";

async expectNavAsync(timeout, pageId, detail = "") {
await this.pollAsync(() => app.activities.navigationController.pageId === pageId &&
app.activities.navigationController.detail === detail, 5, timeout, () => Error("Expected navigation to " +
await this.pollAsync(() => app.navigation.pageId === pageId && app.navigation.detail === detail, 5, timeout, () => Error("Expected navigation to " +
val2str(pageId + "/" + detail) +
" but location is " +
val2str(app.activities.navigationController.pageId +
"/" +
app.activities.navigationController.detail)));
val2str(app.navigation.pageId + "/" + app.navigation.detail)));
}

@@ -341,0 +338,0 @@ /**

{
"name": "@desk-framework/frame-test",
"version": "4.0.0-dev.28",
"version": "4.0.0-dev.29",
"publishConfig": {

@@ -32,3 +32,3 @@ "tag": "next"

"peerDependencies": {
"@desk-framework/frame-core": "4.0.0-dev.28"
"@desk-framework/frame-core": "4.0.0-dev.29"
},

@@ -35,0 +35,0 @@ "devDependencies": {

@@ -9,3 +9,3 @@ import {

import { TestTheme } from "../style/TestTheme.js";
import { TestNavigationController } from "./TestNavigationController.js";
import { TestNavigationContext } from "./TestNavigationContext.js";
import { TestRenderer } from "../renderer/TestRenderer.js";

@@ -17,5 +17,4 @@ import { TestViewportContext } from "./TestViewportContext.js";

renderer: TestRenderer;
activities: ActivityContext & {
navigationController: TestNavigationController;
};
activities: ActivityContext;
navigation: TestNavigationContext;
};

@@ -87,5 +86,5 @@

// create test navigation path and set initial path
app.activities.navigationController = new TestNavigationController(options);
app.navigation = new TestNavigationContext(options);
return app as TestContext;
}
import { ManagedObject, ViewportContext } from "@desk-framework/frame-core";
// TODO(feature): make this do something interesting, use options to set w/h
// TODO(feature): make this do something interesting, use options to set grid

@@ -13,9 +13,13 @@ /** @internal */

portrait = false;
narrow = false;
wide = false;
short = false;
tall = false;
setBreakpoints() {
col2 = false;
col3 = false;
col4 = false;
col5 = false;
row2 = false;
row3 = false;
row4 = false;
row5 = false;
setGridSize(colSize: number, rowSize: number): void {
// do nothing
}
}

@@ -446,4 +446,4 @@ import { val2str } from "./log.js";

await this.value.apply(undefined, args);
} catch {
return new Assertion(undefined, "[function threw error async]");
} catch (err) {
return new Assertion(err, "[Caught error async]");
}

@@ -450,0 +450,0 @@ throw Error(msg[ASSERT.toThrowError](this.name + " (async)"));

@@ -14,3 +14,3 @@ import { Assertion, NegatedAssertion } from "./Assertion.js";

};
export * from "./app/TestNavigationController.js";
export * from "./app/TestNavigationContext.js";
export * from "./app/OutputAssertion.js";

@@ -17,0 +17,0 @@ export * from "./app/TestOutputElement.js";

@@ -23,6 +23,6 @@ import {

if (observed instanceof UIRow) {
this.observeProperties("height" as any, "align" as any);
this.observeProperties("height" as any, "align" as any, "reverse" as any);
}
if (observed instanceof UIColumn) {
this.observeProperties("width" as any, "align" as any);
this.observeProperties("width" as any, "align" as any, "reverse" as any);
}

@@ -56,2 +56,5 @@

return;
case "reverse":
this.scheduleUpdate(this.element);
return;
}

@@ -95,3 +98,7 @@ super.propertyChange(property, value);

// NOTE: spacing/separators are ignored here because they can't be tested;
this.contentUpdater.update(container.content);
let reverse = false;
if (container instanceof UIRow || container instanceof UIColumn) {
reverse = container.reverse;
}
this.contentUpdater.update(container.content, reverse);
}

@@ -162,3 +169,3 @@

/** Update the output element with output from given list of content views (or current) */
update(content: Iterable<View> = this.content) {
update(content: Iterable<View> = this.content, reverse?: boolean) {
// resolve the current update promise, or create a resolved promise right away

@@ -174,8 +181,7 @@ if (this._updateResolve) this._updateResolve();

// go through all content items and get their output
let outputs: Array<RenderContext.Output> = [];
let elements: TestOutputElement[] = [];
if (reverse) content = [...content].reverse();
for (let it of content) {
let output = this.getItemOutput(it);
if (output && output.element instanceof TestOutputElement) {
outputs.push(output);
elements.push(output.element);

@@ -182,0 +188,0 @@ output.element.parent = this.element;

import {
$view,
RenderContext,

@@ -7,3 +8,2 @@ UITheme,

app,
bound,
ui,

@@ -24,3 +24,3 @@ } from "@desk-framework/frame-core";

ui.renderView({
view: bound("dialogView"),
view: $view.bind("dialogView"),
onViewUnlinked: "DialogViewUnlinked",

@@ -27,0 +27,0 @@ }),

@@ -354,4 +354,3 @@ import { RenderContext, View, app } from "@desk-framework/frame-core";

() =>
app.activities.navigationController.pageId === pageId &&
app.activities.navigationController.detail === detail,
app.navigation.pageId === pageId && app.navigation.detail === detail,
5,

@@ -364,7 +363,3 @@ timeout,

" but location is " +
val2str(
app.activities.navigationController.pageId +
"/" +
app.activities.navigationController.detail,
),
val2str(app.navigation.pageId + "/" + app.navigation.detail),
),

@@ -371,0 +366,0 @@ );

import {
$activity,
$view,
Activity,

@@ -8,3 +10,2 @@ StringConvertible,

app,
bound,
ui,

@@ -19,3 +20,3 @@ } from "@desk-framework/frame-core";

ui.cell(
ui.textField({ value: bound("count"), onInput: "SetCount" }),
ui.textField({ value: $activity.string("count"), onInput: "SetCount" }),
ui.button("+", "CountUp"),

@@ -50,3 +51,3 @@ ),

{ title: StringConvertible.EMPTY },
ui.label(bound("title")),
ui.label($view.bind("title")),
);

@@ -65,3 +66,3 @@ let Preset = ui.use(MyView, { title: "TEST" });

// initial path should be set directly
expect(app.activities.navigationController.pageId).toBe("count");
expect(app.navigation.pageId).toBe("count");

@@ -68,0 +69,0 @@ // setting another path takes some time

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc