@pod-os/elements 0.13.1-9efc307.0 → 0.13.1-cd22eb8.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.
Files changed (93) hide show
  1. package/dist/cjs/elements.cjs.js +1 -1
  2. package/dist/cjs/loader.cjs.js +1 -1
  3. package/dist/collection/collection-manifest.json +2 -3
  4. package/dist/elements/elements.esm.js +1 -1
  5. package/dist/elements/elements.esm.js.map +1 -1
  6. package/dist/esm/elements.js +1 -1
  7. package/dist/esm/loader.js +1 -1
  8. package/dist/types/components.d.ts +0 -13
  9. package/package.json +1 -1
  10. package/dist/cjs/test-component.cjs.entry.js +0 -15
  11. package/dist/cjs/test-component.cjs.entry.js.map +0 -1
  12. package/dist/collection/apps/pos-app-document-viewer/pos-app-document-viewer.spec.js +0 -29
  13. package/dist/collection/apps/pos-app-document-viewer/pos-app-document-viewer.spec.js.map +0 -1
  14. package/dist/collection/apps/pos-app-image-viewer/pos-app-image-viewer.spec.js +0 -29
  15. package/dist/collection/apps/pos-app-image-viewer/pos-app-image-viewer.spec.js.map +0 -1
  16. package/dist/collection/components/broken-file/BrokenFile.spec.js +0 -45
  17. package/dist/collection/components/broken-file/BrokenFile.spec.js.map +0 -1
  18. package/dist/collection/components/pos-add-literal-value/test/pos-add-literal-value.spec.js +0 -185
  19. package/dist/collection/components/pos-add-literal-value/test/pos-add-literal-value.spec.js.map +0 -1
  20. package/dist/collection/components/pos-add-new-thing/test/pos-add-new-thing.spec.js +0 -59
  21. package/dist/collection/components/pos-add-new-thing/test/pos-add-new-thing.spec.js.map +0 -1
  22. package/dist/collection/components/pos-container-contents/pos-container-contents.spec.js +0 -132
  23. package/dist/collection/components/pos-container-contents/pos-container-contents.spec.js.map +0 -1
  24. package/dist/collection/components/pos-container-contents/pos-container-item.spec.js +0 -64
  25. package/dist/collection/components/pos-container-contents/pos-container-item.spec.js.map +0 -1
  26. package/dist/collection/components/pos-container-contents/selectIconForTypes.spec.js +0 -30
  27. package/dist/collection/components/pos-container-contents/selectIconForTypes.spec.js.map +0 -1
  28. package/dist/collection/components/pos-description/pos-description.spec.js +0 -31
  29. package/dist/collection/components/pos-description/pos-description.spec.js.map +0 -1
  30. package/dist/collection/components/pos-document/pos-document.spec.js +0 -219
  31. package/dist/collection/components/pos-document/pos-document.spec.js.map +0 -1
  32. package/dist/collection/components/pos-error-toast/test/pos-error-toast.spec.js +0 -18
  33. package/dist/collection/components/pos-error-toast/test/pos-error-toast.spec.js.map +0 -1
  34. package/dist/collection/components/pos-image/pos-image.integration.spec.js +0 -124
  35. package/dist/collection/components/pos-image/pos-image.integration.spec.js.map +0 -1
  36. package/dist/collection/components/pos-image/pos-image.spec.js +0 -219
  37. package/dist/collection/components/pos-image/pos-image.spec.js.map +0 -1
  38. package/dist/collection/components/pos-label/pos-label.integration.spec.js +0 -101
  39. package/dist/collection/components/pos-label/pos-label.integration.spec.js.map +0 -1
  40. package/dist/collection/components/pos-label/pos-label.spec.js +0 -31
  41. package/dist/collection/components/pos-label/pos-label.spec.js.map +0 -1
  42. package/dist/collection/components/pos-literals/pos-literals.spec.js +0 -118
  43. package/dist/collection/components/pos-literals/pos-literals.spec.js.map +0 -1
  44. package/dist/collection/components/pos-login/pos-login.integration.spec.js +0 -35
  45. package/dist/collection/components/pos-login/pos-login.integration.spec.js.map +0 -1
  46. package/dist/collection/components/pos-login/pos-login.spec.js +0 -46
  47. package/dist/collection/components/pos-login/pos-login.spec.js.map +0 -1
  48. package/dist/collection/components/pos-navigation-bar/pos-navigation-bar.spec.js +0 -41
  49. package/dist/collection/components/pos-navigation-bar/pos-navigation-bar.spec.js.map +0 -1
  50. package/dist/collection/components/pos-new-thing-form/test/pos-new-thing-form.spec.js +0 -239
  51. package/dist/collection/components/pos-new-thing-form/test/pos-new-thing-form.spec.js.map +0 -1
  52. package/dist/collection/components/pos-picture/pos-picture.integration.spec.js +0 -79
  53. package/dist/collection/components/pos-picture/pos-picture.integration.spec.js.map +0 -1
  54. package/dist/collection/components/pos-picture/pos-picture.spec.js +0 -49
  55. package/dist/collection/components/pos-picture/pos-picture.spec.js.map +0 -1
  56. package/dist/collection/components/pos-relations/pos-relations.spec.js +0 -64
  57. package/dist/collection/components/pos-relations/pos-relations.spec.js.map +0 -1
  58. package/dist/collection/components/pos-resource/pos-resource.integration.spec.js +0 -355
  59. package/dist/collection/components/pos-resource/pos-resource.integration.spec.js.map +0 -1
  60. package/dist/collection/components/pos-resource/pos-resource.spec.js +0 -237
  61. package/dist/collection/components/pos-resource/pos-resource.spec.js.map +0 -1
  62. package/dist/collection/components/pos-reverse-relations/pos-reverse-relations.spec.js +0 -64
  63. package/dist/collection/components/pos-reverse-relations/pos-reverse-relations.spec.js.map +0 -1
  64. package/dist/collection/components/pos-rich-link/pos-rich-link.spec.js +0 -37
  65. package/dist/collection/components/pos-rich-link/pos-rich-link.spec.js.map +0 -1
  66. package/dist/collection/components/pos-select-term/test/pos-select-term.spec.js +0 -75
  67. package/dist/collection/components/pos-select-term/test/pos-select-term.spec.js.map +0 -1
  68. package/dist/collection/components/pos-subjects/pos-subjects.spec.js +0 -58
  69. package/dist/collection/components/pos-subjects/pos-subjects.spec.js.map +0 -1
  70. package/dist/collection/components/pos-type-badges/pos-type-badges.spec.js +0 -119
  71. package/dist/collection/components/pos-type-badges/pos-type-badges.spec.js.map +0 -1
  72. package/dist/collection/components/pos-type-router/pos-type-router.spec.js +0 -105
  73. package/dist/collection/components/pos-type-router/pos-type-router.spec.js.map +0 -1
  74. package/dist/collection/components/pos-type-router/selectAppForTypes.spec.js +0 -85
  75. package/dist/collection/components/pos-type-router/selectAppForTypes.spec.js.map +0 -1
  76. package/dist/collection/components/pos-value/pos-value.spec.js +0 -31
  77. package/dist/collection/components/pos-value/pos-value.spec.js.map +0 -1
  78. package/dist/collection/test/TestComponent.js +0 -4
  79. package/dist/collection/test/TestComponent.js.map +0 -1
  80. package/dist/collection/test/mockPodOS.js +0 -38
  81. package/dist/collection/test/mockPodOS.js.map +0 -1
  82. package/dist/collection/test/renderFunctionalComponent.js +0 -9
  83. package/dist/collection/test/renderFunctionalComponent.js.map +0 -1
  84. package/dist/components/test-component.d.ts +0 -11
  85. package/dist/components/test-component.js +0 -9
  86. package/dist/components/test-component.js.map +0 -1
  87. package/dist/elements/p-c5bcab34.entry.js +0 -2
  88. package/dist/elements/p-c5bcab34.entry.js.map +0 -1
  89. package/dist/esm/test-component.entry.js +0 -11
  90. package/dist/esm/test-component.entry.js.map +0 -1
  91. package/dist/types/test/TestComponent.d.ts +0 -2
  92. package/dist/types/test/mockPodOS.d.ts +0 -13
  93. package/dist/types/test/renderFunctionalComponent.d.ts +0 -1
