Skip to content

Commit

Permalink
Merge pull request #82 from gisce/fix-label-size
Browse files Browse the repository at this point in the history
Better define label size
  • Loading branch information
mguellsegarra authored May 24, 2023
2 parents c29d767 + 8ecf85d commit 85f6ab1
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 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.3",
"version": "0.19.4",
"main": "./dist/ooui.umd.js",
"module": "./dist/ooui.es.js",
"types": "./dist/index.d.ts",
Expand Down
4 changes: 2 additions & 2 deletions src/Label.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import Field from "./Field";


type LabelType = "secondary" | "success" | "warning" | "danger" | "default";
type LabelSize = "h1" | "h2" | "h3" | "h4" | "h5" | "text";
type LabelSize = 1 | 2 | 3 | 4 | 5 | undefined;

class Label extends Field {
/**
Expand Down Expand Up @@ -41,7 +41,7 @@ class Label extends Field {
/**
* Label size
*/
_labelSize: LabelSize = "text";
_labelSize: LabelSize = undefined;
get labelSize(): LabelSize {
return this._labelSize;
}
Expand Down
6 changes: 3 additions & 3 deletions src/spec/Label.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,15 +75,15 @@ describe("A Label", () => {
widget_props: "{}"
};
const widget = widgetFactory.createWidget("label", props);
expect(widget.labelSize).toBe("text");
expect(widget.labelSize).toBe(undefined);
});
it("should have allow size to h1...h5", () => {
const widgetFactory = new WidgetFactory();
['h1', 'h2', 'h3', 'h4', 'h5'].map((level) => {
[1, 2, 3, 4, 5].map((level) => {
const props = {
name: "field_label",
string: "Default",
widget_props: `{'label_size': '${level}'}`
widget_props: `{'label_size': ${level}}`
};
const widget = widgetFactory.createWidget("label", props);
expect(widget.labelSize).toBe(level);
Expand Down

0 comments on commit 85f6ab1

Please sign in to comment.