Skip to content

Commit

Permalink
feat(group): add height (#160)
Browse files Browse the repository at this point in the history
  • Loading branch information
ecarreras authored Dec 13, 2024
1 parent 2eb12e6 commit a5a85e7
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/Group.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,29 @@ class Group extends Spinner {
this._icon = value;
}

_height: number | undefined;
get height(): number | undefined {
return this._height;
}

set height(value: number | undefined) {
this._height = value;
}

constructor(props: any) {
super(props);
if (props) {
if (props.icon) {
this._icon = props.icon;
}
if (props.height) {
try {
this._height = parseInt(props.height);
} catch (e) {
console.log("Error parsing height");
this._height = undefined;
}
}
}
}
}
Expand Down
9 changes: 9 additions & 0 deletions src/spec/Group.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,5 +58,14 @@ describe("A Group", () => {
const widget = widgetFactory.createWidget("group", props);
expect(widget.loading).toBe(true);
});
it("should allow to set height", () => {
const widgetFactory = new WidgetFactory();
const props = {
string: "A group",
height: 100,
};
const widget = widgetFactory.createWidget("group", props);
expect(widget.height).toBe(100);
});
});
});

0 comments on commit a5a85e7

Please sign in to comment.