@@ -1,185 +0,0 @@
1
- import { newSpecPage } from "@stencil/core/testing";
2
- import { when } from "jest-when";
3
- import { PosAddLiteralValue } from "../pos-add-literal-value";
4
- import { fireEvent } from "@testing-library/dom";
5
- describe('pos-add-literal-value', () => {
6
- it('renders nothing initially', async () => {
7
- const page = await newSpecPage({
8
- components: [PosAddLiteralValue],
9
- html: `<pos-add-literal-value></pos-add-literal-value>`,
10
- });
11
- expect(page.root).toEqualHtml(`
12
- <pos-add-literal-value>
13
- <mock:shadow-root>
14
- </mock:shadow-root>
15
- </pos-add-literal-value>
16
- `);
17
- });
18
- it('renders nothing, if resource is not editable', async () => {
19
- const page = await newSpecPage({
20
- components: [PosAddLiteralValue],
21
- html: `<pos-add-literal-value></pos-add-literal-value>`,
22
- });
23
- page.rootInstance.receiveResource({
24
- editable: false,
25
- });
26
- await page.waitForChanges();
27
- expect(page.root).toEqualHtml(`
28
- <pos-add-literal-value>
29
- <mock:shadow-root>
30
- </mock:shadow-root>
31
- </pos-add-literal-value>
32
- `);
33
- });
34
- it('renders inputs, if resource is editable', async () => {
35
- const page = await newSpecPage({
36
- components: [PosAddLiteralValue],
37
- html: `<pos-add-literal-value></pos-add-literal-value>`,
38
- });
39
- page.rootInstance.receiveResource({
40
- editable: true,
41
- });
42
- await page.waitForChanges();
43
- expect(page.root).toEqualHtml(`
44
- <pos-add-literal-value>
45
- <mock:shadow-root>
46
- <ion-icon name="add-circle-outline"></ion-icon>
47
- <pos-select-term placeholder="Add literal"></pos-select-term>
48
- <ion-input placeholder=""></ion-input>
49
- </mock:shadow-root>
50
- </pos-add-literal-value>
51
- `);
52
- });
53
- it('focusses the input after a term was selected', async () => {
54
- // given a page with a pos-add-literal-value component
55
- const page = await newSpecPage({
56
- supportsShadowDom: false,
57
- components: [PosAddLiteralValue],
58
- html: `<pos-add-literal-value></pos-add-literal-value>`,
59
- });
60
- // and the component received a PodOs instance
61
- const mockOs = {
62
- addPropertyValue: jest.fn(),
63
- };
64
- page.rootInstance.receivePodOs(mockOs);
65
- // and the current (editable) resource
66
- const mockResource = {
67
- editable: true,
68
- };
69
- page.rootInstance.receiveResource(mockResource);
70
- await page.waitForChanges();
71
- const input = page.root.querySelector('ion-input');
72
- input.setFocus = jest.fn();
73
- // when the user selects a term
74
- const termSelect = page.root.querySelector('pos-select-term');
75
- fireEvent(termSelect, new CustomEvent('pod-os:term-selected', { detail: { uri: 'https://schema.org/description' } }));
76
- // then the input is focussed
77
- expect(input.setFocus).toHaveBeenCalled();
78
- });
79
- it('changes value and saves value', async () => {
80
- // given a page with a pos-add-literal-value component
81
- const page = await newSpecPage({
82
- supportsShadowDom: false,
83
- components: [PosAddLiteralValue],
84
- html: `<pos-add-literal-value></pos-add-literal-value>`,
85
- });
86
- // and the component received a PodOs instance
87
- const mockOs = {
88
- addPropertyValue: jest.fn(),
89
- };
90
- page.rootInstance.receivePodOs(mockOs);
91
- // and the current (editable) resource
92
- const mockResource = {
93
- editable: true,
94
- };
95
- page.rootInstance.receiveResource(mockResource);
96
- await page.waitForChanges();
97
- const input = page.root.querySelector('ion-input');
98
- input.setFocus = jest.fn();
99
- // when the user selects a term
100
- const termSelect = page.root.querySelector('pos-select-term');
101
- fireEvent(termSelect, new CustomEvent('pod-os:term-selected', { detail: { uri: 'https://schema.org/description' } }));
102
- expect(page.rootInstance.selectedTermUri).toBe('https://schema.org/description');
103
- // when the user types something into the value input
104
- fireEvent(input, new CustomEvent('ionChange', { detail: { value: 'new value' } }));
105
- expect(page.rootInstance.currentValue).toBe('new value');
106
- // and the value changes for good
107
- fireEvent(input, new CustomEvent('change'));
108
- await page.waitForChanges();
109
- // then the value is added to the property of the resource
110
- expect(mockOs.addPropertyValue).toHaveBeenCalledWith(mockResource, 'https://schema.org/description', 'new value');
111
- // and the value input is cleared
112
- expect(page.rootInstance.currentValue).toBe('');
113
- });
114
- it('fires event after save', async () => {
115
- // given a page with a pos-add-literal-value component
116
- const page = await newSpecPage({
117
- supportsShadowDom: false,
118
- components: [PosAddLiteralValue],
119
- html: `<pos-add-literal-value></pos-add-literal-value>`,
120
- });
121
- // and the page listens for pod-os:added-literal-value event
122
- const eventListener = jest.fn();
123
- page.root.addEventListener('pod-os:added-literal-value', eventListener);
124
- // and the component received a PodOs instance
125
- const mockOs = {
126
- addPropertyValue: jest.fn(),
127
- };
128
- page.rootInstance.receivePodOs(mockOs);
129
- // and the current (editable) resource
130
- const mockResource = {
131
- editable: true,
132
- };
133
- page.rootInstance.receiveResource(mockResource);
134
- await page.waitForChanges();
135
- // when save is called
136
- page.rootInstance.selectedTermUri = 'https://schema.org/name';
137
- page.rootInstance.currentValue = 'Test value';
138
- await page.rootInstance.save();
139
- // then a pod-os:added-literal-value event with the added literal is received in the listener
140
- const literal = {
141
- predicate: 'https://schema.org/name',
142
- values: ['Test value'],
143
- };
144
- expect(eventListener).toHaveBeenCalledWith(expect.objectContaining({
145
- detail: literal,
146
- }));
147
- });
148
- it('fires error event and keeps inputs when save failed', async () => {
149
- // given a page with a pos-add-literal-value component
150
- const page = await newSpecPage({
151
- supportsShadowDom: false,
152
- components: [PosAddLiteralValue],
153
- html: `<pos-add-literal-value></pos-add-literal-value>`,
154
- });
155
- // and the page listens for pod-os:error event
156
- const eventListener = jest.fn();
157
- page.root.addEventListener('pod-os:error', eventListener);
158
- // and the component received a PodOs instance
159
- const mockOs = {
160
- addPropertyValue: jest.fn(),
161
- };
162
- page.rootInstance.receivePodOs(mockOs);
163
- // and the current (editable) resource
164
- const mockResource = {
165
- editable: true,
166
- };
167
- page.rootInstance.receiveResource(mockResource);
168
- await page.waitForChanges();
169
- // and saving will cause an error
170
- const error = new Error('fake error in addPropertyValue');
171
- when(mockOs.addPropertyValue).mockRejectedValue(error);
172
- // when save is called
173
- page.rootInstance.selectedTermUri = 'https://schema.org/name';
174
- page.rootInstance.currentValue = 'Test value';
175
- await page.rootInstance.save();
176
- // then a pod-os:error event with the error is received in the listener
177
- expect(eventListener).toHaveBeenCalledWith(expect.objectContaining({
178
- detail: error,
179
- }));
180
- // and the value input is not cleared
181
- expect(page.rootInstance.selectedTermUri).toBe('https://schema.org/name');
182
- expect(page.rootInstance.currentValue).toBe('Test value');
183
- });
184
- });
185
- //# sourceMappingURL=pos-add-literal-value.spec.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"pos-add-literal-value.spec.js","sourceRoot":"","sources":["../../../../../src/components/pos-add-literal-value/test/pos-add-literal-value.spec.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAC9D,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAEjD,QAAQ,CAAC,uBAAuB,EAAE,GAAG,EAAE;EACrC,EAAE,CAAC,2BAA2B,EAAE,KAAK,IAAI,EAAE;IACzC,MAAM,IAAI,GAAG,MAAM,WAAW,CAAC;MAC7B,UAAU,EAAE,CAAC,kBAAkB,CAAC;MAChC,IAAI,EAAE,iDAAiD;KACxD,CAAC,CAAC;IACH,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,WAAW,CAAC;;;;;KAK7B,CAAC,CAAC;EACL,CAAC,CAAC,CAAC;EAEH,EAAE,CAAC,8C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,IAAI,CAAC,IAAI,CAAC,gBAAgB,CAAC,cAAc,EAAE,aAAa,CAAC,CAAC;IAE1D,8CAA8C;IAC9C,MAAM,MAAM,GAAG;MACb,gBAAgB,EAAE,IAAI,CAAC,EAAE,EAAE;KAC5B,CAAC;IACF,IAAI,CAAC,YAAY,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC;IAEvC,sCAAsC;IACtC,MAAM,YAAY,GAAG;MACnB,QAAQ,EAAE,IAAI;KACf,CAAC;IACF,IAAI,CAAC,YAAY,CAAC,eAAe,CAAC,YAAY,CAAC,CAAC;IAChD,MAAM,IAAI,CAAC,cAAc,EAAE,CAAC;IAE5B,iCAAiC;IACjC,MAAM,KAAK,GAAG,IAAI,KAAK,CAAC,gCAAgC,CAAC,CAAC;IAC1D,IAAI,CAAC,MAAM,CAAC,gBAAgB,CAAC,CAAC,iBAAiB,CAAC,KAAK,CAAC,CAAC;IAEvD,sBAAsB;IACtB,IAAI,CAAC,YAAY,CAAC,eAAe,GAAG,yBAAyB,CAAC;IAC9D,IAAI,CAAC,YAAY,CAAC,YAAY,GAAG,YAAY,CAAC;IAC9C,MAAM,IAAI,CAAC,YAAY,CAAC,IAAI,EAAE,CAAC;IAE/B,uEAAuE;IACvE,MAAM,CAAC,aAAa,CAAC,CAAC,oBAAoB,CACxC,MAAM,CAAC,gBAAgB,CAAC;MACtB,MAAM,EAAE,KAAK;KACd,CAAC,CACH,CAAC;IAEF,qCAAqC;IACrC,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,eAAe,CAAC,CAAC,IAAI,CAAC,yBAAyB,CAAC,CAAC;IAC1E,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,YAAY,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;EAC5D,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { Literal } from '@pod-os/core';\nimport { newSpecPage } from '@stencil/core/testing';\nimport { when } from 'jest-when';\nimport { PosAddLiteralValue } from '../pos-add-literal-value';\nimport { fireEvent } from '@testing-library/dom';\n\ndescribe('pos-add-literal-value', () => {\n it('renders nothing initially', async () => {\n const page = await newSpecPage({\n components: [PosAddLiteralValue],\n html: `<pos-add-literal-value></pos-add-literal-value>`,\n });\n expect(page.root).toEqualHtml(`\n <pos-add-literal-value>\n <mock:shadow-root>\n </mock:shadow-root>\n </pos-add-literal-value>\n `);\n });\n\n it('renders nothing, if resource is not editable', async () => {\n const page = await newSpecPage({\n components: [PosAddLiteralValue],\n html: `<pos-add-literal-value></pos-add-literal-value>`,\n });\n page.rootInstance.receiveResource({\n editable: false,\n });\n await page.waitForChanges();\n expect(page.root).toEqualHtml(`\n <pos-add-literal-value>\n <mock:shadow-root>\n </mock:shadow-root>\n </pos-add-literal-value>\n `);\n });\n\n it('renders inputs, if resource is editable', async () => {\n const page = await newSpecPage({\n components: [PosAddLiteralValue],\n html: `<pos-add-literal-value></pos-add-literal-value>`,\n });\n page.rootInstance.receiveResource({\n editable: true,\n });\n await page.waitForChanges();\n expect(page.root).toEqualHtml(`\n <pos-add-literal-value>\n <mock:shadow-root>\n <ion-icon name=\"add-circle-outline\"></ion-icon>\n <pos-select-term placeholder=\"Add literal\"></pos-select-term>\n <ion-input placeholder=\"\"></ion-input>\n </mock:shadow-root>\n </pos-add-literal-value>\n `);\n });\n\n it('focusses the input after a term was selected', async () => {\n // given a page with a pos-add-literal-value component\n const page = await newSpecPage({\n supportsShadowDom: false,\n components: [PosAddLiteralValue],\n html: `<pos-add-literal-value></pos-add-literal-value>`,\n });\n\n // and the component received a PodOs instance\n const mockOs = {\n addPropertyValue: jest.fn(),\n };\n page.rootInstance.receivePodOs(mockOs);\n\n // and the current (editable) resource\n const mockResource = {\n editable: true,\n };\n page.rootInstance.receiveResource(mockResource);\n\n await page.waitForChanges();\n\n const input = page.root.querySelector('ion-input');\n input.setFocus = jest.fn();\n\n // when the user selects a term\n const termSelect = page.root.querySelector('pos-select-term');\n fireEvent(termSelect, new CustomEvent('pod-os:term-selected', { detail: { uri: 'https://schema.org/description' } }));\n\n // then the input is focussed\n expect(input.setFocus).toHaveBeenCalled();\n });\n\n it('changes value and saves value', async () => {\n // given a page with a pos-add-literal-value component\n const page = await newSpecPage({\n supportsShadowDom: false,\n components: [PosAddLiteralValue],\n html: `<pos-add-literal-value></pos-add-literal-value>`,\n });\n\n // and the component received a PodOs instance\n const mockOs = {\n addPropertyValue: jest.fn(),\n };\n page.rootInstance.receivePodOs(mockOs);\n\n // and the current (editable) resource\n const mockResource = {\n editable: true,\n };\n page.rootInstance.receiveResource(mockResource);\n\n await page.waitForChanges();\n\n const input = page.root.querySelector('ion-input');\n input.setFocus = jest.fn();\n\n // when the user selects a term\n const termSelect = page.root.querySelector('pos-select-term');\n fireEvent(termSelect, new CustomEvent('pod-os:term-selected', { detail: { uri: 'https://schema.org/description' } }));\n expect(page.rootInstance.selectedTermUri).toBe('https://schema.org/description');\n\n // when the user types something into the value input\n fireEvent(input, new CustomEvent('ionChange', { detail: { value: 'new value' } }));\n expect(page.rootInstance.currentValue).toBe('new value');\n\n // and the value changes for good\n fireEvent(input, new CustomEvent('change'));\n\n await page.waitForChanges();\n\n // then the value is added to the property of the resource\n expect(mockOs.addPropertyValue).toHaveBeenCalledWith(mockResource, 'https://schema.org/description', 'new value');\n\n // and the value input is cleared\n expect(page.rootInstance.currentValue).toBe('');\n });\n\n it('fires event after save', async () => {\n // given a page with a pos-add-literal-value component\n const page = await newSpecPage({\n supportsShadowDom: false,\n components: [PosAddLiteralValue],\n html: `<pos-add-literal-value></pos-add-literal-value>`,\n });\n\n // and the page listens for pod-os:added-literal-value event\n const eventListener = jest.fn();\n page.root.addEventListener('pod-os:added-literal-value', eventListener);\n\n // and the component received a PodOs instance\n const mockOs = {\n addPropertyValue: jest.fn(),\n };\n page.rootInstance.receivePodOs(mockOs);\n\n // and the current (editable) resource\n const mockResource = {\n editable: true,\n };\n page.rootInstance.receiveResource(mockResource);\n\n await page.waitForChanges();\n\n // when save is called\n page.rootInstance.selectedTermUri = 'https://schema.org/name';\n page.rootInstance.currentValue = 'Test value';\n await page.rootInstance.save();\n\n // then a pod-os:added-literal-value event with the added literal is received in the listener\n const literal: Literal = {\n predicate: 'https://schema.org/name',\n values: ['Test value'],\n };\n expect(eventListener).toHaveBeenCalledWith(\n expect.objectContaining({\n detail: literal,\n }),\n );\n });\n\n it('fires error event and keeps inputs when save failed', async () => {\n // given a page with a pos-add-literal-value component\n const page = await newSpecPage({\n supportsShadowDom: false,\n components: [PosAddLiteralValue],\n html: `<pos-add-literal-value></pos-add-literal-value>`,\n });\n\n // and the page listens for pod-os:error event\n const eventListener = jest.fn();\n page.root.addEventListener('pod-os:error', eventListener);\n\n // and the component received a PodOs instance\n const mockOs = {\n addPropertyValue: jest.fn(),\n };\n page.rootInstance.receivePodOs(mockOs);\n\n // and the current (editable) resource\n const mockResource = {\n editable: true,\n };\n page.rootInstance.receiveResource(mockResource);\n await page.waitForChanges();\n\n // and saving will cause an error\n const error = new Error('fake error in addPropertyValue');\n when(mockOs.addPropertyValue).mockRejectedValue(error);\n\n // when save is called\n page.rootInstance.selectedTermUri = 'https://schema.org/name';\n page.rootInstance.currentValue = 'Test value';\n await page.rootInstance.save();\n\n // then a pod-os:error event with the error is received in the listener\n expect(eventListener).toHaveBeenCalledWith(\n expect.objectContaining({\n detail: error,\n }),\n );\n\n // and the value input is not cleared\n expect(page.rootInstance.selectedTermUri).toBe('https://schema.org/name');\n expect(page.rootInstance.currentValue).toBe('Test value');\n });\n});\n"]}
@@ -1,59 +0,0 @@
1
- import { newSpecPage } from "@stencil/core/testing";
2
- import { screen } from "@testing-library/dom";
3
- import { PosAddNewThing } from "../pos-add-new-thing";
4
- describe('pos-add-new-thing', () => {
5
- it('renders a button and a dialog with form for new thing', async () => {
6
- const page = await newSpecPage({
7
- components: [PosAddNewThing],
8
- html: `<pos-add-new-thing reference-uri="https://pod.test/"></pos-add-new-thing>`,
9
- });
10
- expect(page.root).toEqualHtml(`
11
- <pos-add-new-thing reference-uri="https://pod.test/">
12
- <mock:shadow-root>
13
- <button id="new" title="Add a new thing">
14
- <ion-icon name="add-circle-outline"></ion-icon>
15
- </button>
16
- <dialog>
17
- <header>
18
- <span id="title">
19
- Add a new thing
20
- </span>
21
- <button tabindex="-1" id="close" title="Close">
22
- <ion-icon name="close-outline"></ion-icon>
23
- </button>
24
- </header>
25
- <pos-new-thing-form referenceUri="https://pod.test/" />
26
- </dialog>
27
- </mock:shadow-root>
28
- </pos-add-new-thing>
29
- `);
30
- });
31
- it('opens a modal dialog, when the button is clicked', async () => {
32
- const page = await newSpecPage({
33
- components: [PosAddNewThing],
34
- html: `<pos-add-new-thing reference-uri="https://pod.test/"></pos-add-new-thing>`,
35
- supportsShadowDom: false,
36
- });
37
- const dialog = page.root.querySelector('dialog');
38
- dialog.showModal = jest.fn();
39
- const button = screen.getByTitle('Add a new thing');
40
- button.click();
41
- expect(dialog.showModal).toHaveBeenCalled();
42
- });
43
- it('closes the modal dialog, when the close button is clicked', async () => {
44
- const page = await newSpecPage({
45
- components: [PosAddNewThing],
46
- html: `<pos-add-new-thing reference-uri="https://pod.test/"></pos-add-new-thing>`,
47
- supportsShadowDom: false,
48
- });
49
- const dialog = page.root.querySelector('dialog');
50
- dialog.showModal = jest.fn();
51
- dialog.close = jest.fn();
52
- const button = screen.getByTitle('Add a new thing');
53
- button.click();
54
- const closeButton = screen.getByTitle('Close');
55
- closeButton.click();
56
- expect(dialog.close).toHaveBeenCalled();
57
- });
58
- });
59
- //# sourceMappingURL=pos-add-new-thing.spec.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"pos-add-new-thing.spec.js","sourceRoot":"","sources":["../../../../../src/components/pos-add-new-thing/test/pos-add-new-thing.spec.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,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AC;IAC7B,MAAM,CAAC,KAAK,GAAG,IAAI,CAAC,EAAE,EAAE,CAAC;IAEzB,MAAM,MAAM,GAAG,MAAM,CAAC,UAAU,CAAC,iBAAiB,CAAC,CAAC;IACpD,MAAM,CAAC,KAAK,EAAE,CAAC;IAEf,MAAM,WAAW,GAAG,MAAM,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;IAC/C,WAAW,CAAC,KAAK,EAAE,CAAC;IAEpB,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,gBAAgB,EAAE,CAAC;EAC1C,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { newSpecPage } from '@stencil/core/testing';\nimport { screen } from '@testing-library/dom';\nimport { PosAddNewThing } from '../pos-add-new-thing';\n\ndescribe('pos-add-new-thing', () => {\n it('renders a button and a dialog with form for new thing', async () => {\n const page = await newSpecPage({\n components: [PosAddNewThing],\n html: `<pos-add-new-thing reference-uri=\"https://pod.test/\"></pos-add-new-thing>`,\n });\n expect(page.root).toEqualHtml(`\n<pos-add-new-thing reference-uri=\"https://pod.test/\">\n <mock:shadow-root>\n <button id=\"new\" title=\"Add a new thing\">\n <ion-icon name=\"add-circle-outline\"></ion-icon>\n </button>\n <dialog>\n <header>\n <span id=\"title\">\n Add a new thing\n </span>\n <button tabindex=\"-1\" id=\"close\" title=\"Close\">\n <ion-icon name=\"close-outline\"></ion-icon>\n </button>\n </header>\n <pos-new-thing-form referenceUri=\"https://pod.test/\" />\n </dialog>\n </mock:shadow-root>\n</pos-add-new-thing>\n `);\n });\n\n it('opens a modal dialog, when the button is clicked', async () => {\n const page = await newSpecPage({\n components: [PosAddNewThing],\n html: `<pos-add-new-thing reference-uri=\"https://pod.test/\"></pos-add-new-thing>`,\n supportsShadowDom: false,\n });\n\n const dialog = page.root.querySelector('dialog');\n dialog.showModal = jest.fn();\n\n const button = screen.getByTitle('Add a new thing');\n button.click();\n\n expect(dialog.showModal).toHaveBeenCalled();\n });\n\n it('closes the modal dialog, when the close button is clicked', async () => {\n const page = await newSpecPage({\n components: [PosAddNewThing],\n html: `<pos-add-new-thing reference-uri=\"https://pod.test/\"></pos-add-new-thing>`,\n supportsShadowDom: false,\n });\n\n const dialog = page.root.querySelector('dialog');\n dialog.showModal = jest.fn();\n dialog.close = jest.fn();\n\n const button = screen.getByTitle('Add a new thing');\n button.click();\n\n const closeButton = screen.getByTitle('Close');\n closeButton.click();\n\n expect(dialog.close).toHaveBeenCalled();\n });\n});\n"]}
@@ -1,132 +0,0 @@
1
- jest.mock('@pod-os/core', () => ({}));
2
- import { newSpecPage } from "@stencil/core/testing";
3
- import { PosContainerContents } from "./pos-container-contents";
4
- describe('pos-container-contents', () => {
5
- it('are empty initially', async () => {
6
- const page = await newSpecPage({
7
- components: [PosContainerContents],
8
- html: `<pos-container-contents />`,
9
- });
10
- expect(page.root).toEqualHtml(`
11
- <pos-container-contents>
12
- <mock:shadow-root></mock:shadow-root>
13
- </pos-container-contents>
14
- `);
15
- });
16
- it('renders single file and a link to it', async () => {
17
- const page = await newSpecPage({
18
- components: [PosContainerContents],
19
- html: `<pos-container-contents />`,
20
- });
21
- await page.rootInstance.receiveResource({
22
- assume: () => ({
23
- contains: () => [
24
- {
25
- uri: 'https://pod.test/container/file',
26
- name: 'file',
27
- },
28
- ],
29
- }),
30
- });
31
- await page.waitForChanges();
32
- expect(page.root).toEqualHtml(`<pos-container-contents>
33
- <mock:shadow-root>
34
- <ion-list>
35
- <pos-resource lazy="" uri="https://pod.test/container/file">
36
- <pos-container-item role="listitem">
37
- <ion-label>
38
- <h3>file</h3>
39
- <p>
40
- https://pod.test/container/file
41
- </p>
42
- </ion-label>
43
- </pos-container-item>
44
- </pos-resource>
45
- </ion-list>
46
- </mock:shadow-root>
47
- </pos-container-contents>`);
48
- });
49
- it('renders a note about container being empty', async () => {
50
- const page = await newSpecPage({
51
- components: [PosContainerContents],
52
- html: `<pos-container-contents />`,
53
- });
54
- await page.rootInstance.receiveResource({
55
- assume: () => ({
56
- contains: () => [],
57
- }),
58
- });
59
- await page.waitForChanges();
60
- expect(page.root).toEqualHtml(`<pos-container-contents>
61
- <mock:shadow-root>
62
- <p>
63
- The container is empty
64
- </p>
65
- </mock:shadow-root>
66
- </pos-container-contents>
67
- `);
68
- });
69
- it('renders multiple contents and links to them, sorted alphabetically', async () => {
70
- const page = await newSpecPage({
71
- components: [PosContainerContents],
72
- html: `<pos-container-contents />`,
73
- });
74
- await page.rootInstance.receiveResource({
75
- assume: () => ({
76
- contains: () => [
77
- {
78
- uri: 'https://pod.test/container/file',
79
- name: 'file',
80
- },
81
- {
82
- uri: 'https://pod.test/container/subdir/',
83
- name: 'subdir',
84
- },
85
- {
86
- uri: 'https://pod.test/container/a-file-on-top-of-the-list',
87
- name: 'a-file-on-top-of-the-list',
88
- },
89
- ],
90
- }),
91
- });
92
- await page.waitForChanges();
93
- expect(page.root).toEqualHtml(`
94
- <pos-container-contents>
95
- <mock:shadow-root>
96
- <ion-list>
97
- <pos-resource lazy="" uri="https://pod.test/container/a-file-on-top-of-the-list">
98
- <pos-container-item role="listitem">
99
- <ion-label>
100
- <h3>a-file-on-top-of-the-list</h3>
101
- <p>
102
- https://pod.test/container/a-file-on-top-of-the-list
103
- </p>
104
- </ion-label>
105
- </pos-container-item>
106
- </pos-resource>
107
- <pos-resource lazy="" uri="https://pod.test/container/file">
108
- <pos-container-item role="listitem">
109
- <ion-label>
110
- <h3>file</h3>
111
- <p>
112
- https://pod.test/container/file
113
- </p>
114
- </ion-label>
115
- </pos-container-item>
116
- </pos-resource>
117
- <pos-resource lazy="" uri="https://pod.test/container/subdir/">
118
- <pos-container-item role="listitem">
119
- <ion-label>
120
- <h3>subdir</h3>
121
- <p>
122
- https://pod.test/container/subdir/
123
- </p>
124
- </ion-label>
125
- </pos-container-item>
126
- </pos-resource>
127
- </ion-list>
128
- </mock:shadow-root>
129
- </pos-container-contents>`);
130
- });
131
- });
132
- //# sourceMappingURL=pos-container-contents.spec.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"pos-container-contents.spec.js","sourceRoot":"","sources":["../../../../src/components/pos-container-contents/pos-container-contents.spec.tsx"],"names":[],"mappings":"AAAA,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AAEtC,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAEpD,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAEhE,QAAQ,CAAC,wBAAwB,EAAE,GAAG,EAAE;EACtC,EAAE,CAAC,qBAAqB,EAAE,KAAK,IAAI,EAAE;IACnC,MAAM,IAAI,GAAG,MAAM,WAAW,CAAC;MAC7B,UAAU,EAAE,CAAC,oBAAoB,CAAC;MAClC,IAAI,EAAE,4BAA4B;KACnC,CAAC,CAAC;IACH,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,WAAW,CAAC;;;;GAI/B,CAAC,CAAC;EACH,CAAC,CAAC,CAAC;EAEH,EAAE,CAAC,sCAAsC,EAAE,KAAK,IAAI,EAAE;IACpD,MAAM,IAAI,GAAG,MAAM,WAAW,CAAC;MAC7B,UAAU,EAAE,CAAC,oBAAoB,CAAC;MAClC,IAAI,EAAE,4BAA4B;KACnC,CAAC,CAAC;IACH,MAAM,IAAI,CAAC,YAAY,CAAC,eAAe,CAAC;MACtC,MAAM,EAAE,GAAG,EAAE,CAAC,CAAC;QACb,QAAQ,EAAE,GAAG,EAAE,CAAC;UACd;YACE,GAAG,EAAE,iCAAiC;YACtC,IAAI,EAAE,MAAM;WACb;SACF;OACF,CAAC;KACH,CAAC,CAAC;IACH,MAAM,IAAI,CAAC,cAAc,EAAE,CAAC;IAE5B,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,WAAW,CAAC;;;;;;;;;;;;;;;0BAeR,CAAC,CAAC;EAC1B,CAAC,CAAC,CAAC;EAEH,EAAE,CAAC,4CAA4C,EAAE,KAAK,IAA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encil/core/testing';\n\nimport { PosContainerContents } from './pos-container-contents';\n\ndescribe('pos-container-contents', () => {\n it('are empty initially', async () => {\n const page = await newSpecPage({\n components: [PosContainerContents],\n html: `<pos-container-contents />`,\n });\n expect(page.root).toEqualHtml(`\n <pos-container-contents>\n <mock:shadow-root></mock:shadow-root>\n </pos-container-contents>\n `);\n });\n\n it('renders single file and a link to it', async () => {\n const page = await newSpecPage({\n components: [PosContainerContents],\n html: `<pos-container-contents />`,\n });\n await page.rootInstance.receiveResource({\n assume: () => ({\n contains: () => [\n {\n uri: 'https://pod.test/container/file',\n name: 'file',\n },\n ],\n }),\n });\n await page.waitForChanges();\n\n expect(page.root).toEqualHtml(`<pos-container-contents>\n <mock:shadow-root>\n <ion-list>\n <pos-resource lazy=\"\" uri=\"https://pod.test/container/file\">\n <pos-container-item role=\"listitem\">\n <ion-label>\n <h3>file</h3>\n <p>\n https://pod.test/container/file\n </p>\n </ion-label>\n </pos-container-item>\n </pos-resource>\n </ion-list>\n </mock:shadow-root>\n</pos-container-contents>`);\n });\n\n it('renders a note about container being empty', async () => {\n const page = await newSpecPage({\n components: [PosContainerContents],\n html: `<pos-container-contents />`,\n });\n await page.rootInstance.receiveResource({\n assume: () => ({\n contains: () => [],\n }),\n });\n await page.waitForChanges();\n\n expect(page.root).toEqualHtml(`<pos-container-contents>\n <mock:shadow-root>\n <p>\n The container is empty\n </p>\n </mock:shadow-root>\n </pos-container-contents>\n `);\n });\n\n it('renders multiple contents and links to them, sorted alphabetically', async () => {\n const page = await newSpecPage({\n components: [PosContainerContents],\n html: `<pos-container-contents />`,\n });\n await page.rootInstance.receiveResource({\n assume: () => ({\n contains: () => [\n {\n uri: 'https://pod.test/container/file',\n name: 'file',\n },\n {\n uri: 'https://pod.test/container/subdir/',\n name: 'subdir',\n },\n {\n uri: 'https://pod.test/container/a-file-on-top-of-the-list',\n name: 'a-file-on-top-of-the-list',\n },\n ],\n }),\n });\n await page.waitForChanges();\n\n expect(page.root).toEqualHtml(`\n <pos-container-contents>\n <mock:shadow-root>\n <ion-list>\n <pos-resource lazy=\"\" uri=\"https://pod.test/container/a-file-on-top-of-the-list\">\n <pos-container-item role=\"listitem\">\n <ion-label>\n <h3>a-file-on-top-of-the-list</h3>\n <p>\n https://pod.test/container/a-file-on-top-of-the-list\n </p>\n </ion-label>\n </pos-container-item>\n </pos-resource>\n <pos-resource lazy=\"\" uri=\"https://pod.test/container/file\">\n <pos-container-item role=\"listitem\">\n <ion-label>\n <h3>file</h3>\n <p>\n https://pod.test/container/file\n </p>\n </ion-label>\n </pos-container-item>\n </pos-resource>\n <pos-resource lazy=\"\" uri=\"https://pod.test/container/subdir/\">\n <pos-container-item role=\"listitem\">\n <ion-label>\n <h3>subdir</h3>\n <p>\n https://pod.test/container/subdir/\n </p>\n </ion-label>\n </pos-container-item>\n </pos-resource>\n </ion-list>\n </mock:shadow-root>\n </pos-container-contents>`);\n });\n});\n"]}
@@ -1,64 +0,0 @@
1
- jest.mock('@pod-os/core', () => ({}));
2
- import { newSpecPage } from "@stencil/core/testing";
3
- import { PosContainerItem } from "./pos-container-item";
4
- describe('pos-container-item', () => {
5
- it('only shows the body initially', async () => {
6
- const page = await newSpecPage({
7
- components: [PosContainerItem],
8
- html: `<pos-container-item>item body</pos-container-item>`,
9
- supportsShadowDom: false,
10
- });
11
- expect(page.root).toEqualHtml(`
12
- <pos-container-item>
13
- item body
14
- </pos-container-item>
15
- `);
16
- });
17
- it('renders item with document icon for ldp resources', async () => {
18
- const page = await newSpecPage({
19
- components: [PosContainerItem],
20
- html: `<pos-container-item>file name</pos-container-item>`,
21
- supportsShadowDom: false,
22
- });
23
- await page.rootInstance.receiveResource({
24
- types: () => [
25
- {
26
- uri: 'http://www.w3.org/ns/ldp#Resource',
27
- },
28
- ],
29
- });
30
- await page.waitForChanges();
31
- expect(page.root).toEqualHtml(`
32
- <pos-container-item>
33
- <ion-item>
34
- <ion-icon name="document-outline" slot="start"></ion-icon>
35
- file name
36
- </ion-item>
37
- </pos-container-item>
38
- `);
39
- });
40
- it('renders item with folder icon for ldp containers', async () => {
41
- const page = await newSpecPage({
42
- components: [PosContainerItem],
43
- html: `<pos-container-item>folder name</pos-container-item>`,
44
- supportsShadowDom: false,
45
- });
46
- await page.rootInstance.receiveResource({
47
- types: () => [
48
- {
49
- uri: 'http://www.w3.org/ns/ldp#Container',
50
- },
51
- ],
52
- });
53
- await page.waitForChanges();
54
- expect(page.root).toEqualHtml(`
55
- <pos-container-item>
56
- <ion-item>
57
- <ion-icon name="folder-outline" slot="start"></ion-icon>
58
- folder name
59
- </ion-item>
60
- </pos-container-item>
61
- `);
62
- });
63
- });
64
- //# sourceMappingURL=pos-container-item.spec.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"pos-container-item.spec.js","sourceRoot":"","sources":["../../../../src/components/pos-container-contents/pos-container-item.spec.tsx"],"names":[],"mappings":"AAAA,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AAEtC,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAEpD,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAExD,QAAQ,CAAC,oBAAoB,EAAE,GAAG,EAAE;EAClC,EAAE,CAAC,+BAA+B,EAAE,KAAK,IAAI,EAAE;IAC7C,MAAM,IAAI,GAAG,MAAM,WAAW,CAAC;MAC7B,UAAU,EAAE,CAAC,gBAAgB,CAAC;MAC9B,IAAI,EAAE,oDAAoD;MAC1D,iBAAiB,EAAE,KAAK;KACzB,CAAC,CAAC;IACH,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,WAAW,CAAC;;;;GAI/B,CAAC,CAAC;EACH,CAAC,CAAC,CAAC;EAEH,EAAE,CAAC,mDAAmD,EAAE,KAAK,IAAI,EAAE;IACjE,MAAM,IAAI,GAAG,MAAM,WAAW,CAAC;MAC7B,UAAU,EAAE,CAAC,gBAAgB,CAAC;MAC9B,IAAI,EAAE,oDAAoD;MAC1D,iBAAiB,EAAE,KAAK;KACzB,CAAC,CAAC;IACH,MAAM,IAAI,CAAC,YAAY,CAAC,eAAe,CAAC;MACtC,KAAK,EAAE,GAAG,EAAE,CAAC;QACX;UACE,GAAG,EAAE,mCAAmC;SACzC;OACF;KACF,CAAC,CAAC;IACH,MAAM,IAAI,CAAC,cAAc,EAAE,CAAC;IAE5B,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,WAAW,CAAC;;;;;;;KAO7B,CAAC,CAAC;EACL,CAAC,CAAC,CAAC;EAEH,EAAE,CAAC,kDAAkD,EAAE,KAAK,IAAI,EAAE;IAChE,MAAM,IAAI,GAAG,MAAM,WAAW,CAAC;MAC7B,UAAU,EAAE,CAAC,gBAAgB,CAAC;MAC9B,IAAI,EAAE,sDAAsD;MAC5D,iBAAiB,EAAE,KAAK;KACzB,CAAC,CAAC;IACH,MAAM,IAAI,CAAC,YAAY,CAAC,eAAe,CAAC;MACtC,KAAK,EAAE,GAAG,EAAE,CAAC;QACX;UACE,GAAG,EAAE,oCAAoC;SAC1C;OACF;KACF,CAAC,CAAC;IACH,MAAM,IAAI,CAAC,cAAc,EAAE,CAAC;IAE5B,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,WAAW,CAAC;;;;;;;KAO7B,CAAC,CAAC;EACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["jest.mock('@pod-os/core', () => ({}));\n\nimport { newSpecPage } from '@stencil/core/testing';\n\nimport { PosContainerItem } from './pos-container-item';\n\ndescribe('pos-container-item', () => {\n it('only shows the body initially', async () => {\n const page = await newSpecPage({\n components: [PosContainerItem],\n html: `<pos-container-item>item body</pos-container-item>`,\n supportsShadowDom: false,\n });\n expect(page.root).toEqualHtml(`\n <pos-container-item>\n item body\n </pos-container-item>\n `);\n });\n\n it('renders item with document icon for ldp resources', async () => {\n const page = await newSpecPage({\n components: [PosContainerItem],\n html: `<pos-container-item>file name</pos-container-item>`,\n supportsShadowDom: false,\n });\n await page.rootInstance.receiveResource({\n types: () => [\n {\n uri: 'http://www.w3.org/ns/ldp#Resource',\n },\n ],\n });\n await page.waitForChanges();\n\n expect(page.root).toEqualHtml(`\n <pos-container-item>\n <ion-item>\n <ion-icon name=\"document-outline\" slot=\"start\"></ion-icon>\n file name\n </ion-item>\n </pos-container-item>\n `);\n });\n\n it('renders item with folder icon for ldp containers', async () => {\n const page = await newSpecPage({\n components: [PosContainerItem],\n html: `<pos-container-item>folder name</pos-container-item>`,\n supportsShadowDom: false,\n });\n await page.rootInstance.receiveResource({\n types: () => [\n {\n uri: 'http://www.w3.org/ns/ldp#Container',\n },\n ],\n });\n await page.waitForChanges();\n\n expect(page.root).toEqualHtml(`\n <pos-container-item>\n <ion-item>\n <ion-icon name=\"folder-outline\" slot=\"start\"></ion-icon>\n folder name\n </ion-item>\n </pos-container-item>\n `);\n });\n});\n"]}
@@ -1,30 +0,0 @@
1
- import { selectIconForTypes } from "./selectIconForTypes";
2
- describe('select icon for types', () => {
3
- it('selects a folder icon for containers', () => {
4
- const icon = selectIconForTypes([
5
- {
6
- uri: 'http://www.w3.org/ns/ldp#Resource',
7
- label: 'irrelevant here',
8
- },
9
- {
10
- uri: 'http://www.w3.org/ns/ldp#Container',
11
- label: 'irrelevant here',
12
- },
13
- ]);
14
- expect(icon).toEqual('folder-outline');
15
- });
16
- it('selects a file icon for other ldp resources', () => {
17
- const icon = selectIconForTypes([
18
- {
19
- uri: 'http://www.w3.org/ns/ldp#Resource',
20
- label: 'irrelevant here',
21
- },
22
- ]);
23
- expect(icon).toEqual('document-outline');
24
- });
25
- it('selects question mark icon if types are empty', () => {
26
- const icon = selectIconForTypes([]);
27
- expect(icon).toEqual('help-outline');
28
- });
29
- });
30
- //# sourceMappingURL=selectIconForTypes.spec.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"selectIconForTypes.spec.js","sourceRoot":"","sources":["../../../../src/components/pos-container-contents/selectIconForTypes.spec.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE1D,QAAQ,CAAC,uBAAuB,EAAE,GAAG,EAAE;EACrC,EAAE,CAAC,sCAAsC,EAAE,GAAG,EAAE;IAC9C,MAAM,IAAI,GAAG,kBAAkB,CAAC;MAC9B;QACE,GAAG,EAAE,mCAAmC;QACxC,KAAK,EAAE,iBAAiB;OACzB;MACD;QACE,GAAG,EAAE,oCAAoC;QACzC,KAAK,EAAE,iBAAiB;OACzB;KACF,CAAC,CAAC;IACH,MAAM,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAAC;EACzC,CAAC,CAAC,CAAC;EAEH,EAAE,CAAC,6CAA6C,EAAE,GAAG,EAAE;IACrD,MAAM,IAAI,GAAG,kBAAkB,CAAC;MAC9B;QACE,GAAG,EAAE,mCAAmC;QACxC,KAAK,EAAE,iBAAiB;OACzB;KACF,CAAC,CAAC;IACH,MAAM,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,kBAAkB,CAAC,CAAC;EAC3C,CAAC,CAAC,CAAC;EAEH,EAAE,CAAC,+CAA+C,EAAE,GAAG,EAAE;IACvD,MAAM,IAAI,GAAG,kBAAkB,CAAC,EAAE,CAAC,CAAC;IACpC,MAAM,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC;EACvC,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { selectIconForTypes } from './selectIconForTypes';\n\ndescribe('select icon for types', () => {\n it('selects a folder icon for containers', () => {\n const icon = selectIconForTypes([\n {\n uri: 'http://www.w3.org/ns/ldp#Resource',\n label: 'irrelevant here',\n },\n {\n uri: 'http://www.w3.org/ns/ldp#Container',\n label: 'irrelevant here',\n },\n ]);\n expect(icon).toEqual('folder-outline');\n });\n\n it('selects a file icon for other ldp resources', () => {\n const icon = selectIconForTypes([\n {\n uri: 'http://www.w3.org/ns/ldp#Resource',\n label: 'irrelevant here',\n },\n ]);\n expect(icon).toEqual('document-outline');\n });\n\n it('selects question mark icon if types are empty', () => {\n const icon = selectIconForTypes([]);\n expect(icon).toEqual('help-outline');\n });\n});\n"]}
@@ -1,31 +0,0 @@
1
- import { newSpecPage } from "@stencil/core/testing";
2
- import { PosDescription } from "./pos-description";
3
- describe('pos-description', () => {
4
- it('is empty initially', async () => {
5
- const page = await newSpecPage({
6
- components: [PosDescription],
7
- html: `<pos-description />`,
8
- });
9
- expect(page.root).toEqualHtml(`
10
- <pos-description>
11
- <mock:shadow-root></mock:shadow-root>
12
- </pos-description>
13
- `);
14
- });
15
- it('renders description from resource', async () => {
16
- const page = await newSpecPage({
17
- components: [PosDescription],
18
- html: `<pos-description />`,
19
- });
20
- await page.rootInstance.receiveResource({
21
- description: () => 'Test Resource',
22
- });
23
- await page.waitForChanges();
24
- expect(page.root).toEqualHtml(`
25
- <pos-description>
26
- <mock:shadow-root>Test Resource</mock:shadow-root>
27
- </pos-description>
28
- `);
29
- });
30
- });
31
- //# sourceMappingURL=pos-description.spec.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"pos-description.spec.js","sourceRoot":"","sources":["../../../../src/components/pos-description/pos-description.spec.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAEnD,QAAQ,CAAC,iBAAiB,EAAE,GAAG,EAAE;EAC/B,EAAE,CAAC,oBAAoB,EAAE,KAAK,IAAI,EAAE;IAClC,MAAM,IAAI,GAAG,MAAM,WAAW,CAAC;MAC7B,UAAU,EAAE,CAAC,cAAc,CAAC;MAC5B,IAAI,EAAE,qBAAqB;KAC5B,CAAC,CAAC;IACH,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,WAAW,CAAC;;;;GAI/B,CAAC,CAAC;EACH,CAAC,CAAC,CAAC;EAEH,EAAE,CAAC,mCAAmC,EAAE,KAAK,IAAI,EAAE;IACjD,MAAM,IAAI,GAAG,MAAM,WAAW,CAAC;MAC7B,UAAU,EAAE,CAAC,cAAc,CAAC;MAC5B,IAAI,EAAE,qBAAqB;KAC5B,CAAC,CAAC;IACH,MAAM,IAAI,CAAC,YAAY,CAAC,eAAe,CAAC;MACtC,WAAW,EAAE,GAAG,EAAE,CAAC,eAAe;KACnC,CAAC,CAAC;IACH,MAAM,IAAI,CAAC,cAAc,EAAE,CAAC;IAC5B,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,WAAW,CAAC;;;;GAI/B,CAAC,CAAC;EACH,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { newSpecPage } from '@stencil/core/testing';\nimport { PosDescription } from './pos-description';\n\ndescribe('pos-description', () => {\n it('is empty initially', async () => {\n const page = await newSpecPage({\n components: [PosDescription],\n html: `<pos-description />`,\n });\n expect(page.root).toEqualHtml(`\n <pos-description>\n <mock:shadow-root></mock:shadow-root>\n </pos-description>\n `);\n });\n\n it('renders description from resource', async () => {\n const page = await newSpecPage({\n components: [PosDescription],\n html: `<pos-description />`,\n });\n await page.rootInstance.receiveResource({\n description: () => 'Test Resource',\n });\n await page.waitForChanges();\n expect(page.root).toEqualHtml(`\n <pos-description>\n <mock:shadow-root>Test Resource</mock:shadow-root>\n </pos-description>\n `);\n });\n});\n"]}