@gisce/ooui 2.38.0-alpha.2 → 2.38.0-alpha.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gisce/ooui",
3
- "version": "2.38.0-alpha.2",
3
+ "version": "2.38.0-alpha.3",
4
4
  "engines": {
5
5
  "node": "20.5.0"
6
6
  },
package/src/Card.ts CHANGED
@@ -19,6 +19,19 @@ class Card extends Spinner {
19
19
  this._icon = value;
20
20
  }
21
21
 
22
+ /**
23
+ * Height of the card component
24
+ */
25
+ _height: number | undefined = undefined;
26
+
27
+ get height(): number | undefined {
28
+ return this._height;
29
+ }
30
+
31
+ set height(value: number | undefined) {
32
+ this._height = value;
33
+ }
34
+
22
35
  constructor(props: any) {
23
36
  super(props);
24
37
  if (props) {
@@ -28,6 +41,10 @@ class Card extends Spinner {
28
41
  if (props.icon) {
29
42
  this._icon = props.icon;
30
43
  }
44
+ if (props.height) {
45
+ const parsedHeight = parseInt(props.height);
46
+ this._height = isNaN(parsedHeight) ? undefined : parsedHeight;
47
+ }
31
48
  }
32
49
  }
33
50
  }
@@ -49,6 +49,24 @@ describe("A Card", () => {
49
49
  const widget = widgetFactory.createWidget("card", props);
50
50
  expect(widget.title).toEqual("Card Title");
51
51
  });
52
+ it("can have a height property", () => {
53
+ const widgetFactory = new WidgetFactory();
54
+ const props = {
55
+ title: "Card Title",
56
+ height: "200",
57
+ };
58
+ const widget = widgetFactory.createWidget("card", props);
59
+ expect(widget.height).toEqual(200);
60
+ });
61
+ it("should handle invalid height values", () => {
62
+ const widgetFactory = new WidgetFactory();
63
+ const props = {
64
+ title: "Card Title",
65
+ height: "invalid",
66
+ };
67
+ const widget = widgetFactory.createWidget("card", props);
68
+ expect(widget.height).toBeUndefined();
69
+ });
52
70
  describe("working as a spinner", () => {
53
71
  it("should be loading false as default", () => {
54
72
  const widgetFactory = new WidgetFactory();