@desk-framework/frame-test
Advanced tools
Comparing version 4.0.0-dev.21 to 4.0.0-dev.22
@@ -28,4 +28,5 @@ import { Activity, StringConvertible, ViewComposite, app, bound, ui, } from "@desk-framework/frame-core"; | ||
test("Single view is rendered", async (t) => { | ||
const MyView = ViewComposite.withPreset({ title: StringConvertible.EMPTY }, ui.label(bound.string("title"))).preset({ title: "TEST" }); | ||
let myView = new MyView(); | ||
const MyView = ViewComposite.define({ title: StringConvertible.EMPTY }, ui.label(bound("title"))); | ||
let Preset = ui.use(MyView, { title: "TEST" }); | ||
let myView = new Preset(); | ||
t.render(myView); | ||
@@ -32,0 +33,0 @@ await t.expectOutputAsync(100, { text: "TEST" }); |
@@ -16,2 +16,4 @@ import { RenderContext } from "@desk-framework/frame-core"; | ||
}; | ||
/** Component name, if any */ | ||
name?: string; | ||
/** True if input has been disabled for a control element */ | ||
@@ -18,0 +20,0 @@ disabled?: boolean; |
@@ -19,2 +19,4 @@ /** Running ID for generated elements */ | ||
output; | ||
/** Component name, if any */ | ||
name; | ||
/** True if input has been disabled for a control element */ | ||
@@ -21,0 +23,0 @@ disabled; |
@@ -170,2 +170,3 @@ import { ManagedEvent, ManagedObject, UIStyle, app, } from "@desk-framework/frame-core"; | ||
let output = (this.output = this.getOutput()); | ||
output.element.name = this.observed.name; | ||
this.element = output.element; | ||
@@ -175,3 +176,3 @@ this.observed.lastRenderOutput = output; | ||
this.element.sendPlatformEvent = (name, data) => { | ||
this.handlePlatformEvent(name, data); | ||
this.handlePlatformEvent(name, { ...data }); | ||
return this.element; | ||
@@ -178,0 +179,0 @@ }; |
@@ -29,2 +29,3 @@ import { RenderContext, ui } from "@desk-framework/frame-core"; | ||
handlePlatformEvent(name, data) { | ||
data.value = this.observed?.value; | ||
super.handlePlatformEvent(name, data); | ||
@@ -35,3 +36,3 @@ let button = this.observed; | ||
!button.isUnlinked() && | ||
button.navigateTo) { | ||
button.navigateTo !== undefined) { | ||
button.emit("Navigate"); | ||
@@ -38,0 +39,0 @@ } |
@@ -10,3 +10,3 @@ import { ui } from "@desk-framework/frame-core"; | ||
// note some properties are handled by container (e.g. padding) | ||
"textDirection", "margin", "borderRadius", "background", "textColor", "opacity", "style"); | ||
"textDirection", "margin", "padding", "borderRadius", "background", "textColor", "opacity", "style"); | ||
} | ||
@@ -19,2 +19,3 @@ propertyChange(property, value) { | ||
case "margin": | ||
case "padding": | ||
case "borderRadius": | ||
@@ -21,0 +22,0 @@ case "background": |
@@ -8,3 +8,3 @@ import { RenderContext, UICell, UIColumn, UIRow, UIScrollContainer, app, } from "@desk-framework/frame-core"; | ||
super(observed); | ||
this.observeProperties("layout", "padding"); | ||
this.observeProperties("layout"); | ||
if (observed instanceof UIRow) { | ||
@@ -36,3 +36,2 @@ this.observeProperties("height", "align"); | ||
case "layout": | ||
case "padding": | ||
case "align": // for rows and columns | ||
@@ -86,3 +85,3 @@ case "height": // for rows | ||
if (container instanceof UIRow) { | ||
styles = [{ height: container.height, padding: container.padding }]; | ||
styles = [{ height: container.height }]; | ||
if (container.align) { | ||
@@ -93,3 +92,3 @@ layout = { ...layout, distribution: container.align }; | ||
else if (container instanceof UIColumn) { | ||
styles = [{ width: container.width, padding: container.padding }]; | ||
styles = [{ width: container.width }]; | ||
if (container.align) { | ||
@@ -100,3 +99,3 @@ layout = { ...layout, gravity: container.align }; | ||
else if (container instanceof UIScrollContainer) { | ||
styles = [{ padding: container.padding }]; | ||
styles = []; | ||
} | ||
@@ -103,0 +102,0 @@ // apply styles |
@@ -32,2 +32,3 @@ import { RenderContext, ui } from "@desk-framework/frame-core"; | ||
} | ||
data.value = this.observed?.value; | ||
super.handlePlatformEvent(name, data); | ||
@@ -34,0 +35,0 @@ } |
@@ -32,2 +32,3 @@ import { RenderContext, ui } from "@desk-framework/frame-core"; | ||
} | ||
data.state = this.observed?.state; | ||
super.handlePlatformEvent(name, data); | ||
@@ -48,3 +49,6 @@ } | ||
element.styleClass = getBaseStyleClass(toggle.style) || ui.style.TOGGLE; | ||
applyElementStyle(element, [toggle.style], toggle.position); | ||
applyElementStyle(element, [ | ||
toggle.style, | ||
toggle.width !== undefined ? { width: toggle.width } : undefined, | ||
], toggle.position); | ||
} | ||
@@ -51,0 +55,0 @@ updateContent(element) { |
{ | ||
"name": "@desk-framework/frame-test", | ||
"version": "4.0.0-dev.21", | ||
"version": "4.0.0-dev.22", | ||
"publishConfig": { | ||
@@ -32,3 +32,3 @@ "tag": "next" | ||
"peerDependencies": { | ||
"@desk-framework/frame-core": "4.0.0-dev.21" | ||
"@desk-framework/frame-core": "4.0.0-dev.22" | ||
}, | ||
@@ -35,0 +35,0 @@ "devDependencies": { |
@@ -28,2 +28,5 @@ import { RenderContext } from "@desk-framework/frame-core"; | ||
/** Component name, if any */ | ||
name?: string; | ||
/** True if input has been disabled for a control element */ | ||
@@ -30,0 +33,0 @@ disabled?: boolean; |
@@ -222,2 +222,3 @@ import { | ||
let output = (this.output = this.getOutput()); | ||
output.element.name = this.observed.name; | ||
this.element = output.element; | ||
@@ -227,3 +228,3 @@ this.observed.lastRenderOutput = output; | ||
this.element.sendPlatformEvent = (name, data) => { | ||
this.handlePlatformEvent(name, data); | ||
this.handlePlatformEvent(name, { ...data }); | ||
return this.element!; | ||
@@ -230,0 +231,0 @@ }; |
@@ -46,2 +46,3 @@ import { RenderContext, UIButton, ui } from "@desk-framework/frame-core"; | ||
) { | ||
data.value = this.observed?.value; | ||
super.handlePlatformEvent(name, data); | ||
@@ -53,3 +54,3 @@ let button = this.observed; | ||
!button.isUnlinked() && | ||
button.navigateTo | ||
button.navigateTo !== undefined | ||
) { | ||
@@ -56,0 +57,0 @@ button.emit("Navigate"); |
@@ -14,2 +14,3 @@ import { UICell, ui } from "@desk-framework/frame-core"; | ||
"margin", | ||
"padding", | ||
"borderRadius", | ||
@@ -28,2 +29,3 @@ "background", | ||
case "margin": | ||
case "padding": | ||
case "borderRadius": | ||
@@ -30,0 +32,0 @@ case "background": |
@@ -21,3 +21,3 @@ import { | ||
super(observed); | ||
this.observeProperties("layout", "padding"); | ||
this.observeProperties("layout"); | ||
if (observed instanceof UIRow) { | ||
@@ -50,3 +50,2 @@ this.observeProperties("height" as any, "align" as any); | ||
case "layout": | ||
case "padding": | ||
case "align": // for rows and columns | ||
@@ -108,3 +107,3 @@ case "height": // for rows | ||
if (container instanceof UIRow) { | ||
styles = [{ height: container.height, padding: container.padding }]; | ||
styles = [{ height: container.height }]; | ||
if (container.align) { | ||
@@ -114,3 +113,3 @@ layout = { ...layout, distribution: container.align }; | ||
} else if (container instanceof UIColumn) { | ||
styles = [{ width: container.width, padding: container.padding }]; | ||
styles = [{ width: container.width }]; | ||
if (container.align) { | ||
@@ -120,3 +119,3 @@ layout = { ...layout, gravity: container.align }; | ||
} else if (container instanceof UIScrollContainer) { | ||
styles = [{ padding: container.padding }]; | ||
styles = []; | ||
} | ||
@@ -123,0 +122,0 @@ |
@@ -49,2 +49,3 @@ import { RenderContext, UITextField, ui } from "@desk-framework/frame-core"; | ||
data.value = this.observed?.value; | ||
super.handlePlatformEvent(name, data); | ||
@@ -64,2 +65,3 @@ } | ||
let textField = this.observed; | ||
// set state | ||
@@ -66,0 +68,0 @@ element.disabled = textField.disabled; |
@@ -42,2 +42,3 @@ import { RenderContext, UIToggle, ui } from "@desk-framework/frame-core"; | ||
data.state = this.observed?.state; | ||
super.handlePlatformEvent(name, data); | ||
@@ -62,3 +63,10 @@ } | ||
element.styleClass = getBaseStyleClass(toggle.style) || ui.style.TOGGLE; | ||
applyElementStyle(element, [toggle.style], toggle.position); | ||
applyElementStyle( | ||
element, | ||
[ | ||
toggle.style, | ||
toggle.width !== undefined ? { width: toggle.width } : undefined, | ||
], | ||
toggle.position, | ||
); | ||
} | ||
@@ -65,0 +73,0 @@ |
@@ -46,7 +46,8 @@ import { | ||
test("Single view is rendered", async (t) => { | ||
const MyView = ViewComposite.withPreset( | ||
const MyView = ViewComposite.define( | ||
{ title: StringConvertible.EMPTY }, | ||
ui.label(bound.string("title")), | ||
).preset({ title: "TEST" }); | ||
let myView = new MyView(); | ||
ui.label(bound("title")), | ||
); | ||
let Preset = ui.use(MyView, { title: "TEST" }); | ||
let myView = new Preset(); | ||
t.render(myView); | ||
@@ -53,0 +54,0 @@ await t.expectOutputAsync(100, { text: "TEST" }); |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
394026
9857