@gisce/ooui 2.23.0-alpha.4 → 2.23.0
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/dist/Field.d.ts +0 -5
- package/dist/Field.d.ts.map +1 -1
- package/dist/Form.d.ts +0 -5
- package/dist/Form.d.ts.map +1 -1
- package/dist/Tree.d.ts +0 -5
- package/dist/Tree.d.ts.map +1 -1
- package/dist/Widget.d.ts.map +1 -1
- package/dist/WidgetFactory.d.ts.map +1 -1
- package/dist/helpers/nodeParser.d.ts.map +1 -1
- package/dist/index.d.ts +1 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/ooui.es.js +372 -421
- package/dist/ooui.es.js.map +1 -1
- package/package.json +1 -1
- package/src/Field.ts +0 -25
- package/src/Form.ts +0 -13
- package/src/Tree.ts +1 -13
- package/src/Widget.ts +13 -2
- package/src/WidgetFactory.ts +0 -4
- package/src/helpers/nodeParser.ts +1 -7
- package/src/index.ts +0 -2
- package/src/spec/Form.spec.ts +0 -50
- package/src/spec/Tree.spec.ts +0 -19
- package/dist/Carousel.d.ts +0 -11
- package/dist/Carousel.d.ts.map +0 -1
- package/src/Carousel.ts +0 -30
- package/src/spec/Carousel.spec.ts +0 -75
- package/src/spec/Field.spec.ts +0 -35
- package/src/spec/nodeParser.spec.ts +0 -53
package/package.json
CHANGED
package/src/Field.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import Widget from "./Widget";
|
|
2
2
|
import { replaceEntities, isTrue } from "./helpers/attributeParser";
|
|
3
|
-
import { parseBoolAttribute } from "./helpers/nodeParser";
|
|
4
3
|
|
|
5
4
|
class Field extends Widget {
|
|
6
5
|
/**
|
|
@@ -126,27 +125,6 @@ class Field extends Widget {
|
|
|
126
125
|
this._selectionValues = value;
|
|
127
126
|
}
|
|
128
127
|
|
|
129
|
-
_autoRefresh?: boolean = false;
|
|
130
|
-
get autoRefresh(): boolean {
|
|
131
|
-
return this._autoRefresh ?? false;
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
set autoRefresh(value: boolean) {
|
|
135
|
-
this._autoRefresh = value;
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
get readOnly(): boolean | undefined {
|
|
139
|
-
if (this.autoRefresh) {
|
|
140
|
-
return true;
|
|
141
|
-
} else {
|
|
142
|
-
return super.readOnly;
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
set readOnly(value: boolean | undefined) {
|
|
147
|
-
super.readOnly = value;
|
|
148
|
-
}
|
|
149
|
-
|
|
150
128
|
constructor(props: any) {
|
|
151
129
|
super(props);
|
|
152
130
|
|
|
@@ -198,9 +176,6 @@ class Field extends Widget {
|
|
|
198
176
|
if (props.help_inline) {
|
|
199
177
|
this.tooltipInline = isTrue(props.help_inline);
|
|
200
178
|
}
|
|
201
|
-
if (props.autorefresh) {
|
|
202
|
-
this.autoRefresh = parseBoolAttribute(props.autorefresh);
|
|
203
|
-
}
|
|
204
179
|
}
|
|
205
180
|
}
|
|
206
181
|
|
package/src/Form.ts
CHANGED
|
@@ -124,14 +124,6 @@ class Form {
|
|
|
124
124
|
this._invisibleFields = value;
|
|
125
125
|
}
|
|
126
126
|
|
|
127
|
-
/**
|
|
128
|
-
* List of autorefreshable fields
|
|
129
|
-
*/
|
|
130
|
-
_autorefreshableFields: string[] = [];
|
|
131
|
-
get autorefreshableFields(): string[] {
|
|
132
|
-
return this._autorefreshableFields;
|
|
133
|
-
}
|
|
134
|
-
|
|
135
127
|
/**
|
|
136
128
|
* Context for each field in the form
|
|
137
129
|
*/
|
|
@@ -178,11 +170,6 @@ class Form {
|
|
|
178
170
|
this._contextForFields[unknownWidget._id] = widget._context;
|
|
179
171
|
}
|
|
180
172
|
});
|
|
181
|
-
|
|
182
|
-
// Also we store all the autorefreshables fields in a list
|
|
183
|
-
this._autorefreshableFields = allWidgets
|
|
184
|
-
.filter((widget) => widget instanceof Field && widget.autoRefresh)
|
|
185
|
-
.map((field) => (field as Field)._id);
|
|
186
173
|
}
|
|
187
174
|
|
|
188
175
|
parseNode({
|
package/src/Tree.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import WidgetFactory from "./WidgetFactory";
|
|
2
2
|
import Widget from "./Widget";
|
|
3
3
|
import { replaceEntities } from "./helpers/attributeParser";
|
|
4
|
-
import {
|
|
4
|
+
import { ParsedNode } from "./helpers/nodeParser";
|
|
5
5
|
import * as txml from "txml";
|
|
6
6
|
import { parseContext } from "./helpers/contextParser";
|
|
7
7
|
|
|
@@ -67,14 +67,6 @@ class Tree {
|
|
|
67
67
|
this._contextForFields = value;
|
|
68
68
|
}
|
|
69
69
|
|
|
70
|
-
/**
|
|
71
|
-
* List of autorefreshable fields
|
|
72
|
-
*/
|
|
73
|
-
_autorefreshableFields: string[] = [];
|
|
74
|
-
get autorefreshableFields(): string[] {
|
|
75
|
-
return this._autorefreshableFields;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
70
|
/**
|
|
79
71
|
* Is infinite
|
|
80
72
|
*/
|
|
@@ -153,10 +145,6 @@ class Tree {
|
|
|
153
145
|
const widget = widgetFactory.createWidget(widgetType, mergedAttrs);
|
|
154
146
|
this._columns.push(widget);
|
|
155
147
|
}
|
|
156
|
-
|
|
157
|
-
if (parseBoolAttribute(mergedAttrs.autorefresh)) {
|
|
158
|
-
this._autorefreshableFields.push(name);
|
|
159
|
-
}
|
|
160
148
|
}
|
|
161
149
|
});
|
|
162
150
|
}
|
package/src/Widget.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { replaceEntities, parseWidgetProps } from "./helpers/attributeParser";
|
|
2
|
-
import { parseBoolAttribute } from "./helpers/nodeParser";
|
|
3
2
|
|
|
4
3
|
abstract class Widget {
|
|
5
4
|
/**
|
|
@@ -133,7 +132,19 @@ abstract class Widget {
|
|
|
133
132
|
this._colspan = +props.colspan;
|
|
134
133
|
}
|
|
135
134
|
if (props.readonly !== undefined) {
|
|
136
|
-
|
|
135
|
+
if (
|
|
136
|
+
props.readonly === "1" ||
|
|
137
|
+
props.readonly === 1 ||
|
|
138
|
+
props.readonly === true
|
|
139
|
+
) {
|
|
140
|
+
this._readOnly = true;
|
|
141
|
+
} else if (
|
|
142
|
+
props.readonly === "0" ||
|
|
143
|
+
props.readonly === 0 ||
|
|
144
|
+
props.readonly === false
|
|
145
|
+
) {
|
|
146
|
+
this._readOnly = false;
|
|
147
|
+
}
|
|
137
148
|
}
|
|
138
149
|
if (props.invisible) {
|
|
139
150
|
if (
|
package/src/WidgetFactory.ts
CHANGED
|
@@ -41,7 +41,6 @@ import Comments from "./Comments";
|
|
|
41
41
|
import JSONField from "./JSONField";
|
|
42
42
|
import Email from "./Email";
|
|
43
43
|
import Spinner from "./Spinner";
|
|
44
|
-
import Carousel from "./Carousel";
|
|
45
44
|
|
|
46
45
|
class WidgetFactory {
|
|
47
46
|
/**
|
|
@@ -185,9 +184,6 @@ class WidgetFactory {
|
|
|
185
184
|
case "spinner":
|
|
186
185
|
this._widgetClass = Spinner;
|
|
187
186
|
break;
|
|
188
|
-
case "carousel":
|
|
189
|
-
this._widgetClass = Carousel;
|
|
190
|
-
break;
|
|
191
187
|
default:
|
|
192
188
|
break;
|
|
193
189
|
}
|
|
@@ -5,13 +5,7 @@ type ParsedNode = {
|
|
|
5
5
|
};
|
|
6
6
|
|
|
7
7
|
const parseBoolAttribute = (attr: any): boolean => {
|
|
8
|
-
if (
|
|
9
|
-
attr === 1 ||
|
|
10
|
-
attr === "1" ||
|
|
11
|
-
attr === true ||
|
|
12
|
-
attr === "True" ||
|
|
13
|
-
attr === "true"
|
|
14
|
-
) {
|
|
8
|
+
if (attr === 1 || attr === "1" || attr === true || attr === "True") {
|
|
15
9
|
return true;
|
|
16
10
|
} else {
|
|
17
11
|
return false;
|
package/src/index.ts
CHANGED
|
@@ -53,7 +53,6 @@ import JSONField from "./JSONField";
|
|
|
53
53
|
import Comments from "./Comments";
|
|
54
54
|
import Email from "./Email";
|
|
55
55
|
import Spinner from "./Spinner";
|
|
56
|
-
import Carousel from "./Carousel";
|
|
57
56
|
|
|
58
57
|
import {
|
|
59
58
|
Graph,
|
|
@@ -143,5 +142,4 @@ export {
|
|
|
143
142
|
JSONField,
|
|
144
143
|
Email,
|
|
145
144
|
Spinner,
|
|
146
|
-
Carousel,
|
|
147
145
|
};
|
package/src/spec/Form.spec.ts
CHANGED
|
@@ -6015,56 +6015,6 @@ describe("A Form", () => {
|
|
|
6015
6015
|
expect(field_char?.type).toBe("arrow_steps");
|
|
6016
6016
|
expect(field_char?.id).toBe("field_char");
|
|
6017
6017
|
});
|
|
6018
|
-
it("a field with autorefresh evaluated in attrs should be present in form autorefreshable fields property", () => {
|
|
6019
|
-
const fields = {
|
|
6020
|
-
field_char: {
|
|
6021
|
-
string: "Etapa",
|
|
6022
|
-
type: "char",
|
|
6023
|
-
},
|
|
6024
|
-
state: {
|
|
6025
|
-
readonly: true,
|
|
6026
|
-
required: true,
|
|
6027
|
-
selection: [
|
|
6028
|
-
["esborrany", "Borrador"],
|
|
6029
|
-
["validar", "Validar"],
|
|
6030
|
-
["pendent", "Pendiente"],
|
|
6031
|
-
["activa", "Activa"],
|
|
6032
|
-
["cancelada", "Cancelada"],
|
|
6033
|
-
["contracte", "Activación Contrato"],
|
|
6034
|
-
["novapolissa", "Creación nuevo contrato"],
|
|
6035
|
-
["modcontractual", "Modificación Contractual"],
|
|
6036
|
-
["impagament", "Impago"],
|
|
6037
|
-
["tall", "Corte"],
|
|
6038
|
-
["running", "En ejecución"],
|
|
6039
|
-
["baixa", "Baja"],
|
|
6040
|
-
["facturacio", "Facturación"],
|
|
6041
|
-
],
|
|
6042
|
-
string: "Estado",
|
|
6043
|
-
type: "selection",
|
|
6044
|
-
views: {},
|
|
6045
|
-
},
|
|
6046
|
-
};
|
|
6047
|
-
|
|
6048
|
-
const xmlViewForm = `<?xml version="1.0"?>
|
|
6049
|
-
<form string="Form1">
|
|
6050
|
-
<field name="field_char" widget="arrow_steps" colspan="4" nolabel="1" attrs="{'autorefresh':[('state', '=', 'running')]}" />
|
|
6051
|
-
</form>`;
|
|
6052
|
-
|
|
6053
|
-
const form = new Form(fields);
|
|
6054
|
-
form.parse(xmlViewForm, {
|
|
6055
|
-
values: {
|
|
6056
|
-
field_char: "test",
|
|
6057
|
-
state: "running",
|
|
6058
|
-
},
|
|
6059
|
-
});
|
|
6060
|
-
|
|
6061
|
-
const field_char = form.findById("field_char") as Field;
|
|
6062
|
-
expect(field_char).toBeDefined();
|
|
6063
|
-
expect(field_char?.autoRefresh).toBeTruthy();
|
|
6064
|
-
expect(field_char?.readOnly).toBeTruthy();
|
|
6065
|
-
expect(form.autorefreshableFields.length).toBe(1);
|
|
6066
|
-
expect(form.autorefreshableFields[0]).toBe("field_char");
|
|
6067
|
-
});
|
|
6068
6018
|
describe("If the field has widget_props", () => {
|
|
6069
6019
|
it("should merge widget_props from fields definition and xml", () => {
|
|
6070
6020
|
const fields = {
|
package/src/spec/Tree.spec.ts
CHANGED
|
@@ -377,23 +377,4 @@ describe("A Tree", () => {
|
|
|
377
377
|
const nameWidget = tree.findById("name") as Char;
|
|
378
378
|
expect(nameWidget.isFunction).toBeTruthy();
|
|
379
379
|
});
|
|
380
|
-
it("Should parse autorefreshable fields", () => {
|
|
381
|
-
const tree = new Tree({
|
|
382
|
-
name: {
|
|
383
|
-
required: true,
|
|
384
|
-
select: true,
|
|
385
|
-
size: 128,
|
|
386
|
-
string: "Potència contractada (kW)",
|
|
387
|
-
type: "char",
|
|
388
|
-
views: {},
|
|
389
|
-
},
|
|
390
|
-
});
|
|
391
|
-
tree.parse(
|
|
392
|
-
`<tree string="Partners" colors="red:type=='updated'"><field name="name" sum="Potència contractada (kW)" autorefresh="1"/></tree>`,
|
|
393
|
-
);
|
|
394
|
-
|
|
395
|
-
const nameWidget = tree.findById("name") as Char;
|
|
396
|
-
expect(nameWidget.autoRefresh).toBeTruthy();
|
|
397
|
-
expect(tree._autorefreshableFields.length).toBe(1);
|
|
398
|
-
});
|
|
399
380
|
});
|
package/dist/Carousel.d.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import ContainerWidget from "./ContainerWidget";
|
|
2
|
-
import Group from "./Group";
|
|
3
|
-
declare class Carousel extends ContainerWidget {
|
|
4
|
-
_autoPlay: boolean;
|
|
5
|
-
get autoPlay(): boolean;
|
|
6
|
-
set autoPlay(value: boolean);
|
|
7
|
-
get items(): Group[];
|
|
8
|
-
constructor(props?: any);
|
|
9
|
-
}
|
|
10
|
-
export default Carousel;
|
|
11
|
-
//# sourceMappingURL=Carousel.d.ts.map
|
package/dist/Carousel.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Carousel.d.ts","sourceRoot":"","sources":["../src/Carousel.ts"],"names":[],"mappings":"AAAA,OAAO,eAAe,MAAM,mBAAmB,CAAC;AAChD,OAAO,KAAK,MAAM,SAAS,CAAC;AAG5B,cAAM,QAAS,SAAQ,eAAe;IACpC,SAAS,UAAQ;IAEjB,IAAI,QAAQ,IAAI,OAAO,CAEtB;IAED,IAAI,QAAQ,CAAC,KAAK,EAAE,OAAO,EAE1B;IAED,IAAI,KAAK,IAAI,KAAK,EAAE,CAEnB;gBAEW,KAAK,CAAC,EAAE,GAAG;CAQxB;AAED,eAAe,QAAQ,CAAC"}
|
package/src/Carousel.ts
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import ContainerWidget from "./ContainerWidget";
|
|
2
|
-
import Group from "./Group";
|
|
3
|
-
import { parseBoolAttribute } from "./helpers/nodeParser";
|
|
4
|
-
|
|
5
|
-
class Carousel extends ContainerWidget {
|
|
6
|
-
_autoPlay = true;
|
|
7
|
-
|
|
8
|
-
get autoPlay(): boolean {
|
|
9
|
-
return this._autoPlay;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
set autoPlay(value: boolean) {
|
|
13
|
-
this._autoPlay = value;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
get items(): Group[] {
|
|
17
|
-
return this._container.rows.flat().filter((g) => !g.invisible) as Group[];
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
constructor(props?: any) {
|
|
21
|
-
super(props);
|
|
22
|
-
if (props) {
|
|
23
|
-
if ("auto_play" in props) {
|
|
24
|
-
this._autoPlay = parseBoolAttribute(props.auto_play);
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
export default Carousel;
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
import WidgetFactory from "../WidgetFactory";
|
|
2
|
-
import Form from "../Form";
|
|
3
|
-
import Carousel from "../Carousel";
|
|
4
|
-
import { it, expect, describe } from "vitest";
|
|
5
|
-
|
|
6
|
-
describe("A Carousel", () => {
|
|
7
|
-
it("should have an id corresponding to field name", () => {
|
|
8
|
-
const widgetFactory = new WidgetFactory();
|
|
9
|
-
const props = {
|
|
10
|
-
name: "carousel",
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
const widget = widgetFactory.createWidget("carousel", props);
|
|
14
|
-
expect(widget).toBeInstanceOf(Carousel);
|
|
15
|
-
});
|
|
16
|
-
it("should have autoPlay as true by default", () => {
|
|
17
|
-
const widgetFactory = new WidgetFactory();
|
|
18
|
-
const props = {
|
|
19
|
-
name: "carousel",
|
|
20
|
-
};
|
|
21
|
-
const widget = widgetFactory.createWidget("carousel", props);
|
|
22
|
-
expect(widget.autoPlay).toBe(true);
|
|
23
|
-
});
|
|
24
|
-
it("should allow autoPlay to be set", () => {
|
|
25
|
-
const widgetFactory = new WidgetFactory();
|
|
26
|
-
const props = {
|
|
27
|
-
name: "carousel",
|
|
28
|
-
auto_play: false,
|
|
29
|
-
};
|
|
30
|
-
const widget = widgetFactory.createWidget("carousel", props);
|
|
31
|
-
expect(widget.autoPlay).toBe(false);
|
|
32
|
-
});
|
|
33
|
-
it("should have items with the first childs group items", () => {
|
|
34
|
-
const xml = `
|
|
35
|
-
<form>
|
|
36
|
-
<carousel name="carousel">
|
|
37
|
-
<group string="Group 1">
|
|
38
|
-
<field name="field1" string="Field 1" />
|
|
39
|
-
</group>
|
|
40
|
-
<group string="Group 2">
|
|
41
|
-
<field name="field2" string="Field 2" />
|
|
42
|
-
<group string="Group 3">
|
|
43
|
-
<field name="field3" string="Field 3" />
|
|
44
|
-
</group>
|
|
45
|
-
</group>
|
|
46
|
-
</carousel>
|
|
47
|
-
</form>
|
|
48
|
-
`;
|
|
49
|
-
const fields = {
|
|
50
|
-
field1: {
|
|
51
|
-
string: "Field 1",
|
|
52
|
-
type: "char",
|
|
53
|
-
size: 10,
|
|
54
|
-
},
|
|
55
|
-
field2: {
|
|
56
|
-
string: "Field 2",
|
|
57
|
-
type: "char",
|
|
58
|
-
size: 10,
|
|
59
|
-
},
|
|
60
|
-
field3: {
|
|
61
|
-
string: "Field 3",
|
|
62
|
-
type: "char",
|
|
63
|
-
size: 10,
|
|
64
|
-
},
|
|
65
|
-
};
|
|
66
|
-
|
|
67
|
-
const form = new Form(fields);
|
|
68
|
-
form.parse(xml);
|
|
69
|
-
const carousel = form.findById("carousel") as Carousel;
|
|
70
|
-
expect(carousel).toBeInstanceOf(Carousel);
|
|
71
|
-
expect(carousel.items.length).toBe(2);
|
|
72
|
-
expect(carousel.items[0].label).toBe("Group 1");
|
|
73
|
-
expect(carousel.items[1].label).toBe("Group 2");
|
|
74
|
-
});
|
|
75
|
-
});
|
package/src/spec/Field.spec.ts
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { describe, it, expect } from "vitest";
|
|
2
|
-
import Field from "../Field";
|
|
3
|
-
|
|
4
|
-
describe("Field", () => {
|
|
5
|
-
describe("with the autoRefresh property", () => {
|
|
6
|
-
it("should be false as default", () => {
|
|
7
|
-
const props = {};
|
|
8
|
-
const field = new Field(props);
|
|
9
|
-
expect(field.autoRefresh).toBe(false);
|
|
10
|
-
});
|
|
11
|
-
it("should work with text", () => {
|
|
12
|
-
const props = {
|
|
13
|
-
autorefresh: "1",
|
|
14
|
-
};
|
|
15
|
-
const field = new Field(props);
|
|
16
|
-
expect(field.autoRefresh).toBe(true);
|
|
17
|
-
});
|
|
18
|
-
describe("if autorefresh is not a valid boold", () => {
|
|
19
|
-
it("should return false", () => {
|
|
20
|
-
const props = {
|
|
21
|
-
autorefresh: "abc",
|
|
22
|
-
};
|
|
23
|
-
const field = new Field(props);
|
|
24
|
-
expect(field.autoRefresh).toBe(false);
|
|
25
|
-
});
|
|
26
|
-
});
|
|
27
|
-
it("should return true for readOnly if autoRefresh is set", () => {
|
|
28
|
-
const props = {
|
|
29
|
-
autorefresh: true,
|
|
30
|
-
};
|
|
31
|
-
const field = new Field(props);
|
|
32
|
-
expect(field.readOnly).toBe(true);
|
|
33
|
-
});
|
|
34
|
-
});
|
|
35
|
-
});
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import { describe, it, expect } from "vitest";
|
|
2
|
-
import { parseBoolAttribute } from "../helpers/nodeParser";
|
|
3
|
-
|
|
4
|
-
describe("parseBoolAttribute", () => {
|
|
5
|
-
it("returns true for numeric 1", () => {
|
|
6
|
-
expect(parseBoolAttribute(1)).toBe(true);
|
|
7
|
-
});
|
|
8
|
-
|
|
9
|
-
it('returns true for string "1"', () => {
|
|
10
|
-
expect(parseBoolAttribute("1")).toBe(true);
|
|
11
|
-
});
|
|
12
|
-
|
|
13
|
-
it("returns true for boolean true", () => {
|
|
14
|
-
expect(parseBoolAttribute(true)).toBe(true);
|
|
15
|
-
});
|
|
16
|
-
|
|
17
|
-
it('returns true for string "True"', () => {
|
|
18
|
-
expect(parseBoolAttribute("True")).toBe(true);
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
it('returns true for string "true"', () => {
|
|
22
|
-
expect(parseBoolAttribute("true")).toBe(true);
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
it("returns false for numeric 0", () => {
|
|
26
|
-
expect(parseBoolAttribute(0)).toBe(false);
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
it('returns false for string "0"', () => {
|
|
30
|
-
expect(parseBoolAttribute("0")).toBe(false);
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
it("returns false for boolean false", () => {
|
|
34
|
-
expect(parseBoolAttribute(false)).toBe(false);
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
it('returns false for string "False"', () => {
|
|
38
|
-
expect(parseBoolAttribute("False")).toBe(false);
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
it("returns false for null", () => {
|
|
42
|
-
expect(parseBoolAttribute(null)).toBe(false);
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
it("returns false for undefined", () => {
|
|
46
|
-
expect(parseBoolAttribute(undefined)).toBe(false);
|
|
47
|
-
});
|
|
48
|
-
|
|
49
|
-
it("returns false for non-boolean strings", () => {
|
|
50
|
-
expect(parseBoolAttribute("yes")).toBe(false);
|
|
51
|
-
expect(parseBoolAttribute("no")).toBe(false);
|
|
52
|
-
});
|
|
53
|
-
});
|