@cratis/scene.blueprint.components 4.1.1 → 4.2.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.
- package/dist/esm/tsconfig.tsbuildinfo +1 -1
- package/package.json +23 -22
- package/dist/esm/for_ArcPageHeader/when_rendering_a_gallery_screen.d.ts +0 -2
- package/dist/esm/for_ArcPageHeader/when_rendering_a_gallery_screen.d.ts.map +0 -1
- package/dist/esm/for_ArcPageHeader/when_rendering_a_gallery_screen.js +0 -58
- package/dist/esm/for_ArcPageHeader/when_rendering_a_gallery_screen.js.map +0 -1
- package/dist/esm/for_CompositeName/when_checking_the_names_against_the_packages_that_declare_them.d.ts +0 -2
- package/dist/esm/for_CompositeName/when_checking_the_names_against_the_packages_that_declare_them.d.ts.map +0 -1
- package/dist/esm/for_CompositeName/when_checking_the_names_against_the_packages_that_declare_them.js +0 -26
- package/dist/esm/for_CompositeName/when_checking_the_names_against_the_packages_that_declare_them.js.map +0 -1
- package/dist/esm/for_componentsBlueprint/when_resolving_its_dependencies.d.ts +0 -2
- package/dist/esm/for_componentsBlueprint/when_resolving_its_dependencies.d.ts.map +0 -1
- package/dist/esm/for_componentsBlueprint/when_resolving_its_dependencies.js +0 -65
- package/dist/esm/for_componentsBlueprint/when_resolving_its_dependencies.js.map +0 -1
- package/dist/esm/for_componentsBlueprint/when_validating_the_bundle.d.ts +0 -2
- package/dist/esm/for_componentsBlueprint/when_validating_the_bundle.d.ts.map +0 -1
- package/dist/esm/for_componentsBlueprint/when_validating_the_bundle.js +0 -41
- package/dist/esm/for_componentsBlueprint/when_validating_the_bundle.js.map +0 -1
- package/dist/esm/for_componentsGalleryScreens/when_checking_the_layouts_and_slots_they_fill.d.ts +0 -2
- package/dist/esm/for_componentsGalleryScreens/when_checking_the_layouts_and_slots_they_fill.d.ts.map +0 -1
- package/dist/esm/for_componentsGalleryScreens/when_checking_the_layouts_and_slots_they_fill.js +0 -38
- package/dist/esm/for_componentsGalleryScreens/when_checking_the_layouts_and_slots_they_fill.js.map +0 -1
- package/dist/esm/for_componentsScreenTemplates/when_checking_that_arrangements_reference_declared_slots.d.ts +0 -2
- package/dist/esm/for_componentsScreenTemplates/when_checking_that_arrangements_reference_declared_slots.d.ts.map +0 -1
- package/dist/esm/for_componentsScreenTemplates/when_checking_that_arrangements_reference_declared_slots.js +0 -47
- package/dist/esm/for_componentsScreenTemplates/when_checking_that_arrangements_reference_declared_slots.js.map +0 -1
- package/dist/esm/for_componentsScreenTemplates/when_following_the_nesting_chain.d.ts +0 -2
- package/dist/esm/for_componentsScreenTemplates/when_following_the_nesting_chain.d.ts.map +0 -1
- package/dist/esm/for_componentsScreenTemplates/when_following_the_nesting_chain.js +0 -56
- package/dist/esm/for_componentsScreenTemplates/when_following_the_nesting_chain.js.map +0 -1
- package/dist/esm/for_componentsScreenTemplates/when_placing_them_in_the_default_blueprint_layout.d.ts +0 -2
- package/dist/esm/for_componentsScreenTemplates/when_placing_them_in_the_default_blueprint_layout.d.ts.map +0 -1
- package/dist/esm/for_componentsScreenTemplates/when_placing_them_in_the_default_blueprint_layout.js +0 -31
- package/dist/esm/for_componentsScreenTemplates/when_placing_them_in_the_default_blueprint_layout.js.map +0 -1
- package/dist/esm/for_componentsScreenTemplates/when_resolving_the_component_names_they_reference.d.ts +0 -2
- package/dist/esm/for_componentsScreenTemplates/when_resolving_the_component_names_they_reference.d.ts.map +0 -1
- package/dist/esm/for_componentsScreenTemplates/when_resolving_the_component_names_they_reference.js +0 -54
- package/dist/esm/for_componentsScreenTemplates/when_resolving_the_component_names_they_reference.js.map +0 -1
- package/dist/esm/for_deriveArcHeading/when_no_binding_is_named.d.ts +0 -2
- package/dist/esm/for_deriveArcHeading/when_no_binding_is_named.d.ts.map +0 -1
- package/dist/esm/for_deriveArcHeading/when_no_binding_is_named.js +0 -27
- package/dist/esm/for_deriveArcHeading/when_no_binding_is_named.js.map +0 -1
- package/dist/esm/for_deriveArcHeading/when_the_binding_is_not_registered.d.ts +0 -2
- package/dist/esm/for_deriveArcHeading/when_the_binding_is_not_registered.d.ts.map +0 -1
- package/dist/esm/for_deriveArcHeading/when_the_binding_is_not_registered.js +0 -18
- package/dist/esm/for_deriveArcHeading/when_the_binding_is_not_registered.js.map +0 -1
- package/dist/esm/for_deriveArcHeading/when_the_binding_is_registered.d.ts +0 -2
- package/dist/esm/for_deriveArcHeading/when_the_binding_is_registered.d.ts.map +0 -1
- package/dist/esm/for_deriveArcHeading/when_the_binding_is_registered.js +0 -26
- package/dist/esm/for_deriveArcHeading/when_the_binding_is_registered.js.map +0 -1
- package/dist/esm/for_humanizeBindingName/when_reading_a_proxy_name.d.ts +0 -2
- package/dist/esm/for_humanizeBindingName/when_reading_a_proxy_name.d.ts.map +0 -1
- package/dist/esm/for_humanizeBindingName/when_reading_a_proxy_name.js +0 -25
- package/dist/esm/for_humanizeBindingName/when_reading_a_proxy_name.js.map +0 -1
- package/for_ArcPageHeader/when_rendering_a_gallery_screen.tsx +0 -86
- package/for_CompositeName/when_checking_the_names_against_the_packages_that_declare_them.ts +0 -41
- package/for_componentsBlueprint/when_resolving_its_dependencies.ts +0 -93
- package/for_componentsBlueprint/when_validating_the_bundle.ts +0 -55
- package/for_componentsGalleryScreens/when_checking_the_layouts_and_slots_they_fill.ts +0 -56
- package/for_componentsScreenTemplates/when_checking_that_arrangements_reference_declared_slots.ts +0 -66
- package/for_componentsScreenTemplates/when_following_the_nesting_chain.ts +0 -83
- package/for_componentsScreenTemplates/when_placing_them_in_the_default_blueprint_layout.ts +0 -51
- package/for_componentsScreenTemplates/when_resolving_the_component_names_they_reference.ts +0 -72
- package/for_deriveArcHeading/when_no_binding_is_named.ts +0 -42
- package/for_deriveArcHeading/when_the_binding_is_not_registered.ts +0 -25
- package/for_deriveArcHeading/when_the_binding_is_registered.ts +0 -35
- package/for_humanizeBindingName/when_reading_a_proxy_name.ts +0 -34
package/dist/esm/for_componentsScreenTemplates/when_resolving_the_component_names_they_reference.js
DELETED
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import { resolveComponentName } from '@cratis/scene.engine';
|
|
2
|
-
import { composeScreenElement, defaultBlueprintName, distinctComponentNames } from '@cratis/scene.blueprint.default';
|
|
3
|
-
import { cratisComponentsPackageManifest } from '@cratis/scene.components';
|
|
4
|
-
import { ComponentName } from '../ComponentName';
|
|
5
|
-
import { CompositeName } from '../CompositeName';
|
|
6
|
-
import { componentsBlueprintCatalog, componentsBlueprintProfile, componentsGalleryScreens } from '../gallery';
|
|
7
|
-
import { componentsBlueprintName } from '../packageName';
|
|
8
|
-
import { componentsDialogTemplates } from '../templates';
|
|
9
|
-
describe('when resolving the component names they reference', () => {
|
|
10
|
-
const fromScreens = distinctComponentNames(componentsGalleryScreens.map(composeScreenElement));
|
|
11
|
-
const fromDialogs = distinctComponentNames(componentsDialogTemplates.flatMap(template => Object.values(template.content ?? {}).flat()));
|
|
12
|
-
const names = [...new Set([...fromScreens, ...fromDialogs])].sort();
|
|
13
|
-
const resolutions = names.map(name => ({ name, resolution: resolveComponentName(name, componentsBlueprintProfile, componentsBlueprintCatalog) }));
|
|
14
|
-
it('should reference something', () => {
|
|
15
|
-
names.should.not.be.empty;
|
|
16
|
-
});
|
|
17
|
-
it('should reference something from the dialog templates too', () => {
|
|
18
|
-
fromDialogs.should.not.be.empty;
|
|
19
|
-
});
|
|
20
|
-
it('should resolve every referenced name against the profile', () => {
|
|
21
|
-
resolutions
|
|
22
|
-
.filter(entry => entry.resolution === undefined)
|
|
23
|
-
.map(entry => entry.name)
|
|
24
|
-
.should.be.empty;
|
|
25
|
-
});
|
|
26
|
-
it('should resolve its own page header to itself', () => {
|
|
27
|
-
resolveComponentName(ComponentName.ArcPageHeader, componentsBlueprintProfile, componentsBlueprintCatalog).package.should.equal(componentsBlueprintName);
|
|
28
|
-
});
|
|
29
|
-
it('should reference every component it registers, so nothing is declared and then unused', () => {
|
|
30
|
-
const referenced = new Set(names);
|
|
31
|
-
Object.values(ComponentName)
|
|
32
|
-
.filter(name => !referenced.has(name))
|
|
33
|
-
.should.be.empty;
|
|
34
|
-
});
|
|
35
|
-
it('should resolve the shell components to the blueprint it layers on', () => {
|
|
36
|
-
resolveComponentName('appShell', componentsBlueprintProfile, componentsBlueprintCatalog).package.should.equal(defaultBlueprintName);
|
|
37
|
-
});
|
|
38
|
-
it('should resolve the Arc-bound composites to the component library', () => {
|
|
39
|
-
resolutions
|
|
40
|
-
.filter(entry => Object.values(CompositeName).includes(entry.name))
|
|
41
|
-
.filter(entry => entry.resolution?.package !== cratisComponentsPackageManifest.name)
|
|
42
|
-
.map(entry => entry.name)
|
|
43
|
-
.should.be.empty;
|
|
44
|
-
});
|
|
45
|
-
it('should resolve a name both libraries declare to the Arc-aware one, and record the other as shadowed', () => {
|
|
46
|
-
const dataTable = resolveComponentName(CompositeName.DataTable, componentsBlueprintProfile, componentsBlueprintCatalog);
|
|
47
|
-
dataTable.package.should.equal(cratisComponentsPackageManifest.name);
|
|
48
|
-
dataTable.shadows.should.contain('PrimeReact');
|
|
49
|
-
});
|
|
50
|
-
it('should resolve the borrowed column to PrimeReact, since neither library declares one', () => {
|
|
51
|
-
resolveComponentName('column', componentsBlueprintProfile, componentsBlueprintCatalog).package.should.equal('PrimeReact');
|
|
52
|
-
});
|
|
53
|
-
});
|
|
54
|
-
//# sourceMappingURL=when_resolving_the_component_names_they_reference.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"when_resolving_the_component_names_they_reference.js","sourceRoot":"","sources":["../../../for_componentsScreenTemplates/when_resolving_the_component_names_they_reference.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,sBAAsB,EAAE,MAAM,iCAAiC,CAAC;AACrH,OAAO,EAAE,+BAA+B,EAAE,MAAM,0BAA0B,CAAC;AAC3E,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD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AI,CAAC;aACxB,MAAM,CAAC,EAAE,CAAC,KAAK,CAAC;IACzB,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,qGAAqG,EAAE,GAAG,EAAE;QAC3G,MAAM,SAAS,GAAG,oBAAoB,CAAC,aAAa,CAAC,SAAS,EAAE,0BAA0B,EAAE,0BAA0B,CAAE,CAAC;QACzH,SAAS,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,+BAA+B,CAAC,IAAI,CAAC,CAAC;QACrE,SAAS,CAAC,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;IACnD,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,sFAAsF,EAAE,GAAG,EAAE;QAC5F,oBAAoB,CAAC,QAAQ,EAAE,0BAA0B,EAAE,0BAA0B,CAAE,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC;IAC/H,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"when_no_binding_is_named.d.ts","sourceRoot":"","sources":["../../../for_deriveArcHeading/when_no_binding_is_named.ts"],"names":[],"mappings":""}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { BindingKind } from '@cratis/scene.components';
|
|
2
|
-
import { deriveArcHeading } from '../header';
|
|
3
|
-
describe('when no binding is named', () => {
|
|
4
|
-
const heading = deriveArcHeading({ title: 'InvoiceRegistered' }, {}, BindingKind.Query);
|
|
5
|
-
it('should use the title the template gave it', () => {
|
|
6
|
-
heading.title.should.equal('InvoiceRegistered');
|
|
7
|
-
});
|
|
8
|
-
it('should build a trail of just the title when no section was given', () => {
|
|
9
|
-
heading.trail.should.deep.equal(['InvoiceRegistered']);
|
|
10
|
-
});
|
|
11
|
-
it('should report that it is not bound', () => {
|
|
12
|
-
heading.isBound.should.be.false;
|
|
13
|
-
});
|
|
14
|
-
it('should state the absence plainly rather than naming a binding nobody asked for', () => {
|
|
15
|
-
heading.bindingLabel.should.equal('No binding');
|
|
16
|
-
});
|
|
17
|
-
it('should carry no binding name', () => {
|
|
18
|
-
(heading.bindingName === undefined).should.be.true;
|
|
19
|
-
});
|
|
20
|
-
describe('and the template gave no title either', () => {
|
|
21
|
-
const untitled = deriveArcHeading({}, {}, BindingKind.Query);
|
|
22
|
-
it('should fall back to something readable rather than an empty heading', () => {
|
|
23
|
-
untitled.title.should.equal('Untitled page');
|
|
24
|
-
});
|
|
25
|
-
});
|
|
26
|
-
});
|
|
27
|
-
//# sourceMappingURL=when_no_binding_is_named.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"when_no_binding_is_named.js","sourceRoot":"","sources":["../../../for_deriveArcHeading/when_no_binding_is_named.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAO7C,QAAQ,CAAC,0BAA0B,EAAE,GAAG,EAAE;IACtC,MAAM,OAAO,GAAG,gBAAgB,CAAC,EAAE,KAAK,EAAE,mBAAmB,EAAE,EAAE,EAAE,EAAE,WAAW,CAAC,KAAK,CAAC,CAAC;IAExF,EAAE,CAAC,2CAA2C,EAAE,GAAG,EAAE;QACjD,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,mBAAmB,CAAC,CAAC;IACpD,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,kEAAkE,EAAE,GAAG,EAAE;QACxE,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,mBAAmB,CAAC,CAAC,CAAC;IAC3D,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,oCAAoC,EAAE,GAAG,EAAE;QAC1C,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC,KAAK,CAAC;IACpC,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,gFAAgF,EAAE,GAAG,EAAE;QACtF,OAAO,CAAC,YAAY,CAAC,MAAM,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC;IACpD,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,8BAA8B,EAAE,GAAG,EAAE;QACpC,CAAC,OAAO,CAAC,WAAW,KAAK,SAAS,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC,IAAI,CAAC;IACvD,CAAC,CAAC,CAAC;IAEH,QAAQ,CAAC,uCAAuC,EAAE,GAAG,EAAE;QACnD,MAAM,QAAQ,GAAG,gBAAgB,CAAC,EAAE,EAAE,EAAE,EAAE,WAAW,CAAC,KAAK,CAAC,CAAC;QAE7D,EAAE,CAAC,qEAAqE,EAAE,GAAG,EAAE;YAC3E,QAAQ,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,eAAe,CAAC,CAAC;QACjD,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"when_the_binding_is_not_registered.d.ts","sourceRoot":"","sources":["../../../for_deriveArcHeading/when_the_binding_is_not_registered.ts"],"names":[],"mappings":""}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { BindingKind } from '@cratis/scene.components';
|
|
2
|
-
import { deriveArcHeading } from '../header';
|
|
3
|
-
describe('when the binding is not registered', () => {
|
|
4
|
-
const heading = deriveArcHeading({ section: 'Billing' }, { name: 'RecordAdjustment' }, BindingKind.Command);
|
|
5
|
-
it('should fall back to the binding name read as a sentence, so the page is legible before anyone writes a title', () => {
|
|
6
|
-
heading.title.should.equal('Record adjustment');
|
|
7
|
-
});
|
|
8
|
-
it('should build the trail from the derived title', () => {
|
|
9
|
-
heading.trail.should.deep.equal(['Billing', 'Record adjustment']);
|
|
10
|
-
});
|
|
11
|
-
it('should report that it is not bound', () => {
|
|
12
|
-
heading.isBound.should.be.false;
|
|
13
|
-
});
|
|
14
|
-
it('should say which name a host has to register, which is the only actionable part', () => {
|
|
15
|
-
heading.bindingLabel.should.equal('No command registered as RecordAdjustment');
|
|
16
|
-
});
|
|
17
|
-
});
|
|
18
|
-
//# sourceMappingURL=when_the_binding_is_not_registered.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"when_the_binding_is_not_registered.js","sourceRoot":"","sources":["../../../for_deriveArcHeading/when_the_binding_is_not_registered.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAE7C,QAAQ,CAAC,oCAAoC,EAAE,GAAG,EAAE;IAChD,MAAM,OAAO,GAAG,gBAAgB,CAAC,EAAE,OAAO,EAAE,SAAS,EAAE,EAAE,EAAE,IAAI,EAAE,kBAAkB,EAAE,EAAE,WAAW,CAAC,OAAO,CAAC,CAAC;IAE5G,EAAE,CAAC,8GAA8G,EAAE,GAAG,EAAE;QACpH,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,mBAAmB,CAAC,CAAC;IACpD,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,+CAA+C,EAAE,GAAG,EAAE;QACrD,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,SAAS,EAAE,mBAAmB,CAAC,CAAC,CAAC;IACtE,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,oCAAoC,EAAE,GAAG,EAAE;QAC1C,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC,KAAK,CAAC;IACpC,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,iFAAiF,EAAE,GAAG,EAAE;QACvF,OAAO,CAAC,YAAY,CAAC,MAAM,CAAC,KAAK,CAAC,2CAA2C,CAAC,CAAC;IACnF,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"when_the_binding_is_registered.d.ts","sourceRoot":"","sources":["../../../for_deriveArcHeading/when_the_binding_is_registered.ts"],"names":[],"mappings":""}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { BindingKind } from '@cratis/scene.components';
|
|
2
|
-
import { deriveArcHeading } from '../header';
|
|
3
|
-
class AllInvoices {
|
|
4
|
-
}
|
|
5
|
-
describe('when the binding is registered', () => {
|
|
6
|
-
const heading = deriveArcHeading({ title: 'Invoices', subtitle: 'Every invoice', section: 'Billing' }, { name: 'AllInvoices', target: AllInvoices }, BindingKind.Query);
|
|
7
|
-
it('should use the title the template gave it', () => {
|
|
8
|
-
heading.title.should.equal('Invoices');
|
|
9
|
-
});
|
|
10
|
-
it('should keep the subtitle', () => {
|
|
11
|
-
heading.subtitle.should.equal('Every invoice');
|
|
12
|
-
});
|
|
13
|
-
it('should build the trail from the section and the title, rather than a second literal', () => {
|
|
14
|
-
heading.trail.should.deep.equal(['Billing', 'Invoices']);
|
|
15
|
-
});
|
|
16
|
-
it('should report that it is bound', () => {
|
|
17
|
-
heading.isBound.should.be.true;
|
|
18
|
-
});
|
|
19
|
-
it('should say what it is bound to, naming the kind so a query is not mistaken for a command', () => {
|
|
20
|
-
heading.bindingLabel.should.equal('Bound to query AllInvoices');
|
|
21
|
-
});
|
|
22
|
-
it('should keep the binding name for anything that wants to report it', () => {
|
|
23
|
-
heading.bindingName.should.equal('AllInvoices');
|
|
24
|
-
});
|
|
25
|
-
});
|
|
26
|
-
//# sourceMappingURL=when_the_binding_is_registered.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"when_the_binding_is_registered.js","sourceRoot":"","sources":["../../../for_deriveArcHeading/when_the_binding_is_registered.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAE7C,MA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when_reading_a_proxy_name.d.ts","sourceRoot":"","sources":["../../../for_humanizeBindingName/when_reading_a_proxy_name.ts"],"names":[],"mappings":""}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { humanizeBindingName } from '../header';
|
|
2
|
-
describe('when reading a proxy name', () => {
|
|
3
|
-
it('should read a two-word query name as a sentence', () => {
|
|
4
|
-
humanizeBindingName('AllInvoices').should.equal('All invoices');
|
|
5
|
-
});
|
|
6
|
-
it('should read a command name as a sentence', () => {
|
|
7
|
-
humanizeBindingName('RecordAdjustment').should.equal('Record adjustment');
|
|
8
|
-
});
|
|
9
|
-
it('should lower every word after the first', () => {
|
|
10
|
-
humanizeBindingName('InvoicesInFlight').should.equal('Invoices in flight');
|
|
11
|
-
});
|
|
12
|
-
it('should leave a single word alone', () => {
|
|
13
|
-
humanizeBindingName('Invoices').should.equal('Invoices');
|
|
14
|
-
});
|
|
15
|
-
it('should split a word boundary that follows a digit', () => {
|
|
16
|
-
humanizeBindingName('Top10Customers').should.equal('Top10 customers');
|
|
17
|
-
});
|
|
18
|
-
it('should keep a run of capitals together rather than chopping it into initials', () => {
|
|
19
|
-
humanizeBindingName('AllPIIRecords').should.equal('All PIIRecords');
|
|
20
|
-
});
|
|
21
|
-
it('should return an empty name unchanged rather than inventing a heading', () => {
|
|
22
|
-
humanizeBindingName('').should.equal('');
|
|
23
|
-
});
|
|
24
|
-
});
|
|
25
|
-
//# sourceMappingURL=when_reading_a_proxy_name.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"when_reading_a_proxy_name.js","sourceRoot":"","sources":["../../../for_humanizeBindingName/when_reading_a_proxy_name.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAEhD,QAAQ,CAAC,2BAA2B,EAAE,GAAG,EAAE;IACvC,EAAE,CAAC,iDAAiD,EAAE,GAAG,EAAE;QACvD,mBAAmB,CAAC,aAAa,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC;IACpE,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,0CAA0C,EAAE,GAAG,EAAE;QAChD,mBAAmB,CAAC,kBAAkB,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,mBAAmB,CAAC,CAAC;IAC9E,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,yCAAyC,EAAE,GAAG,EAAE;QAC/C,mBAAmB,CAAC,kBAAkB,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,oBAAoB,CAAC,CAAC;IAC/E,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,kCAAkC,EAAE,GAAG,EAAE;QACxC,mBAAmB,CAAC,UAAU,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;IAC7D,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,mDAAmD,EAAE,GAAG,EAAE;QACzD,mBAAmB,CAAC,gBAAgB,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAAC;IAC1E,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,8EAA8E,EAAE,GAAG,EAAE;QACpF,mBAAmB,CAAC,eAAe,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC;IACxE,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,uEAAuE,EAAE,GAAG,EAAE;QAC7E,mBAAmB,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;IAC7C,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
|
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
// Copyright (c) Cratis. All rights reserved.
|
|
2
|
-
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
3
|
-
|
|
4
|
-
import { render, screen } from '@testing-library/react';
|
|
5
|
-
import { PrimeReactProvider } from '@primereact/core';
|
|
6
|
-
import { SceneElement } from '@cratis/scene.model';
|
|
7
|
-
import { SceneElementView } from '@cratis/scene.react';
|
|
8
|
-
import { clearBindings, registerQuery } from '@cratis/scene.components';
|
|
9
|
-
import { composeScreenElement, resolveElementComponentNames } from '@cratis/scene.blueprint.default';
|
|
10
|
-
import { componentsBlueprintCatalog, componentsBlueprintProfile, componentsGalleryScreen, componentsPreviewRegistry } from '../gallery';
|
|
11
|
-
import { SampleBindingName, arcPageHeader } from '../templates';
|
|
12
|
-
|
|
13
|
-
class AllInvoices {}
|
|
14
|
-
|
|
15
|
-
// These pages render inside the default blueprint's shell, which reaches for PrimeReact directly. Every
|
|
16
|
-
// PrimeReact 11 component resolves its configuration through `PrimeReactProvider` and throws without one,
|
|
17
|
-
// so the provider is what makes the render happen at all rather than a styling nicety. No preset is handed
|
|
18
|
-
// over: these specs assert structure and text, and a theme would only add runtime CSS nothing here reads.
|
|
19
|
-
function renderElement(element: SceneElement) {
|
|
20
|
-
render(
|
|
21
|
-
<PrimeReactProvider>
|
|
22
|
-
<SceneElementView
|
|
23
|
-
element={resolveElementComponentNames(element, componentsBlueprintProfile, componentsBlueprintCatalog)}
|
|
24
|
-
registry={componentsPreviewRegistry}
|
|
25
|
-
resolveBinding={() => undefined}
|
|
26
|
-
/>
|
|
27
|
-
</PrimeReactProvider>,
|
|
28
|
-
);
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
function has(selector: string): boolean {
|
|
32
|
-
return document.querySelector(selector) !== null;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
describe('when rendering a gallery screen', () => {
|
|
36
|
-
describe('and nothing is registered', () => {
|
|
37
|
-
beforeEach(() => {
|
|
38
|
-
clearBindings();
|
|
39
|
-
renderElement(composeScreenElement(componentsGalleryScreen('DataListPage')!));
|
|
40
|
-
});
|
|
41
|
-
|
|
42
|
-
afterEach(() => clearBindings());
|
|
43
|
-
|
|
44
|
-
it('should render inside the shell the blueprint it depends on provides', () => {
|
|
45
|
-
has('.layout-topbar').should.equal(true);
|
|
46
|
-
});
|
|
47
|
-
|
|
48
|
-
it('should render the page header this blueprint contributes', () => {
|
|
49
|
-
has('.layout-page-header').should.equal(true);
|
|
50
|
-
});
|
|
51
|
-
|
|
52
|
-
it('should render the trail derived from the section and the title', () => {
|
|
53
|
-
screen.getAllByLabelText('Breadcrumb').some(element => element.textContent === 'Billing › Invoices').should.equal(true);
|
|
54
|
-
});
|
|
55
|
-
|
|
56
|
-
it('should say which query a host still has to register', () => {
|
|
57
|
-
screen.getAllByText('No query registered as AllInvoices').length.should.be.greaterThan(0);
|
|
58
|
-
});
|
|
59
|
-
|
|
60
|
-
it('should render the unbound data page as a placeholder naming the binding it wanted', () => {
|
|
61
|
-
screen.getAllByText("Unresolved query binding 'AllInvoices' on Cratis.Components:dataPage").length.should.be.greaterThan(0);
|
|
62
|
-
});
|
|
63
|
-
|
|
64
|
-
it('should render no unresolved-component fallback, because every name the page writes resolves', () => {
|
|
65
|
-
has('[data-scene-unresolved-component]').should.equal(false);
|
|
66
|
-
});
|
|
67
|
-
});
|
|
68
|
-
|
|
69
|
-
describe('and the header binding is registered', () => {
|
|
70
|
-
beforeEach(() => {
|
|
71
|
-
clearBindings();
|
|
72
|
-
registerQuery(SampleBindingName.AllInvoices, AllInvoices);
|
|
73
|
-
renderElement(arcPageHeader('bound-header', { title: 'Invoices', section: 'Billing', query: SampleBindingName.AllInvoices }));
|
|
74
|
-
});
|
|
75
|
-
|
|
76
|
-
afterEach(() => clearBindings());
|
|
77
|
-
|
|
78
|
-
it('should report the binding as resolved rather than missing', () => {
|
|
79
|
-
screen.getAllByText('Bound to query AllInvoices').length.should.be.greaterThan(0);
|
|
80
|
-
});
|
|
81
|
-
|
|
82
|
-
it('should mark the header as bound, so a preview can be scanned for what is still unwired', () => {
|
|
83
|
-
has('[data-scene-binding-state="bound"]').should.equal(true);
|
|
84
|
-
});
|
|
85
|
-
});
|
|
86
|
-
});
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
// Copyright (c) Cratis. All rights reserved.
|
|
2
|
-
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
3
|
-
|
|
4
|
-
import { cratisComponentsPackageManifest } from '@cratis/scene.components';
|
|
5
|
-
import { BorrowedComponentName } from '../BorrowedComponentName';
|
|
6
|
-
import { CompositeName } from '../CompositeName';
|
|
7
|
-
import { primeReactComponentNames } from '../gallery';
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* The names this blueprint writes into its templates belong to other packages, and this is the standing
|
|
11
|
-
* check that they still exist there.
|
|
12
|
-
*
|
|
13
|
-
* The failure this prevents is quiet. A composite renamed upstream leaves every template that referenced it
|
|
14
|
-
* rendering a dashed red box somewhere inside a page, and nothing in the box says which template wrote the
|
|
15
|
-
* name. Checking the enum against the owning manifest turns that into a failed spec in this package.
|
|
16
|
-
*/
|
|
17
|
-
describe('when checking the names against the packages that declare them', () => {
|
|
18
|
-
const declaredByTheLibrary = new Set(cratisComponentsPackageManifest.components);
|
|
19
|
-
|
|
20
|
-
it('should have composite names to check', () => {
|
|
21
|
-
Object.values(CompositeName).should.not.be.empty;
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
it('should reference only composites the component library declares', () => {
|
|
25
|
-
Object.values(CompositeName)
|
|
26
|
-
.filter(name => !declaredByTheLibrary.has(name))
|
|
27
|
-
.should.be.empty;
|
|
28
|
-
});
|
|
29
|
-
|
|
30
|
-
it('should borrow only names PrimeReact declares', () => {
|
|
31
|
-
Object.values(BorrowedComponentName)
|
|
32
|
-
.filter(name => !primeReactComponentNames.includes(name))
|
|
33
|
-
.should.be.empty;
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
it('should borrow nothing the component library already declares, since the library would win the bare name anyway', () => {
|
|
37
|
-
Object.values(BorrowedComponentName)
|
|
38
|
-
.filter(name => declaredByTheLibrary.has(name))
|
|
39
|
-
.should.be.empty;
|
|
40
|
-
});
|
|
41
|
-
});
|
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
// Copyright (c) Cratis. All rights reserved.
|
|
2
|
-
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
3
|
-
|
|
4
|
-
import { PackageKind, ScenePackage } from '@cratis/scene.model';
|
|
5
|
-
import { isPackageSelectionValid, resolvePackageDependencies } from '@cratis/scene.engine';
|
|
6
|
-
import { cratisComponentsPackageManifest } from '@cratis/scene.components';
|
|
7
|
-
import { defaultBlueprintManifest } from '@cratis/scene.blueprint.default';
|
|
8
|
-
import { componentsBlueprintManifest } from '../componentsBlueprint';
|
|
9
|
-
import { componentsBlueprintName } from '../packageName';
|
|
10
|
-
|
|
11
|
-
/** A styling package declaring nothing but itself - enough for `Cratis.Components` to depend on, and no more. */
|
|
12
|
-
const tailwind: ScenePackage = {
|
|
13
|
-
name: 'Tailwind',
|
|
14
|
-
version: '4.3.3',
|
|
15
|
-
kind: PackageKind.Styling,
|
|
16
|
-
dependencies: [],
|
|
17
|
-
components: [],
|
|
18
|
-
layouts: [],
|
|
19
|
-
screenTemplates: [],
|
|
20
|
-
dialogTemplates: [],
|
|
21
|
-
themes: [],
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* The base component library both of this blueprint's dependencies are written against, at the version
|
|
26
|
-
* this repository pins.
|
|
27
|
-
*
|
|
28
|
-
* The version is load-bearing rather than incidental: `Cratis.Components` declares a required range on
|
|
29
|
-
* `PrimeReact`, and this fixture is what that range is resolved against. It moved to 11.1.0 with the
|
|
30
|
-
* PrimeReact 11 migration, and a stale 10.x here fails the selection as a version conflict - which is the
|
|
31
|
-
* spec doing its job, not a spec to be relaxed.
|
|
32
|
-
*/
|
|
33
|
-
const primeReact: ScenePackage = {
|
|
34
|
-
name: 'PrimeReact',
|
|
35
|
-
version: '11.1.0',
|
|
36
|
-
kind: PackageKind.ComponentLibrary,
|
|
37
|
-
dependencies: [{ name: 'Tailwind' }],
|
|
38
|
-
components: ['column', 'table', 'dialog'],
|
|
39
|
-
layouts: [],
|
|
40
|
-
screenTemplates: [],
|
|
41
|
-
dialogTemplates: [],
|
|
42
|
-
themes: [],
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
describe('when resolving its dependencies', () => {
|
|
46
|
-
const catalog = [tailwind, primeReact, cratisComponentsPackageManifest, defaultBlueprintManifest, componentsBlueprintManifest];
|
|
47
|
-
const selection = resolvePackageDependencies([componentsBlueprintName], catalog);
|
|
48
|
-
const positionOf = (name: string) => selection.packages.indexOf(name);
|
|
49
|
-
|
|
50
|
-
it('should be a valid selection', () => {
|
|
51
|
-
isPackageSelectionValid(selection).should.be.true;
|
|
52
|
-
});
|
|
53
|
-
|
|
54
|
-
it('should order the blueprint it layers on before it', () => {
|
|
55
|
-
positionOf('Cratis.Blueprint.Default').should.be.lessThan(positionOf(componentsBlueprintName));
|
|
56
|
-
});
|
|
57
|
-
|
|
58
|
-
it('should order the component library its templates are built from before it', () => {
|
|
59
|
-
positionOf('Cratis.Components').should.be.lessThan(positionOf(componentsBlueprintName));
|
|
60
|
-
});
|
|
61
|
-
|
|
62
|
-
it('should pull in the packages its own dependencies need, transitively', () => {
|
|
63
|
-
selection.added.should.contain('PrimeReact');
|
|
64
|
-
selection.added.should.contain('Tailwind');
|
|
65
|
-
});
|
|
66
|
-
|
|
67
|
-
it('should report nothing missing', () => {
|
|
68
|
-
selection.missing.should.deep.equal([]);
|
|
69
|
-
});
|
|
70
|
-
|
|
71
|
-
it('should report no version conflict', () => {
|
|
72
|
-
selection.versionConflicts.should.deep.equal([]);
|
|
73
|
-
});
|
|
74
|
-
|
|
75
|
-
it('should report no cycle, even though both blueprints depend on the same library', () => {
|
|
76
|
-
selection.cycles.should.deep.equal([]);
|
|
77
|
-
});
|
|
78
|
-
|
|
79
|
-
describe('and the default blueprint is not in the catalog', () => {
|
|
80
|
-
const withoutTheDefaultBlueprint = resolvePackageDependencies(
|
|
81
|
-
[componentsBlueprintName],
|
|
82
|
-
[tailwind, primeReact, cratisComponentsPackageManifest, componentsBlueprintManifest],
|
|
83
|
-
);
|
|
84
|
-
|
|
85
|
-
it('should report it missing rather than silently ordering around it', () => {
|
|
86
|
-
withoutTheDefaultBlueprint.missing.should.deep.equal([{ package: componentsBlueprintName, dependsOn: 'Cratis.Blueprint.Default' }]);
|
|
87
|
-
});
|
|
88
|
-
|
|
89
|
-
it('should not be a valid selection', () => {
|
|
90
|
-
isPackageSelectionValid(withoutTheDefaultBlueprint).should.be.false;
|
|
91
|
-
});
|
|
92
|
-
});
|
|
93
|
-
});
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
// Copyright (c) Cratis. All rights reserved.
|
|
2
|
-
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
3
|
-
|
|
4
|
-
import { PackageKind } from '@cratis/scene.model';
|
|
5
|
-
import { validatePackageBundle } from '@cratis/scene.react';
|
|
6
|
-
import { componentsBlueprint, componentsBlueprintManifest } from '../componentsBlueprint';
|
|
7
|
-
import { componentsBlueprintName } from '../packageName';
|
|
8
|
-
|
|
9
|
-
describe('when validating the bundle', () => {
|
|
10
|
-
const problems = validatePackageBundle(componentsBlueprint);
|
|
11
|
-
|
|
12
|
-
it('should report no problems', () => {
|
|
13
|
-
problems.should.be.empty;
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
it('should declare itself a blueprint', () => {
|
|
17
|
-
componentsBlueprintManifest.kind.should.equal(PackageKind.Blueprint);
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
it('should be named as a blueprint package', () => {
|
|
21
|
-
componentsBlueprintManifest.name.should.equal(componentsBlueprintName);
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
it('should depend on the blueprint it layers on and the library its templates are built from', () => {
|
|
25
|
-
componentsBlueprintManifest.dependencies.map(dependency => dependency.name).should.deep.equal(['Cratis.Blueprint.Default', 'Cratis.Components']);
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
it('should ship no layout of its own, because it reuses the default blueprint shell', () => {
|
|
29
|
-
componentsBlueprintManifest.layouts.should.be.empty;
|
|
30
|
-
});
|
|
31
|
-
|
|
32
|
-
it('should provide no layout either, so the manifest and the bundle agree about that', () => {
|
|
33
|
-
(componentsBlueprint.layouts ?? []).should.be.empty;
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
it('should ship no theme, because the shell it themes is not its own', () => {
|
|
37
|
-
componentsBlueprintManifest.themes.should.be.empty;
|
|
38
|
-
});
|
|
39
|
-
|
|
40
|
-
it('should declare a screen template for every one it provides', () => {
|
|
41
|
-
componentsBlueprintManifest.screenTemplates.should.deep.equal((componentsBlueprint.screenTemplates ?? []).map(template => template.name));
|
|
42
|
-
});
|
|
43
|
-
|
|
44
|
-
it('should declare a dialog template for every one it provides', () => {
|
|
45
|
-
componentsBlueprintManifest.dialogTemplates.should.deep.equal((componentsBlueprint.dialogTemplates ?? []).map(template => template.name));
|
|
46
|
-
});
|
|
47
|
-
|
|
48
|
-
it('should ship a gallery screen for every screen template', () => {
|
|
49
|
-
(componentsBlueprint.screens ?? []).map(screen => screen.name).should.deep.equal(componentsBlueprintManifest.screenTemplates);
|
|
50
|
-
});
|
|
51
|
-
|
|
52
|
-
it('should name the module a host imports it from', () => {
|
|
53
|
-
componentsBlueprintManifest.module!.should.equal('@cratis/scene.blueprint.components');
|
|
54
|
-
});
|
|
55
|
-
});
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
// Copyright (c) Cratis. All rights reserved.
|
|
2
|
-
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
3
|
-
|
|
4
|
-
import { Layout } from '@cratis/scene.model';
|
|
5
|
-
import { defaultBlueprint, shellComponentForLayout } from '@cratis/scene.blueprint.default';
|
|
6
|
-
import { componentsBlueprint } from '../componentsBlueprint';
|
|
7
|
-
import { componentsGalleryScreens } from '../gallery';
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* A gallery screen names a layout this package does not provide, which is the whole point of the
|
|
11
|
-
* dependency: it fills the default blueprint's `AppShell`. So the layout every one of them has to be
|
|
12
|
-
* checked against is that blueprint's, and a slot filled under a name the shell never reads renders
|
|
13
|
-
* nothing at all and reports nothing either.
|
|
14
|
-
*/
|
|
15
|
-
describe('when checking the layouts and slots they fill', () => {
|
|
16
|
-
const layouts = defaultBlueprint.layouts ?? [];
|
|
17
|
-
const layoutsByName = new Map<string, Layout>(layouts.map(layout => [layout.name, layout]));
|
|
18
|
-
const templateNames = (componentsBlueprint.screenTemplates ?? []).map(template => template.name);
|
|
19
|
-
|
|
20
|
-
it('should have at least one screen to check', () => {
|
|
21
|
-
componentsGalleryScreens.should.not.be.empty;
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
for (const screen of componentsGalleryScreens) {
|
|
25
|
-
describe(`and the screen is '${screen.name}'`, () => {
|
|
26
|
-
const layout = layoutsByName.get(screen.layout);
|
|
27
|
-
|
|
28
|
-
it('should name a layout the blueprint it depends on provides', () => {
|
|
29
|
-
(layout !== undefined).should.be.true;
|
|
30
|
-
});
|
|
31
|
-
|
|
32
|
-
it('should fill only slots that layout declares', () => {
|
|
33
|
-
const declared = new Set((layout?.slots ?? []).map(slot => slot.name));
|
|
34
|
-
Object.keys(screen.slotContent)
|
|
35
|
-
.filter(name => !declared.has(name))
|
|
36
|
-
.should.be.empty;
|
|
37
|
-
});
|
|
38
|
-
|
|
39
|
-
it('should fill the content slot, which is the only one every layout declares', () => {
|
|
40
|
-
(screen.slotContent.content?.length ?? 0).should.be.greaterThan(0);
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
it('should name a screen template this blueprint provides', () => {
|
|
44
|
-
templateNames.should.contain(screen.screenTemplate);
|
|
45
|
-
});
|
|
46
|
-
|
|
47
|
-
it('should render in a shell the blueprint it depends on provides', () => {
|
|
48
|
-
(shellComponentForLayout(screen.layout) !== undefined).should.be.true;
|
|
49
|
-
});
|
|
50
|
-
|
|
51
|
-
it('should contribute its navigation, so the menu is the same on every screen', () => {
|
|
52
|
-
screen.contributions.should.not.be.empty;
|
|
53
|
-
});
|
|
54
|
-
});
|
|
55
|
-
}
|
|
56
|
-
});
|
package/for_componentsScreenTemplates/when_checking_that_arrangements_reference_declared_slots.ts
DELETED
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
// Copyright (c) Cratis. All rights reserved.
|
|
2
|
-
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
3
|
-
|
|
4
|
-
import { Arrangement, FlowArrangement, FlowContainer, FlowNode, Slot } from '@cratis/scene.model';
|
|
5
|
-
import { componentsDialogTemplates, componentsScreenTemplates } from '../templates';
|
|
6
|
-
|
|
7
|
-
function slotNamesIn(node: FlowNode): string[] {
|
|
8
|
-
if ('slotName' in node) {
|
|
9
|
-
return [(node as { slotName: string }).slotName];
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
if ('children' in node) {
|
|
13
|
-
return (node as FlowContainer).children.flatMap(slotNamesIn);
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
return [];
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
function referencedSlots(arrangement: Arrangement | undefined): string[] {
|
|
20
|
-
const flow = arrangement as FlowArrangement | undefined;
|
|
21
|
-
if (!flow?.root) {
|
|
22
|
-
return [];
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
return [flow.root, ...(flow.overrides ?? []).map(override => override.root)].flatMap(slotNamesIn);
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
function undeclared(slots: Slot[], arrangement: Arrangement | undefined): string[] {
|
|
29
|
-
const declared = new Set(slots.map(slot => slot.name));
|
|
30
|
-
return [...new Set(referencedSlots(arrangement))].filter(name => !declared.has(name));
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* An arrangement leaf naming a slot the template never declared positions nothing, and reports nothing
|
|
35
|
-
* either - the region simply is not there. No type can express "one of whatever this particular container
|
|
36
|
-
* declared", so this is the check that stands in for one.
|
|
37
|
-
*/
|
|
38
|
-
describe('when checking that arrangements reference declared slots', () => {
|
|
39
|
-
for (const template of componentsScreenTemplates.filter(candidate => candidate.arrangement !== undefined)) {
|
|
40
|
-
it(`should reference only slots the '${template.name}' template declares`, () => {
|
|
41
|
-
undeclared(template.slots, template.arrangement).should.be.empty;
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
for (const template of componentsScreenTemplates) {
|
|
46
|
-
it(`should file '${template.name}' content only under slots it declares`, () => {
|
|
47
|
-
const declared = new Set(template.slots.map(slot => slot.name));
|
|
48
|
-
Object.keys(template.content ?? {}).filter(name => !declared.has(name)).should.be.empty;
|
|
49
|
-
});
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
for (const template of componentsDialogTemplates) {
|
|
53
|
-
it(`should file '${template.name}' dialog content only under slots it declares`, () => {
|
|
54
|
-
const declared = new Set(template.slots.map(slot => slot.name));
|
|
55
|
-
Object.keys(template.content ?? {}).filter(name => !declared.has(name)).should.be.empty;
|
|
56
|
-
});
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
it('should give every dialog template exactly one slot, since the composites own their own chrome', () => {
|
|
60
|
-
componentsDialogTemplates.filter(template => template.slots.length !== 1).should.be.empty;
|
|
61
|
-
});
|
|
62
|
-
|
|
63
|
-
it('should give no dialog template a fitsSlot, because an overlay occupies no slot', () => {
|
|
64
|
-
componentsDialogTemplates.filter(template => 'fitsSlot' in template).should.be.empty;
|
|
65
|
-
});
|
|
66
|
-
});
|