@beinformed/ui 1.9.0-beta.6 → 1.9.1

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.
Files changed (160) hide show
  1. package/CHANGELOG.md +50 -0
  2. package/esm/constants/Settings.js +10 -8
  3. package/esm/constants/Settings.js.map +1 -1
  4. package/esm/hooks/useForm.js.map +1 -1
  5. package/esm/hooks/useNotification.js.map +1 -1
  6. package/esm/hooks/useRouter.js.map +1 -1
  7. package/esm/models/attributes/AttributeContent.js +126 -58
  8. package/esm/models/attributes/AttributeContent.js.map +1 -1
  9. package/esm/models/attributes/AttributeDataHelper.js +1 -1
  10. package/esm/models/attributes/AttributeDataHelper.js.map +1 -1
  11. package/esm/models/attributes/AttributeModel.js +3 -3
  12. package/esm/models/attributes/AttributeModel.js.map +1 -1
  13. package/esm/models/attributes/ChoiceAttributeOptionModel.js +4 -4
  14. package/esm/models/attributes/ChoiceAttributeOptionModel.js.map +1 -1
  15. package/esm/models/attributes/HelptextAttributeModel.js +17 -1
  16. package/esm/models/attributes/HelptextAttributeModel.js.map +1 -1
  17. package/esm/models/caseview/CaseViewModel.js +26 -12
  18. package/esm/models/caseview/CaseViewModel.js.map +1 -1
  19. package/esm/models/content/SectionModel.js +2 -1
  20. package/esm/models/content/SectionModel.js.map +1 -1
  21. package/esm/models/content/SubSectionModel.js +3 -1
  22. package/esm/models/content/SubSectionModel.js.map +1 -1
  23. package/esm/models/contentconfiguration/ContentConfigurationResults.js +2 -2
  24. package/esm/models/contentconfiguration/ContentConfigurationResults.js.map +1 -1
  25. package/esm/models/form/FormObjectModel.js +8 -2
  26. package/esm/models/form/FormObjectModel.js.map +1 -1
  27. package/esm/models/layouthint/LayoutHintCollection.js +3 -2
  28. package/esm/models/layouthint/LayoutHintCollection.js.map +1 -1
  29. package/esm/models/list/ListDetailModel.js +25 -0
  30. package/esm/models/list/ListDetailModel.js.map +1 -1
  31. package/esm/models/list/ListModel.js +22 -16
  32. package/esm/models/list/ListModel.js.map +1 -1
  33. package/esm/models/panels/GroupingPanelModel.js +19 -17
  34. package/esm/models/panels/GroupingPanelModel.js.map +1 -1
  35. package/esm/modularui/ModularUIRequest.js +2 -1
  36. package/esm/modularui/ModularUIRequest.js.map +1 -1
  37. package/esm/utils/helpers/text.js +19 -0
  38. package/esm/utils/helpers/text.js.map +1 -0
  39. package/esm/utils/index.js +2 -1
  40. package/esm/utils/index.js.map +1 -1
  41. package/lib/constants/Settings.js +12 -1
  42. package/lib/constants/Settings.js.flow +9 -5
  43. package/lib/constants/Settings.js.map +1 -1
  44. package/lib/hooks/useForm.js.flow +10 -5
  45. package/lib/hooks/useForm.js.map +1 -1
  46. package/lib/hooks/useNotification.js.flow +5 -2
  47. package/lib/hooks/useNotification.js.map +1 -1
  48. package/lib/hooks/useRouter.js.flow +12 -5
  49. package/lib/hooks/useRouter.js.map +1 -1
  50. package/lib/models/attributes/AttributeContent.js +136 -59
  51. package/lib/models/attributes/AttributeContent.js.flow +91 -39
  52. package/lib/models/attributes/AttributeContent.js.map +1 -1
  53. package/lib/models/attributes/AttributeDataHelper.js +1 -1
  54. package/lib/models/attributes/AttributeDataHelper.js.flow +2 -1
  55. package/lib/models/attributes/AttributeDataHelper.js.map +1 -1
  56. package/lib/models/attributes/AttributeModel.js +1 -1
  57. package/lib/models/attributes/AttributeModel.js.flow +2 -3
  58. package/lib/models/attributes/AttributeModel.js.map +1 -1
  59. package/lib/models/attributes/ChoiceAttributeOptionModel.js +3 -3
  60. package/lib/models/attributes/ChoiceAttributeOptionModel.js.flow +4 -7
  61. package/lib/models/attributes/ChoiceAttributeOptionModel.js.map +1 -1
  62. package/lib/models/attributes/HelptextAttributeModel.js +17 -1
  63. package/lib/models/attributes/HelptextAttributeModel.js.flow +11 -1
  64. package/lib/models/attributes/HelptextAttributeModel.js.map +1 -1
  65. package/lib/models/attributes/__tests__/AttributeContent.spec.js.flow +10 -2
  66. package/lib/models/attributes/__tests__/AttributeDataHelper.spec.js.flow +9 -3
  67. package/lib/models/attributes/__tests__/HelptextAttributeModel.spec.js.flow +39 -1
  68. package/lib/models/caseview/CaseViewModel.js +27 -13
  69. package/lib/models/caseview/CaseViewModel.js.flow +17 -7
  70. package/lib/models/caseview/CaseViewModel.js.map +1 -1
  71. package/lib/models/caseview/__tests__/CaseViewModel.spec.js.flow +68 -184
  72. package/lib/models/concepts/__mock__/business_scenario.js.flow +14 -1
  73. package/lib/models/concepts/__mock__/conceptdetail.js.flow +15 -6
  74. package/lib/models/concepts/__tests__/BusinessScenarioModel.spec.js.flow +5 -6
  75. package/lib/models/concepts/__tests__/ConceptDetailModel.spec.js.flow +58 -3
  76. package/lib/models/content/SectionModel.js +3 -1
  77. package/lib/models/content/SectionModel.js.flow +2 -1
  78. package/lib/models/content/SectionModel.js.map +1 -1
  79. package/lib/models/content/SubSectionModel.js +4 -1
  80. package/lib/models/content/SubSectionModel.js.flow +3 -1
  81. package/lib/models/content/SubSectionModel.js.map +1 -1
  82. package/lib/models/contentconfiguration/ContentConfigurationResults.js +2 -2
  83. package/lib/models/contentconfiguration/ContentConfigurationResults.js.flow +2 -2
  84. package/lib/models/contentconfiguration/ContentConfigurationResults.js.map +1 -1
  85. package/lib/models/contentconfiguration/__tests__/ContentConfigurationResults.spec.js.flow +6 -6
  86. package/lib/models/form/FormObjectModel.js +8 -2
  87. package/lib/models/form/FormObjectModel.js.flow +5 -1
  88. package/lib/models/form/FormObjectModel.js.map +1 -1
  89. package/lib/models/form/__tests__/FormObjectModel.spec.js.flow +2 -2
  90. package/lib/models/layouthint/LayoutHintCollection.js +4 -2
  91. package/lib/models/layouthint/LayoutHintCollection.js.flow +8 -7
  92. package/lib/models/layouthint/LayoutHintCollection.js.map +1 -1
  93. package/lib/models/list/ListDetailModel.js +25 -0
  94. package/lib/models/list/ListDetailModel.js.flow +19 -0
  95. package/lib/models/list/ListDetailModel.js.map +1 -1
  96. package/lib/models/list/ListModel.js +23 -16
  97. package/lib/models/list/ListModel.js.flow +9 -5
  98. package/lib/models/list/ListModel.js.map +1 -1
  99. package/lib/models/list/__tests__/ListDetailModel.spec.js.flow +64 -0
  100. package/lib/models/list/__tests__/ListModel.spec.js.flow +64 -2
  101. package/lib/models/panels/GroupingPanelModel.js +21 -18
  102. package/lib/models/panels/GroupingPanelModel.js.flow +10 -9
  103. package/lib/models/panels/GroupingPanelModel.js.map +1 -1
  104. package/lib/models/panels/__tests__/GroupingPanelModel.spec.js.flow +90 -0
  105. package/lib/models/types.js.flow +38 -11
  106. package/lib/modularui/ModularUIRequest.js +2 -1
  107. package/lib/modularui/ModularUIRequest.js.flow +1 -0
  108. package/lib/modularui/ModularUIRequest.js.map +1 -1
  109. package/lib/utils/helpers/text.js +28 -0
  110. package/lib/utils/helpers/text.js.flow +23 -0
  111. package/lib/utils/helpers/text.js.map +1 -0
  112. package/lib/utils/index.js +14 -0
  113. package/lib/utils/index.js.flow +1 -0
  114. package/lib/utils/index.js.map +1 -1
  115. package/package.json +13 -13
  116. package/src/constants/Settings.js +9 -5
  117. package/src/hooks/useForm.js +10 -5
  118. package/src/hooks/useNotification.js +5 -2
  119. package/src/hooks/useRouter.js +12 -5
  120. package/src/models/attributes/AttributeContent.js +91 -39
  121. package/src/models/attributes/AttributeDataHelper.js +2 -1
  122. package/src/models/attributes/AttributeModel.js +2 -3
  123. package/src/models/attributes/ChoiceAttributeOptionModel.js +4 -7
  124. package/src/models/attributes/HelptextAttributeModel.js +11 -1
  125. package/src/models/attributes/__tests__/AttributeContent.spec.js +10 -2
  126. package/src/models/attributes/__tests__/AttributeDataHelper.spec.js +9 -3
  127. package/src/models/attributes/__tests__/HelptextAttributeModel.spec.js +39 -1
  128. package/src/models/caseview/CaseViewModel.js +17 -7
  129. package/src/models/caseview/__tests__/CaseViewModel.spec.js +68 -184
  130. package/src/models/caseview/__tests__/caseview.json +38 -0
  131. package/src/models/caseview/__tests__/caseviewContributions.json +147 -0
  132. package/src/models/concepts/__mock__/business_scenario.js +14 -1
  133. package/src/models/concepts/__mock__/business_scenario_step.json +64 -0
  134. package/src/models/concepts/__mock__/conceptdetail.js +15 -6
  135. package/src/models/concepts/__mock__/conceptdetail_data.json +117 -17
  136. package/src/models/concepts/__mock__/concepttype_Calculation.json +75 -0
  137. package/src/models/concepts/__tests__/BusinessScenarioModel.spec.js +5 -6
  138. package/src/models/concepts/__tests__/ConceptDetailModel.spec.js +58 -3
  139. package/src/models/content/SectionModel.js +2 -1
  140. package/src/models/content/SubSectionModel.js +3 -1
  141. package/src/models/contentconfiguration/ContentConfigurationResults.js +2 -2
  142. package/src/models/contentconfiguration/__tests__/ContentConfigurationResults.spec.js +6 -6
  143. package/src/models/form/FormObjectModel.js +5 -1
  144. package/src/models/form/__tests__/FormObjectModel.spec.js +2 -2
  145. package/src/models/form/__tests__/FormWithContentData.json +1 -0
  146. package/src/models/layouthint/LayoutHintCollection.js +8 -7
  147. package/src/models/list/ListDetailModel.js +19 -0
  148. package/src/models/list/ListModel.js +9 -5
  149. package/src/models/list/__tests__/ListDetailModel.spec.js +64 -0
  150. package/src/models/list/__tests__/ListModel.spec.js +64 -2
  151. package/src/models/list/__tests__/caselist-34.contributions.json +1 -1
  152. package/src/models/list/__tests__/listContributions.json +1 -1
  153. package/src/models/panels/GroupingPanelModel.js +10 -9
  154. package/src/models/panels/__tests__/GroupingPanelModel.spec.js +90 -0
  155. package/src/models/panels/__tests__/groupingPanel.json +30 -0
  156. package/src/models/panels/__tests__/groupingPanelContributions.json +46 -0
  157. package/src/models/types.js +38 -11
  158. package/src/modularui/ModularUIRequest.js +1 -0
  159. package/src/utils/helpers/text.js +23 -0
  160. package/src/utils/index.js +1 -0
