diff --git a/src/Group.ts b/src/Group.ts index 1f14575..c792454 100644 --- a/src/Group.ts +++ b/src/Group.ts @@ -1,6 +1,6 @@ -import ContainerWidget from "./ContainerWidget"; +import Spinner from "./Spinner"; -class Group extends ContainerWidget { +class Group extends Spinner { _icon: string | null = null; get icon(): string | null { return this._icon; diff --git a/src/Page.ts b/src/Page.ts index 2fb99b5..2c2f65d 100644 --- a/src/Page.ts +++ b/src/Page.ts @@ -1,6 +1,6 @@ -import ContainerWidget from "./ContainerWidget"; +import Spinner from "./Spinner"; -class Page extends ContainerWidget { +class Page extends Spinner { _icon: string | null = null; get icon(): string | null { return this._icon; diff --git a/src/spec/Group.spec.ts b/src/spec/Group.spec.ts index e3dafb3..91133cc 100644 --- a/src/spec/Group.spec.ts +++ b/src/spec/Group.spec.ts @@ -40,4 +40,23 @@ describe("A Group", () => { const widget = widgetFactory.createWidget("group", props); expect(widget.icon).toEqual("home"); }); + describe("working as a spinner", () => { + it("should be loading false as default", () => { + const widgetFactory = new WidgetFactory(); + const props = { + string: "A group", + }; + const widget = widgetFactory.createWidget("group", props); + expect(widget.loading).toBe(false); + }); + it("should be loading true if set", () => { + const widgetFactory = new WidgetFactory(); + const props = { + string: "A group", + loading: true, + }; + const widget = widgetFactory.createWidget("group", props); + expect(widget.loading).toBe(true); + }); + }); }); diff --git a/src/spec/Page.spec.ts b/src/spec/Page.spec.ts index cb8784f..48f7803 100644 --- a/src/spec/Page.spec.ts +++ b/src/spec/Page.spec.ts @@ -14,4 +14,23 @@ describe("A Page", () => { expect(widget.label).toBe("Page 1"); expect(widget.icon).toBe("home"); }); + describe("working as a Spinner", () => { + it("should have loading to be false by default", () => { + const widgetFactory = new WidgetFactory(); + const props = { + string: "Page 1", + }; + const widget = widgetFactory.createWidget("page", props); + expect(widget.loading).toBe(false); + }); + it("should allow setting loading to true", () => { + const widgetFactory = new WidgetFactory(); + const props = { + string: "Page 1", + loading: true, + }; + const widget = widgetFactory.createWidget("page", props); + expect(widget.loading).toBe(true); + }); + }); });