@gisce/ooui 2.31.0-alpha.3 → 2.31.0-alpha.4

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.31.0-alpha.3",
3
+ "version": "2.31.0-alpha.4",
4
4
  "engines": {
5
5
  "node": "20.5.0"
6
6
  },
package/src/Many2one.ts CHANGED
@@ -32,6 +32,14 @@ class Many2one extends Field {
32
32
  return this.parsedWidgetProps.showFolder ?? true;
33
33
  }
34
34
 
35
+ get showSearch(): boolean {
36
+ return this.parsedWidgetProps.showSearch ?? true;
37
+ }
38
+
39
+ get showMenu(): boolean {
40
+ return this.parsedWidgetProps.showMenu ?? true;
41
+ }
42
+
35
43
  constructor(props: any) {
36
44
  super(props);
37
45
 
@@ -34,23 +34,63 @@ describe("A Many2one", () => {
34
34
 
35
35
  expect(widget.relation).toBe("res.country");
36
36
  });
37
- it("should default showFolder to true", () => {
38
- const widgetFactory = new WidgetFactory();
39
- const props = {
40
- name: "many2one1",
41
- relation: "res.country",
42
- };
43
- const widget = widgetFactory.createWidget("many2one", props);
44
- expect(widget.showFolder).toBe(true);
45
- });
46
- it("should have a property to hide the folder through widget props", () => {
47
- const widgetFactory = new WidgetFactory();
48
- const props = {
49
- name: "many2one1",
50
- relation: "res.country",
51
- widget_props: "{'showFolder': false}",
52
- };
53
- const widget = widgetFactory.createWidget("many2one", props);
54
- expect(widget.showFolder).toBe(false);
37
+ describe("Hiding buttons", () => {
38
+ it("should default showFolder to true", () => {
39
+ const widgetFactory = new WidgetFactory();
40
+ const props = {
41
+ name: "many2one1",
42
+ relation: "res.country",
43
+ };
44
+ const widget = widgetFactory.createWidget("many2one", props);
45
+ expect(widget.showFolder).toBe(true);
46
+ });
47
+ it("should have a property to hide the folder through widget props", () => {
48
+ const widgetFactory = new WidgetFactory();
49
+ const props = {
50
+ name: "many2one1",
51
+ relation: "res.country",
52
+ widget_props: "{'showFolder': false}",
53
+ };
54
+ const widget = widgetFactory.createWidget("many2one", props);
55
+ expect(widget.showFolder).toBe(false);
56
+ });
57
+ it("should default showSearch to true", () => {
58
+ const widgetFactory = new WidgetFactory();
59
+ const props = {
60
+ name: "many2one1",
61
+ relation: "res.country",
62
+ };
63
+ const widget = widgetFactory.createWidget("many2one", props);
64
+ expect(widget.showSearch).toBe(true);
65
+ });
66
+ it("should have a property to hide the search button through widget props", () => {
67
+ const widgetFactory = new WidgetFactory();
68
+ const props = {
69
+ name: "many2one1",
70
+ relation: "res.country",
71
+ widget_props: "{'showSearch': false}",
72
+ };
73
+ const widget = widgetFactory.createWidget("many2one", props);
74
+ expect(widget.showSearch).toBe(false);
75
+ });
76
+ it("should default showMenu to true", () => {
77
+ const widgetFactory = new WidgetFactory();
78
+ const props = {
79
+ name: "many2one1",
80
+ relation: "res.country",
81
+ };
82
+ const widget = widgetFactory.createWidget("many2one", props);
83
+ expect(widget.showMenu).toBe(true);
84
+ });
85
+ it("should have a property to hide the menu through widget props", () => {
86
+ const widgetFactory = new WidgetFactory();
87
+ const props = {
88
+ name: "many2one1",
89
+ relation: "res.country",
90
+ widget_props: "{'showMenu': false}",
91
+ };
92
+ const widget = widgetFactory.createWidget("many2one", props);
93
+ expect(widget.showMenu).toBe(false);
94
+ });
55
95
  });
56
96
  });