@@ -267,9 +267,10 @@ class AttributeDataHelper {
267
267
  const pickedContent = pick(this._attribute.content, [
268
268
  "header",
269
269
  "label",
270
- "description",
271
270
  "elements",
271
+ "layouthint",
272
272
  ]);
273
+
273
274
  if (Object.keys(pickedContent).length > 0) {
274
275
  return pickedContent;
275
276
  }
@@ -14,12 +14,11 @@ import ConceptDetailModel from "../concepts/ConceptDetailModel";
14
14
 
15
15
  import { MANDATORY, DISABLED } from "../../constants/LayoutHints";
16
16
  import {
17
- ALL_CONTENT_IN_DATA_SETTING,
18
17
  ATTRIBUTE_WIDTH,
19
18
  TIMEVERSION_FILTER_NAME,
20
19
  } from "../../constants/Constants";
21
20
 
22
- import { getSetting } from "../../constants/Settings";
21
+ import { getSetting, hasAllContentInData } from "../../constants/Settings";
23
22
 
24
23
  import {
25
24
  IllegalArgumentException,
@@ -952,7 +951,7 @@ export default class AttributeModel extends BaseModel {
952
951
  * Indicates if content comes from the data service
953
952
  */
954
953
  get hasContentFromData(): boolean {
955
- return getSetting(ALL_CONTENT_IN_DATA_SETTING, true);
954
+ return hasAllContentInData();
956
955
  }
957
956
 
958
957
  /**
@@ -4,21 +4,18 @@ import ChoiceAttributeOptionCollection from "./ChoiceAttributeOptionCollection";
4
4
 
5
5
  import { DateUtil } from "../../utils/datetime/DateTimeUtil";
6
6
  import { has } from "../../utils/helpers/objects";
7
- import {
8
- ALL_CONTENT_IN_DATA_SETTING,
9
- TIMEVERSION_FILTER_NAME,
10
- } from "../../constants/Constants";
7
+ import { TIMEVERSION_FILTER_NAME } from "../../constants/Constants";
11
8
  import { TITLE } from "../../constants/LayoutHints";
9
+ import { hasAllContentInData } from "../../constants/Settings";
12
10
 
13
11
  import LinkCollection from "../links/LinkCollection";
14
12
  import AttributeCollection from "./AttributeCollection";
15
13
  import ConceptDetailModel from "../concepts/ConceptDetailModel";
14
+ import AttributeContent from "./AttributeContent";
16
15
 
17
16
  import type { ModularUIModel } from "../types";
18
17
  import type ListItemModel from "../list/ListItemModel";
19
18
  import type LinkModel from "../links/LinkModel";
20
- import { getSetting } from "../../constants";
21
- import AttributeContent from "./AttributeContent";
22
19
 
23
20
  /**
24
21
  */
@@ -358,7 +355,7 @@ class ChoiceAttributeOptionModel extends BaseModel {
358
355
  * Indicates if content comes from the data service
359
356
  */
360
357
  get hasContentFromData(): boolean {
361
- return getSetting(ALL_CONTENT_IN_DATA_SETTING, true);
358
+ return hasAllContentInData();
362
359
  }
363
360
 
364
361
  /**
@@ -26,6 +26,16 @@ export default class HelptextAttributeModel extends LabelAttributeModel {
26
26
  * Get helptext text
27
27
  */
28
28
  get text(): string | null {
29
- return this.getContribution("text");
29
+ const dataText = this.getData("value");
30
+ if (dataText) {
31
+ return dataText.message ?? dataText;
32
+ }
33
+
34
+ const contributionText = this.getContribution("text");
35
+ if (contributionText) {
36
+ return contributionText.message ?? contributionText;
37
+ }
38
+
39
+ return null;
30
40
  }
31
41
  }
@@ -2,6 +2,12 @@ import AttributeContent from "../AttributeContent";
2
2
  import SectionModel from "../../content/SectionModel";
3
3
 
4
4
  const json = {
5
+ header: {
6
+ label: "Header label",
7
+ description: {
8
+ message: "Dit is de beschrijving",
9
+ },
10
+ },
5
11
  label: "Blaastest geslaagd",
6
12
  elements: [
7
13
  {
@@ -38,7 +44,7 @@ const json = {
38
44
  {
39
45
  type: "Description",
40
46
  label: "Description",
41
- text: "Dit is een text fragment",
47
+ text: { message: "Dit is een text fragment" },
42
48
  },
43
49
  ],
44
50
  },
@@ -147,6 +153,8 @@ describe("AttributeContent", () => {
147
153
  it("Handles basic content elements", () => {
148
154
  const content = new AttributeContent(json);
149
155
  expect(content.label).toBe("Blaastest geslaagd");
156
+ expect(content.header.label).toBe("Header label");
157
+ expect(content.header.description).toBe("Dit is de beschrijving");
150
158
  expect(content.properties).toHaveLength(2);
151
159
  expect(content.textfragments).toHaveLength(1);
152
160
  expect(content.sections).toHaveLength(1);
@@ -218,6 +226,6 @@ describe("AttributeContent", () => {
218
226
  it("can retrieve all content", () => {
219
227
  const content = new AttributeContent(json);
220
228
 
221
- expect(content.all).toHaveLength(4);
229
+ expect(content.elements).toHaveLength(4);
222
230
  });
223
231
  });
@@ -499,18 +499,20 @@ describe("attributeDataHelper", () => {
499
499
  key: "results",
500
500
  content: {
501
501
  InvestigationNecessary: {
502
+ header: {
503
+ label: "label",
504
+ description: "description",
505
+ },
502
506
  elements: [
503
507
  {
504
508
  textFragmentElement: {
505
509
  label: "Text fragment: Description",
506
510
  textfragments: [
507
511
  {
508
- type: "Description",
509
- label: "Description",
510
512
  text: "Text fragment for investigation necessary",
511
513
  },
512
514
  ],
513
- "layout-hint": ["full"],
515
+ layouthint: ["full"],
514
516
  },
515
517
  },
516
518
  ],
@@ -536,6 +538,10 @@ describe("attributeDataHelper", () => {
536
538
  expect(firstChild.dynamicschemaId).toBe("results.InvestigationNecessary");
537
539
  expect(firstChild.key).toBe("InvestigationNecessary");
538
540
  expect(firstChild.value).toBe(true);
541
+ expect(firstChild.content.header).toStrictEqual({
542
+ label: "label",
543
+ description: "description",
544
+ });
539
545
  expect(firstChild.content.elements).toHaveLength(1);
540
546
 
541
547
  expect(firstChild.dynamicschema).toBeUndefined();
@@ -1,7 +1,7 @@
1
1
  import HelptextAttributeModel from "../HelptextAttributeModel";
2
2
 
3
3
  describe("helptextAttributeModel", () => {
4
- it("should be able to create an empty HelptextAttribute object", () => {
4
+ it("should be able to create a HelptextAttribute object", () => {
5
5
  const attribute = new HelptextAttributeModel();
6
6
 
7
7
  expect(attribute).toBeInstanceOf(HelptextAttributeModel);
@@ -15,4 +15,42 @@ describe("helptextAttributeModel", () => {
15
15
 
16
16
  expect(attributeWithText.text).toBe("Example helptext text");
17
17
  });
18
+
19
+ it("should be able to handle content in data", () => {
20
+ const attributeWithText = new HelptextAttributeModel(
21
+ {
22
+ key: "CarDetails",
23
+ value: {
24
+ id: "CarDetails.text",
25
+ properties: {
26
+ PersonPrivateCar: "Ferrari GTO",
27
+ PersonLessFavoriteCars: "Mercedes",
28
+ PersonFavoriteCars: "BMW 5 Series, Fiat Panda",
29
+ },
30
+ message:
31
+ "<p>Currently the person drives in a Ferrari GTO, although his favorite cars are BMW 5 Series, Fiat Panda. Less favorite cars of the person are Mercedes.</p>",
32
+ },
33
+ static: true,
34
+ dynamicschemaId: "CarDetails",
35
+ isResult: false,
36
+ children: [],
37
+ content: null,
38
+ },
39
+ {
40
+ type: "string",
41
+ label: "Car details",
42
+ mandatory: false,
43
+ readonly: true,
44
+ text: {
45
+ id: "CarDetails.text",
46
+ message:
47
+ "<p>Currently the person drives in a ${PersonPrivateCar}, although his favorite cars are ${PersonFavoriteCars}. Less favorite cars of the person are ${PersonLessFavoriteCars}.</p>",
48
+ },
49
+ }
50
+ );
51
+
52
+ expect(attributeWithText.text).toBe(
53
+ "<p>Currently the person drives in a Ferrari GTO, although his favorite cars are BMW 5 Series, Fiat Panda. Less favorite cars of the person are Mercedes.</p>"
54
+ );
55
+ });
18
56
  });
@@ -76,11 +76,19 @@ export default class CaseViewModel extends DetailModel {
76
76
  }
77
77
 
78
78
  /**
79
+ * Retrieve the case label, this can be configured with a case property with the layout hint 'title'
79
80
  */
80
81
  get label(): string {
81
82
  return this.casename ? this.casename.value : "";
82
83
  }
83
84
 
85
+ /**
86
+ * Retrieve the label that was configured on the caseview
87
+ */
88
+ get viewLabel(): string {
89
+ return this.getContribution("label", "");
90
+ }
91
+
84
92
  /**
85
93
  * Check if an introtext exists for this caseview
86
94
  */
@@ -92,14 +100,16 @@ export default class CaseViewModel extends DetailModel {
92
100
  * Getting the introduction text configured on the case view
93
101
  */
94
102
  get introtext(): string {
95
- if (this.contributions.texts) {
96
- const text = this.contributions.texts.find(
97
- (item) => item.type === "master"
98
- );
103
+ if (this.data._text) {
104
+ return this.data._text.message ?? this.data._text;
105
+ }
99
106
 
100
- if (text) {
101
- return text.text;
102
- }
107
+ if (this.contributions.text) {
108
+ return this.contributions.text.message ?? this.contributions.text;
109
+ }
110
+
111
+ if (Array.isArray(this.contributions.texts)) {
112
+ return this.contributions.texts[0].text;
103
113
  }
104
114
 
105
115
  return "";
@@ -1,6 +1,9 @@
1
1
  import CaseViewModel from "../CaseViewModel";
2
2
  import DetailModel from "../../detail/DetailModel";
3
3
 
4
+ import caseviewJson from "./caseview.json";
5
+ import caseviewContributionsJson from "./caseviewContributions.json";
6
+
4
7
  describe("caseViewModel", () => {
5
8
  it("should be able to create an empty casedetail", () => {
6
9
  const caseview = new CaseViewModel({});
@@ -10,200 +13,81 @@ describe("caseViewModel", () => {
10
13
 
11
14
  it("should be able to create a casedetail from a typical modular UI json structure", () => {
12
15
  const caseDetail = new CaseViewModel({
16
+ key: "Book",
17
+ data: caseviewJson,
18
+ contributions: caseviewContributionsJson,
19
+ });
20
+
21
+ expect(caseDetail).toBeInstanceOf(CaseViewModel);
22
+ expect(caseDetail).toBeInstanceOf(DetailModel);
23
+
24
+ expect(caseDetail.key).toBe("Book");
25
+ expect(caseDetail.id).toBe(24);
26
+
27
+ expect(caseDetail.casename.value).toBe("The safety of objects");
28
+ });
29
+
30
+ it("should be able to handle different kind of introtext", () => {
31
+ const caseviewOldStructure = new CaseViewModel({
32
+ key: "Book",
33
+ data: caseviewJson,
34
+ contributions: caseviewContributionsJson,
35
+ });
36
+
37
+ expect(caseviewOldStructure.introtext).toBe("<p>This is introtext</p>");
38
+
39
+ const caseviewFromDataPlain = new CaseViewModel({
13
40
  key: "Book",
14
41
  data: {
15
- _links: {
16
- self: {
17
- href: "/books/book/24",
18
- },
19
- api_doc: {
20
- href: "/api-docs/books/book/24",
21
- },
22
- contributions: {
23
- href: "/contributions/books/book/24",
24
- },
25
- Creator: {
26
- href: "/books/book/24/creator",
27
- },
28
- Editions: {
29
- href: "/books/book/24/editions",
30
- },
31
- Activities: {
32
- href: "/books/book/24/activities",
33
- },
34
- taskgroup: [
35
- {
36
- href: "/books/book/24/Tasks",
37
- name: "Tasks",
38
- },
39
- ],
42
+ _text: "<p>This is introtext</p>",
43
+ ...caseviewJson,
44
+ },
45
+ contributions: caseviewContributionsJson,
46
+ });
47
+
48
+ expect(caseviewFromDataPlain.introtext).toBe("<p>This is introtext</p>");
49
+
50
+ const caseviewFromDataApplicationMessage = new CaseViewModel({
51
+ key: "Book",
52
+ data: {
53
+ ...caseviewJson,
54
+ _text: {
55
+ message: "<p>This is introtext</p>",
40
56
  },
41
- _id: 24,
42
- CaseName: "The safety of objects",
43
- CaseType: "Book",
44
- Owner: "Arnold",
45
- Format: "Paperback",
46
- ISBN10: "1847087302",
47
- ISBN13: "9781847087300",
48
- Language: "EN",
49
- NumberOfPages: 176,
50
- State: "Registered",
51
57
  },
58
+ contributions: caseviewContributionsJson,
59
+ });
60
+
61
+ expect(caseviewFromDataApplicationMessage.introtext).toBe(
62
+ "<p>This is introtext</p>"
63
+ );
64
+
65
+ const caseviewFromNewContributionsRawTextMessage = new CaseViewModel({
66
+ key: "Book",
67
+ data: caseviewJson,
52
68
  contributions: {
53
- label: "Book",
54
- resourcetype: "CaseView",
55
- texts: [
56
- {
57
- type: "master",
58
- text: "<p>This view contains all the data about this book. It contains a list of the creators and editions. A person can be an author(1) or an illustrator(2)<br /><br />This is a list of books that is ordered by the role (author (1), co-author, illustrator(2)) of the person that contributed to the book.<br /><br />1) An author is broadly defined as &quot;the person who originated or gave existence to anything&quot; and whose authorship determines responsibility for what was created. Narrowly defined, an author is the originator of any written work and can also be described as a writer.<br /><br />2) An illustrator is an artist who specializes in enhancing writing or elucidating concepts by providing a visual representation that corresponds to the content of the associated text or idea. The illustration may be intended to clarify complicated concepts or objects that are difficult to describe textually, which is the reason illustrations are often found in children&#39;s books.<br /></p>",
59
- },
60
- ],
61
- _links: {
62
- panel: [
63
- {
64
- name: "Creator",
65
- label: "Creator",
66
- resourcetype: "CaseRelationListPanel",
67
- },
68
- {
69
- name: "Editions",
70
- label: "Editions",
71
- resourcetype: "RecordListPanel",
72
- },
73
- {
74
- name: "Activities",
75
- label: "Activities",
76
- resourcetype: "GroupingPanel",
77
- },
78
- ],
79
- taskgroup: [
80
- {
81
- name: "Tasks",
82
- label: "Tasks",
83
- resourcetype: "TaskGroup",
84
- },
85
- ],
86
- },
87
- metadata: {
88
- _id: {
89
- label: "Id",
90
- type: "integer",
91
- },
69
+ ...caseviewContributionsJson,
70
+ text: {
71
+ message: "<p>This is introtext</p>",
92
72
  },
93
- attributes: [
94
- {
95
- CaseName: {
96
- label: "Case name",
97
- type: "string",
98
- layouthint: ["title"],
99
- },
100
- },
101
- {
102
- CaseType: {
103
- label: "Case type",
104
- type: "string",
105
- layouthint: ["type"],
106
- },
107
- },
108
- {
109
- Owner: {
110
- label: "Case owner",
111
- type: "string",
112
- layouthint: ["owner"],
113
- },
114
- },
115
- {
116
- State: {
117
- label: "State",
118
- type: "string",
119
- layouthint: ["state"],
120
- options: [
121
- {
122
- code: "Registered",
123
- label: "Registered",
124
- },
125
- ],
126
- },
127
- },
128
- {
129
- Format: {
130
- label: "Format",
131
- type: "string",
132
- multiplechoice: false,
133
- layouthint: ["combobox"],
134
- options: [
135
- {
136
- code: "Hardcover",
137
- label: "Hardcover",
138
- },
139
- {
140
- code: "Paperback",
141
- label: "Paperback",
142
- },
143
- {
144
- code: "Ebook",
145
- label: "Ebook",
146
- },
147
- {
148
- code: "Audio",
149
- label: "Audio book",
150
- },
151
- ],
152
- },
153
- },
154
- {
155
- ISBN10: {
156
- label: "ISBN10",
157
- type: "string",
158
- displaysize: 50,
159
- },
160
- },
161
- {
162
- ISBN13: {
163
- label: "ISBN13",
164
- type: "string",
165
- displaysize: 50,
166
- },
167
- },
168
- {
169
- Language: {
170
- label: "Language",
171
- type: "string",
172
- multiplechoice: false,
173
- layouthint: ["radiobutton"],
174
- options: [
175
- {
176
- code: "EN",
177
- label: "English",
178
- },
179
- {
180
- code: "DU",
181
- label: "Dutch",
182
- },
183
- ],
184
- },
185
- },
186
- {
187
- NumberOfPages: {
188
- label: "Number of pages",
189
- type: "number",
190
- format: "0",
191
- groupingSeparator: ".",
192
- decimalSeparator: ",",
193
- minimum: 1,
194
- maximum: 1000,
195
- },
196
- },
197
- ],
198
73
  },
199
74
  });
200
75
 
201
- expect(caseDetail).toBeInstanceOf(CaseViewModel);
202
- expect(caseDetail).toBeInstanceOf(DetailModel);
76
+ expect(caseviewFromNewContributionsRawTextMessage.introtext).toBe(
77
+ "<p>This is introtext</p>"
78
+ );
203
79
 
204
- expect(caseDetail.key).toBe("Book");
205
- expect(caseDetail.id).toBe(24);
80
+ const caseviewFromNewContributionsSimpleMessage = new CaseViewModel({
81
+ key: "Book",
82
+ data: caseviewJson,
83
+ contributions: {
84
+ ...caseviewContributionsJson,
85
+ text: "<p>This is introtext</p>",
86
+ },
87
+ });
206
88
 
207
- expect(caseDetail.casename.value).toBe("The safety of objects");
89
+ expect(caseviewFromNewContributionsSimpleMessage.introtext).toBe(
90
+ "<p>This is introtext</p>"
91
+ );
208
92
  });
209
93
  });
@@ -0,0 +1,38 @@
1
+ {
2
+ "_links": {
3
+ "self": {
4
+ "href": "/books/book/24"
5
+ },
6
+ "api_doc": {
7
+ "href": "/api-docs/books/book/24"
8
+ },
9
+ "contributions": {
10
+ "href": "/contributions/books/book/24"
11
+ },
12
+ "Creator": {
13
+ "href": "/books/book/24/creator"
14
+ },
15
+ "Editions": {
16
+ "href": "/books/book/24/editions"
17
+ },
18
+ "Activities": {
19
+ "href": "/books/book/24/activities"
20
+ },
21
+ "taskgroup": [
22
+ {
23
+ "href": "/books/book/24/Tasks",
24
+ "name": "Tasks"
25
+ }
26
+ ]
27
+ },
28
+ "_id": 24,
29
+ "CaseName": "The safety of objects",
30
+ "CaseType": "Book",
31
+ "Owner": "Arnold",
32
+ "Format": "Paperback",
33
+ "ISBN10": "1847087302",
34
+ "ISBN13": "9781847087300",
35
+ "Language": "EN",
36
+ "NumberOfPages": 176,
37
+ "State": "Registered"
38
+ }