Skip to content

Commit

Permalink
Merge branch 'v2' into alpha
Browse files Browse the repository at this point in the history
  • Loading branch information
mguellsegarra committed Nov 13, 2024
2 parents ab15394 + b10cf76 commit 424ea55
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 4 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@gisce/ooui",
"version": "2.16.0-alpha.1",
"version": "2.16.0",
"engines": {
"node": "20.5.0"
},
Expand Down
13 changes: 13 additions & 0 deletions src/Steps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,16 @@ class Steps extends Field {
this._errorField = value;
}

_lastStep: boolean | null = true;

get lastStep(): boolean | null {
return this._lastStep;
}

set lastStep(value: boolean | null) {
this._lastStep = value;
}

constructor(props: any) {
super(props);

Expand All @@ -36,6 +46,9 @@ class Steps extends Field {
if (this.parsedWidgetProps.hasOwnProperty("error_field")) {
this._errorField = this.parsedWidgetProps.error_field;
}
if (this.parsedWidgetProps.hasOwnProperty("last_step")) {
this._lastStep = this.parsedWidgetProps.last_step;
}
}
}
}
Expand Down
22 changes: 21 additions & 1 deletion src/spec/Steps.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,17 @@ describe("A Steps widget", () => {

expect(widget.errorField).toBe(null);
});
it("should have default lastStep to true", () => {
const widgetFactory = new WidgetFactory();
const props = {
name: "state",
};
const widget = widgetFactory.createWidget("steps", props);

expect(widget.lastStep).toBe(true);
});

it("should properly set field", () => {
it("should properly set field errorField", () => {
const widgetFactory = new WidgetFactory();
const props = {
name: "state",
Expand All @@ -32,4 +41,15 @@ describe("A Steps widget", () => {

expect(widget.errorField).toBe("error");
});

it("should properly set field lastStep with false", () => {
const widgetFactory = new WidgetFactory();
const props = {
name: "state",
widget_props: "{'last_step': false}",
};
const widget = widgetFactory.createWidget("steps", props);

expect(widget.lastStep).toBe(false);
});
});

0 comments on commit 424ea55

Please sign in to comment.