Skip to content

Commit

Permalink
Merge pull request #79 from gisce/group-icon
Browse files Browse the repository at this point in the history
Add suport for group icon
  • Loading branch information
mguellsegarra authored May 8, 2023
2 parents f0dbb00 + 6ed8d5d commit 28532cc
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 3 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": "0.19.0",
"version": "0.19.1",
"main": "./dist/ooui.umd.js",
"module": "./dist/ooui.es.js",
"types": "./dist/index.d.ts",
Expand Down
14 changes: 14 additions & 0 deletions src/Group.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,22 @@
import ContainerWidget from "./ContainerWidget";
import {replaceEntities} from "./helpers/attributeParser";

class Group extends ContainerWidget {

_icon: string | null = null;
get icon(): string | null {
return this._icon;
}
set icon(value: string | null) {
this._icon = value;
}
constructor(props: any) {
super(props);
if (props) {
if (props.icon) {
this._icon = props.icon;
}
}
}
}

Expand Down
10 changes: 10 additions & 0 deletions src/spec/Group.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import Group from "../Group";
import WidgetImpl from "./fixtures/WidgetImpl";
import WidgetFactory from "../WidgetFactory";

describe("A Group", () => {
it("should be constructed with 4 columns and a colspan of 4", () => {
Expand Down Expand Up @@ -29,4 +30,13 @@ describe("A Group", () => {
group4.container.addWidget(new WidgetImpl({ name: "5" }));
expect(group4.container.rows.length).toBe(2);
});
it("can have an icon property", () => {
const widgetFactory = new WidgetFactory();
const props = {
string: "General",
icon: "home"
};
const widget = widgetFactory.createWidget("group", props);
expect(widget.icon).toEqual("home");
});
});

0 comments on commit 28532cc

Please sign in to comment.