@cratis/scene.engine 4.2.0 → 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.
Files changed (107) hide show
  1. package/dist/esm/tsconfig.tsbuildinfo +1 -1
  2. package/package.json +5 -4
  3. package/dist/esm/for_aggregateContributions/when_aggregating_by_contribution_point.d.ts +0 -2
  4. package/dist/esm/for_aggregateContributions/when_aggregating_by_contribution_point.d.ts.map +0 -1
  5. package/dist/esm/for_aggregateContributions/when_aggregating_by_contribution_point.js +0 -23
  6. package/dist/esm/for_aggregateContributions/when_aggregating_by_contribution_point.js.map +0 -1
  7. package/dist/esm/for_buildStarterProfile/when_checking_against_the_shared_fixture_corpus.d.ts +0 -2
  8. package/dist/esm/for_buildStarterProfile/when_checking_against_the_shared_fixture_corpus.d.ts.map +0 -1
  9. package/dist/esm/for_buildStarterProfile/when_checking_against_the_shared_fixture_corpus.js +0 -16
  10. package/dist/esm/for_buildStarterProfile/when_checking_against_the_shared_fixture_corpus.js.map +0 -1
  11. package/dist/esm/for_computeSizeClass/when_computing_the_size_class.d.ts +0 -2
  12. package/dist/esm/for_computeSizeClass/when_computing_the_size_class.d.ts.map +0 -1
  13. package/dist/esm/for_computeSizeClass/when_computing_the_size_class.js +0 -17
  14. package/dist/esm/for_computeSizeClass/when_computing_the_size_class.js.map +0 -1
  15. package/dist/esm/for_evaluateFlowArrangement/when_evaluating_against_the_shared_fixture_corpus.d.ts +0 -2
  16. package/dist/esm/for_evaluateFlowArrangement/when_evaluating_against_the_shared_fixture_corpus.d.ts.map +0 -1
  17. package/dist/esm/for_evaluateFlowArrangement/when_evaluating_against_the_shared_fixture_corpus.js +0 -43
  18. package/dist/esm/for_evaluateFlowArrangement/when_evaluating_against_the_shared_fixture_corpus.js.map +0 -1
  19. package/dist/esm/for_evaluateFreeformArrangement/when_evaluating_against_the_shared_fixture_corpus.d.ts +0 -2
  20. package/dist/esm/for_evaluateFreeformArrangement/when_evaluating_against_the_shared_fixture_corpus.d.ts.map +0 -1
  21. package/dist/esm/for_evaluateFreeformArrangement/when_evaluating_against_the_shared_fixture_corpus.js +0 -46
  22. package/dist/esm/for_evaluateFreeformArrangement/when_evaluating_against_the_shared_fixture_corpus.js.map +0 -1
  23. package/dist/esm/for_evaluateFreeformSlotArrangement/when_evaluating_against_the_shared_fixture_corpus.d.ts +0 -2
  24. package/dist/esm/for_evaluateFreeformSlotArrangement/when_evaluating_against_the_shared_fixture_corpus.d.ts.map +0 -1
  25. package/dist/esm/for_evaluateFreeformSlotArrangement/when_evaluating_against_the_shared_fixture_corpus.js +0 -25
  26. package/dist/esm/for_evaluateFreeformSlotArrangement/when_evaluating_against_the_shared_fixture_corpus.js.map +0 -1
  27. package/dist/esm/for_incompatibleStarterThemes/when_checking_against_the_shared_fixture_corpus.d.ts +0 -2
  28. package/dist/esm/for_incompatibleStarterThemes/when_checking_against_the_shared_fixture_corpus.d.ts.map +0 -1
  29. package/dist/esm/for_incompatibleStarterThemes/when_checking_against_the_shared_fixture_corpus.js +0 -17
  30. package/dist/esm/for_incompatibleStarterThemes/when_checking_against_the_shared_fixture_corpus.js.map +0 -1
  31. package/dist/esm/for_packageCatalog/when_querying_against_the_shared_fixture_corpus.d.ts +0 -2
  32. package/dist/esm/for_packageCatalog/when_querying_against_the_shared_fixture_corpus.d.ts.map +0 -1
  33. package/dist/esm/for_packageCatalog/when_querying_against_the_shared_fixture_corpus.js +0 -22
  34. package/dist/esm/for_packageCatalog/when_querying_against_the_shared_fixture_corpus.js.map +0 -1
  35. package/dist/esm/for_packageDependencies/fixtures.d.ts +0 -38
  36. package/dist/esm/for_packageDependencies/fixtures.d.ts.map +0 -1
  37. package/dist/esm/for_packageDependencies/fixtures.js +0 -5
  38. package/dist/esm/for_packageDependencies/fixtures.js.map +0 -1
  39. package/dist/esm/for_packageDependencies/when_resolving_against_the_shared_fixture_corpus.d.ts +0 -2
  40. package/dist/esm/for_packageDependencies/when_resolving_against_the_shared_fixture_corpus.d.ts.map +0 -1
  41. package/dist/esm/for_packageDependencies/when_resolving_against_the_shared_fixture_corpus.js +0 -29
  42. package/dist/esm/for_packageDependencies/when_resolving_against_the_shared_fixture_corpus.js.map +0 -1
  43. package/dist/esm/for_packageVersionRange/when_checking_against_the_shared_fixture_corpus.d.ts +0 -2
  44. package/dist/esm/for_packageVersionRange/when_checking_against_the_shared_fixture_corpus.d.ts.map +0 -1
  45. package/dist/esm/for_packageVersionRange/when_checking_against_the_shared_fixture_corpus.js +0 -10
  46. package/dist/esm/for_packageVersionRange/when_checking_against_the_shared_fixture_corpus.js.map +0 -1
  47. package/dist/esm/for_panelKind/when_telling_the_panels_apart.d.ts +0 -2
  48. package/dist/esm/for_panelKind/when_telling_the_panels_apart.d.ts.map +0 -1
  49. package/dist/esm/for_panelKind/when_telling_the_panels_apart.js +0 -38
  50. package/dist/esm/for_panelKind/when_telling_the_panels_apart.js.map +0 -1
  51. package/dist/esm/for_renderElement/when_rendering_a_mixed_tree.d.ts +0 -2
  52. package/dist/esm/for_renderElement/when_rendering_a_mixed_tree.d.ts.map +0 -1
  53. package/dist/esm/for_renderElement/when_rendering_a_mixed_tree.js +0 -46
  54. package/dist/esm/for_renderElement/when_rendering_a_mixed_tree.js.map +0 -1
  55. package/dist/esm/for_resolveBehaviors/when_resolving_additive_attachments.d.ts +0 -2
  56. package/dist/esm/for_resolveBehaviors/when_resolving_additive_attachments.d.ts.map +0 -1
  57. package/dist/esm/for_resolveBehaviors/when_resolving_additive_attachments.js +0 -68
  58. package/dist/esm/for_resolveBehaviors/when_resolving_additive_attachments.js.map +0 -1
  59. package/dist/esm/for_resolveComponentName/when_resolving_against_the_shared_fixture_corpus.d.ts +0 -2
  60. package/dist/esm/for_resolveComponentName/when_resolving_against_the_shared_fixture_corpus.d.ts.map +0 -1
  61. package/dist/esm/for_resolveComponentName/when_resolving_against_the_shared_fixture_corpus.js +0 -20
  62. package/dist/esm/for_resolveComponentName/when_resolving_against_the_shared_fixture_corpus.js.map +0 -1
  63. package/dist/esm/for_resolveScreenTemplates/when_resolving_against_the_shared_fixture_corpus.d.ts +0 -2
  64. package/dist/esm/for_resolveScreenTemplates/when_resolving_against_the_shared_fixture_corpus.d.ts.map +0 -1
  65. package/dist/esm/for_resolveScreenTemplates/when_resolving_against_the_shared_fixture_corpus.js +0 -30
  66. package/dist/esm/for_resolveScreenTemplates/when_resolving_against_the_shared_fixture_corpus.js.map +0 -1
  67. package/dist/esm/for_resolveStrings/when_resolving_a_strings_reference.d.ts +0 -2
  68. package/dist/esm/for_resolveStrings/when_resolving_a_strings_reference.d.ts.map +0 -1
  69. package/dist/esm/for_resolveStrings/when_resolving_a_strings_reference.js +0 -69
  70. package/dist/esm/for_resolveStrings/when_resolving_a_strings_reference.js.map +0 -1
  71. package/dist/esm/for_runActions/given/a_recording_dispatcher.d.ts +0 -21
  72. package/dist/esm/for_runActions/given/a_recording_dispatcher.d.ts.map +0 -1
  73. package/dist/esm/for_runActions/given/a_recording_dispatcher.js +0 -45
  74. package/dist/esm/for_runActions/given/a_recording_dispatcher.js.map +0 -1
  75. package/dist/esm/for_runActions/when_running_a_sequence_of_actions.d.ts +0 -2
  76. package/dist/esm/for_runActions/when_running_a_sequence_of_actions.d.ts.map +0 -1
  77. package/dist/esm/for_runActions/when_running_a_sequence_of_actions.js +0 -126
  78. package/dist/esm/for_runActions/when_running_a_sequence_of_actions.js.map +0 -1
  79. package/dist/esm/for_runActions/when_running_against_the_shared_fixture_corpus.d.ts +0 -2
  80. package/dist/esm/for_runActions/when_running_against_the_shared_fixture_corpus.d.ts.map +0 -1
  81. package/dist/esm/for_runActions/when_running_against_the_shared_fixture_corpus.js +0 -61
  82. package/dist/esm/for_runActions/when_running_against_the_shared_fixture_corpus.js.map +0 -1
  83. package/dist/esm/for_themeCompatibility/when_checking_against_the_shared_fixture_corpus.d.ts +0 -2
  84. package/dist/esm/for_themeCompatibility/when_checking_against_the_shared_fixture_corpus.d.ts.map +0 -1
  85. package/dist/esm/for_themeCompatibility/when_checking_against_the_shared_fixture_corpus.js +0 -18
  86. package/dist/esm/for_themeCompatibility/when_checking_against_the_shared_fixture_corpus.js.map +0 -1
  87. package/for_aggregateContributions/when_aggregating_by_contribution_point.ts +0 -31
  88. package/for_buildStarterProfile/when_checking_against_the_shared_fixture_corpus.ts +0 -32
  89. package/for_computeSizeClass/when_computing_the_size_class.ts +0 -23
  90. package/for_evaluateFlowArrangement/when_evaluating_against_the_shared_fixture_corpus.ts +0 -67
  91. package/for_evaluateFreeformArrangement/when_evaluating_against_the_shared_fixture_corpus.ts +0 -68
  92. package/for_evaluateFreeformSlotArrangement/when_evaluating_against_the_shared_fixture_corpus.ts +0 -47
  93. package/for_incompatibleStarterThemes/when_checking_against_the_shared_fixture_corpus.ts +0 -34
  94. package/for_packageCatalog/when_querying_against_the_shared_fixture_corpus.ts +0 -26
  95. package/for_packageDependencies/fixtures.ts +0 -44
  96. package/for_packageDependencies/when_resolving_against_the_shared_fixture_corpus.ts +0 -39
  97. package/for_packageVersionRange/when_checking_against_the_shared_fixture_corpus.ts +0 -13
  98. package/for_panelKind/when_telling_the_panels_apart.ts +0 -47
  99. package/for_renderElement/when_rendering_a_mixed_tree.ts +0 -58
  100. package/for_resolveBehaviors/when_resolving_additive_attachments.ts +0 -100
  101. package/for_resolveComponentName/when_resolving_against_the_shared_fixture_corpus.ts +0 -36
  102. package/for_resolveScreenTemplates/when_resolving_against_the_shared_fixture_corpus.ts +0 -49
  103. package/for_resolveStrings/when_resolving_a_strings_reference.ts +0 -85
  104. package/for_runActions/given/a_recording_dispatcher.ts +0 -72
  105. package/for_runActions/when_running_a_sequence_of_actions.ts +0 -226
  106. package/for_runActions/when_running_against_the_shared_fixture_corpus.ts +0 -124
  107. package/for_themeCompatibility/when_checking_against_the_shared_fixture_corpus.ts +0 -37
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=when_resolving_additive_attachments.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"when_resolving_additive_attachments.d.ts","sourceRoot":"","sources":["../../../for_resolveBehaviors/when_resolving_additive_attachments.ts"],"names":[],"mappings":""}
@@ -1,68 +0,0 @@
1
- import { InteractionActionKind, InteractionTriggerKind } from '@cratis/scene.model';
2
- import { resolveApplicationTriggerBehaviors, resolveBehaviors } from '../resolveBehaviors';
3
- const behavior = (name, kind, order) => ({
4
- name,
5
- order,
6
- bindings: [
7
- {
8
- trigger: { kind },
9
- actions: [{ kind: InteractionActionKind.RefreshQuery, query: name ?? 'inline' }],
10
- },
11
- ],
12
- });
13
- describe('when resolving additive attachments', () => {
14
- const attachments = [
15
- { level: 'layout', behaviors: [behavior('LayoutWide', InteractionTriggerKind.Click)] },
16
- { level: 'module', behaviors: [behavior('ModuleWide', InteractionTriggerKind.Click)] },
17
- { level: 'element', behaviors: [behavior(undefined, InteractionTriggerKind.Click)] },
18
- ];
19
- it('should run every matching attachment rather than only the most specific', () => {
20
- const resolved = resolveBehaviors(attachments, InteractionTriggerKind.Click);
21
- resolved.should.have.lengthOf(3);
22
- });
23
- it('should run the outermost attachment first', () => {
24
- const resolved = resolveBehaviors(attachments, InteractionTriggerKind.Click);
25
- resolved.map(candidate => candidate.level).should.eql(['layout', 'module', 'element']);
26
- });
27
- it('should keep an inline behavior anonymous', () => {
28
- const resolved = resolveBehaviors(attachments, InteractionTriggerKind.Click);
29
- (resolved[2].behaviorName === undefined).should.be.true;
30
- });
31
- it('should ignore bindings for a different trigger', () => {
32
- const resolved = resolveBehaviors([{ level: 'element', behaviors: [behavior('OnSubmitOnly', InteractionTriggerKind.Submit)] }], InteractionTriggerKind.Click);
33
- resolved.should.be.empty;
34
- });
35
- it('should let an explicit order win over position', () => {
36
- const resolved = resolveBehaviors([
37
- { level: 'layout', behaviors: [behavior('LayoutWide', InteractionTriggerKind.Click)] },
38
- { level: 'element', behaviors: [behavior('RunsFirst', InteractionTriggerKind.Click, 1)] },
39
- ], InteractionTriggerKind.Click);
40
- resolved.map(candidate => candidate.behaviorName).should.eql(['RunsFirst', 'LayoutWide']);
41
- });
42
- it('should order deterministically across repeated resolutions', () => {
43
- const once = resolveBehaviors(attachments, InteractionTriggerKind.Click).map(c => c.level);
44
- const twice = resolveBehaviors(attachments, InteractionTriggerKind.Click).map(c => c.level);
45
- once.should.eql(twice);
46
- });
47
- it('should resolve a named application trigger separately from the built-in kinds', () => {
48
- const resolved = resolveApplicationTriggerBehaviors([
49
- {
50
- level: 'screen',
51
- behaviors: [
52
- {
53
- name: undefined,
54
- bindings: [
55
- { trigger: { triggerName: 'InvoiceImported' }, actions: [] },
56
- { trigger: { triggerName: 'SomethingElse' }, actions: [] },
57
- ],
58
- },
59
- ],
60
- },
61
- ], 'InvoiceImported');
62
- resolved.should.have.lengthOf(1);
63
- });
64
- it('should tolerate an attachment with no behaviors at all', () => {
65
- resolveBehaviors([{ level: 'element', behaviors: [] }], InteractionTriggerKind.Click).should.be.empty;
66
- });
67
- });
68
- //# sourceMappingURL=when_resolving_additive_attachments.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"when_resolving_additive_attachments.js","sourceRoot":"","sources":["../../../for_resolveBehaviors/when_resolving_additive_attachments.ts"],"names":[],"mappings":"AAGA,OAAO,EAAY,qBAAqB,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAC9F,OAAO,EAAsB,kCAAkC,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAE/G,MAAM,QAAQ,GAAG,CAAC,IAAwB,EAAE,IAA4B,EAAE,KAAc,EAAY,EAAE,CAAC,CAAC;IACpG,IAAI;IACJ,KAAK;IACL,QAAQ,EAAE;QACN;YACI,OAAO,EAAE,EAAE,IAAI,EAAW;YAC1B,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,qBAAqB,CAAC,YAAY,EAAE,KAAK,EAAE,IAAI,IAAI,QAAQ,EAAW,CAAC;SAC5F;KACJ;CACJ,CAAC,CAAC;AAEH,QAAQ,CAAC,qCAAqC,EAAE,GAAG,EAAE;IACjD,MAAM,W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CAAC,KAAK,CAAC,CAAC;IAC3B,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,+EAA+E,EAAE,GAAG,EAAE;QACrF,MAAM,QAAQ,GAAG,kCAAkC,CAC/C;YACI;gBACI,KAAK,EAAE,QAAQ;gBACf,SAAS,EAAE;oBACP;wBACI,IAAI,EAAE,SAAS;wBACf,QAAQ,EAAE;4BACN,EAAE,OAAO,EAAE,EAAE,WAAW,EAAE,iBAAiB,EAAW,EAAE,OAAO,EAAE,EAAE,EAAE;4BACrE,EAAE,OAAO,EAAE,EAAE,WAAW,EAAE,eAAe,EAAW,EAAE,OAAO,EAAE,EAAE,EAAE;yBACtE;qBACJ;iBACJ;aACJ;SACJ,EACD,iBAAiB,CACpB,CAAC;QAEF,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;IACrC,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,wDAAwD,EAAE,GAAG,EAAE;QAC9D,gBAAgB,CAAC,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,EAAE,EAAE,CAAC,EAAE,sBAAsB,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC,KAAK,CAAC;IAC1G,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=when_resolving_against_the_shared_fixture_corpus.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"when_resolving_against_the_shared_fixture_corpus.d.ts","sourceRoot":"","sources":["../../../for_resolveComponentName/when_resolving_against_the_shared_fixture_corpus.ts"],"names":[],"mappings":""}
@@ -1,20 +0,0 @@
1
- import { readFileSync } from 'node:fs';
2
- import { join } from 'node:path';
3
- import { resolveComponentName } from '../index';
4
- const manifestPath = join(import.meta.dirname, '..', '..', '..', '..', 'package-resolution-fixtures.json');
5
- const corpus = JSON.parse(readFileSync(manifestPath, 'utf-8'));
6
- describe('when resolving against the shared fixture corpus', () => {
7
- for (const fixtureCase of corpus.cases) {
8
- it(`should match the expected resolution for "${fixtureCase.name}"`, () => {
9
- const profile = { name: 'test', targetPlatform: 'web', packages: fixtureCase.profile.packages };
10
- const actual = resolveComponentName(fixtureCase.requestedName, profile, fixtureCase.catalog);
11
- if (fixtureCase.expected === null) {
12
- (actual === undefined).should.be.true;
13
- }
14
- else {
15
- actual.should.deep.equal(fixtureCase.expected);
16
- }
17
- });
18
- }
19
- });
20
- //# sourceMappingURL=when_resolving_against_the_shared_fixture_corpus.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"when_resolving_against_the_shared_fixture_corpus.js","sourceRoot":"","sources":["../../../for_resolveComponentName/when_resolving_against_the_shared_fixture_corpus.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EAAuC,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAcrF,MAAM,YAAY,GAAG,IAAI,CAAC,OAAO,IAAI,CAAC,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,kCAAkC,CAAC,CAAC;AAC3G,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,YAAY,EAAE,OAAO,CAAC,CAAkB,CAAC;AAEhF,QAAQ,CAAC,kDAAkD,EAAE,GAAG,EAAE;IAC9D,KAAK,MAAM,WAAW,IAAI,MAAM,CAAC,KAAK,EAAE,CAAC;QACrC,EAAE,CAAC,6CAA6C,WAAW,CAAC,IAAI,GAAG,EAAE,GAAG,EAAE;YACtE,MAAM,OAAO,GAAc,EAAE,IAAI,EAAE,MAAM,EAAE,cAAc,EAAE,KAAK,EAAE,QAAQ,EAAE,WAAW,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC;YAC3G,MAAM,MAAM,GAAG,oBAAoB,CAAC,WAAW,CAAC,aAAa,EAAE,OAAO,EAAE,WAAW,CAAC,OAAO,CAAC,CAAC;YAC7F,IAAI,WAAW,CAAC,QAAQ,KAAK,IAAI,EAAE,CAAC;gBAChC,CAAC,MAAM,KAAK,SAAS,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC,IAAI,CAAC;YAC1C,CAAC;iBAAM,CAAC;gBACJ,MAAO,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC;YACpD,CAAC;QACL,CAAC,CAAC,CAAC;IACP,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=when_resolving_against_the_shared_fixture_corpus.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"when_resolving_against_the_shared_fixture_corpus.d.ts","sourceRoot":"","sources":["../../../for_resolveScreenTemplates/when_resolving_against_the_shared_fixture_corpus.ts"],"names":[],"mappings":""}
@@ -1,30 +0,0 @@
1
- import { readFileSync } from 'node:fs';
2
- import { join } from 'node:path';
3
- import { isScreenTemplateResolutionValid, resolveScreenTemplates } from '../index';
4
- const fixturePath = join(import.meta.dirname, '..', '..', '..', '..', 'screen-template-fixtures.json');
5
- const corpus = JSON.parse(readFileSync(fixturePath, 'utf-8'));
6
- describe('when resolving against the shared fixture corpus', () => {
7
- for (const fixtureCase of corpus.cases) {
8
- const layout = { name: fixtureCase.layout.name, slots: fixtureCase.layout.slots.map((name) => ({ name })) };
9
- const templates = fixtureCase.templates.map((template) => ({
10
- name: template.name,
11
- fitsSlot: template.fitsSlot ?? undefined,
12
- slots: template.slots.map((name) => ({ name })),
13
- }));
14
- const resolution = resolveScreenTemplates(layout, templates);
15
- it(`should place every template where the corpus expects for "${fixtureCase.name}"`, () => {
16
- resolution.placements.should.deep.equal(fixtureCase.expectedPlacements);
17
- });
18
- it(`should report the expected unplaced templates for "${fixtureCase.name}"`, () => {
19
- resolution.unplaced.should.deep.equal(fixtureCase.expectedUnplaced);
20
- });
21
- it(`should report the expected cycles for "${fixtureCase.name}"`, () => {
22
- resolution.cycles.should.deep.equal(fixtureCase.expectedCycles);
23
- });
24
- it(`should consider "${fixtureCase.name}" valid only when nothing is wrong`, () => {
25
- const expectedValid = fixtureCase.expectedUnplaced.length === 0 && fixtureCase.expectedCycles.length === 0;
26
- isScreenTemplateResolutionValid(resolution).should.equal(expectedValid);
27
- });
28
- }
29
- });
30
- //# sourceMappingURL=when_resolving_against_the_shared_fixture_corpus.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"when_resolving_against_the_shared_fixture_corpus.js","sourceRoot":"","sources":["../../../for_resolveScreenTemplates/when_resolving_against_the_shared_fixture_corpus.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EAAE,+BAA+B,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAC;AAWnF,MAAM,WAAW,GAAG,IAAI,CAAC,OAAO,IAAI,CAAC,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,+BAA+B,CAAC,CAAC;AACvG,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,WAAW,EAAE,OAAO,CAAC,CAA6B,CAAC;AAE1F,QAAQ,CAAC,kDAAkD,EAAE,GAAG,EAAE;IAC9D,KAAK,MAAM,WAAW,IAAI,MAAM,CAAC,KAAK,EAAE,CAAC;QACrC,MAAM,MAAM,GAAW,EAAE,IAAI,EAAE,WAAW,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,EAAE,WAAW,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC;QACpH,MAAM,SAAS,GAAqB,WAAW,CAAC,SAAS,CAAC,GAAG,CAAC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AACL,CAAC,CAAC,CAAC"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=when_resolving_a_strings_reference.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"when_resolving_a_strings_reference.d.ts","sourceRoot":"","sources":["../../../for_resolveStrings/when_resolving_a_strings_reference.ts"],"names":[],"mappings":""}
@@ -1,69 +0,0 @@
1
- import { HorizontalAlignment, VerticalAlignment, Visibility } from '@cratis/scene.model';
2
- import { isStringsReference, resolveStringsInElement, resolveStringsValue } from '../index';
3
- const dictionary = {
4
- 'invoice.title': 'Invoices',
5
- 'invoice.number': 'Invoice #',
6
- };
7
- function control(id) {
8
- return {
9
- id,
10
- name: id,
11
- properties: {},
12
- visibility: Visibility.Visible,
13
- isEnabled: true,
14
- opacity: 1,
15
- size: {},
16
- zIndex: 0,
17
- minimumSize: {},
18
- maximumSize: {},
19
- margin: { left: 0, top: 0, right: 0, bottom: 0 },
20
- horizontalAlignment: HorizontalAlignment.Stretch,
21
- verticalAlignment: VerticalAlignment.Stretch,
22
- borderThickness: { left: 0, top: 0, right: 0, bottom: 0 },
23
- padding: { left: 0, top: 0, right: 0, bottom: 0 },
24
- tabIndex: 0,
25
- };
26
- }
27
- function externalComponent(id, componentName, properties, slots = {}) {
28
- return { ...control(id), componentName, properties, slots };
29
- }
30
- describe('when telling a strings reference apart from a literal value', () => {
31
- it('should recognize a $strings. reference', () => {
32
- isStringsReference('$strings.invoice.title').should.be.true;
33
- });
34
- it('should reject a literal value', () => {
35
- isStringsReference('Invoices').should.be.false;
36
- });
37
- it('should reject a non-string value', () => {
38
- isStringsReference(42).should.be.false;
39
- });
40
- });
41
- describe('when resolving a single property value', () => {
42
- it('should resolve a reference present in the dictionary', () => {
43
- resolveStringsValue('$strings.invoice.title', dictionary).should.equal('Invoices');
44
- });
45
- it('should leave a reference missing from the dictionary as its literal token', () => {
46
- resolveStringsValue('$strings.invoice.missing', dictionary).should.equal('$strings.invoice.missing');
47
- });
48
- it('should pass a non-reference value through unchanged', () => {
49
- resolveStringsValue(42, dictionary).should.equal(42);
50
- });
51
- });
52
- describe('when resolving references nested inside an external component tree', () => {
53
- const title = externalComponent('title', 'core:title', { text: '$strings.invoice.title' });
54
- const table = externalComponent('table', 'core:table', {}, {
55
- columns: [externalComponent('column', 'core:column', { label: '$strings.invoice.number' })],
56
- });
57
- const resolvedTitle = resolveStringsInElement(title, dictionary);
58
- const resolvedTable = resolveStringsInElement(table, dictionary);
59
- it('should resolve a reference at the top of the tree', () => {
60
- resolvedTitle.properties.text.should.equal('Invoices');
61
- });
62
- it('should leave the original element untouched', () => {
63
- title.properties.text.should.equal('$strings.invoice.title');
64
- });
65
- it('should resolve a reference nested inside a slot', () => {
66
- resolvedTable.slots.columns[0].properties.label.should.equal('Invoice #');
67
- });
68
- });
69
- //# sourceMappingURL=when_resolving_a_strings_reference.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"when_resolving_a_strings_reference.js","sourceRoot":"","sources":["../../../for_resolveStrings/when_resolving_a_strings_reference.ts"],"names":[],"mappings":"AAGA,OAAO,EAA8B,mBAAmB,EAAE,iBAAiB,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACrH,OAAO,EAAE,kBAAkB,EAAE,uBAAuB,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAE5F,MAAM,UAAU,GAAG;IACf,eAAe,EAAE,UAAU;IAC3B,gBAAgB,EAAE,WAAW;CAChC,CAAC;AAEF,SAAS,OAAO,CAAC,EAAU;IACvB,OAAO;QACH,EAAE;QACF,IAAI,EAAE,EAAE;QACR,UAAU,EAAE,EAAE;QACd,UAAU,EAAE,UAAU,CAAC,OAAO;QAC9B,SAAS,EAAE,IAAI;QACf,OAAO,EAAE,CAAC;QACV,IAAI,EAAE,EAAE;QACR,MAAM,EAAE,CAAC;QACT,WAAW,EAAE,EAAE;QACf,WAAW,EAAE,EAAE;QACf,MAAM,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE,GAAG,EA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,CAAC;IAC7E,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,iDAAiD,EAAE,GAAG,EAAE;QACtD,aAAa,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,KAAgB,CAAC,MAAM,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;IAC1F,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
@@ -1,21 +0,0 @@
1
- import { NotificationLevel } from '@cratis/scene.model';
2
- import { ActionDispatcher, CommandOutcome, DialogOutcome } from '../../ActionDispatcher';
3
- import { InteractionContext } from '../../runActions';
4
- export declare class RecordingDispatcher implements ActionDispatcher {
5
- readonly calls: string[];
6
- commandSucceeds: boolean;
7
- dialogConfirmed: boolean;
8
- confirmAnswer: boolean;
9
- executeCommand(command: string, args: Record<string, unknown>): Promise<CommandOutcome>;
10
- navigate(screen: string): void;
11
- navigateBack(): void;
12
- openDialog(dialogTemplate: string, args: Record<string, unknown>): Promise<DialogOutcome>;
13
- closeDialog(): void;
14
- refreshQuery(query: string): Promise<void>;
15
- setState(target: string, value: unknown): void;
16
- notify(level: NotificationLevel, message: string): void;
17
- confirm(message: string): Promise<boolean>;
18
- raise(trigger: string): Promise<void>;
19
- }
20
- export declare const pathEchoingContext: InteractionContext;
21
- //# sourceMappingURL=a_recording_dispatcher.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"a_recording_dispatcher.d.ts","sourceRoot":"","sources":["../../../../for_runActions/given/a_recording_dispatcher.ts"],"names":[],"mappings":"AAGA,OAAO,EAAqB,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAC3E,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACzF,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAQtD,qBAAa,mBAAoB,YAAW,gBAAgB;IACxD,QAAQ,CAAC,KAAK,EAAE,MAAM,EAAE,CAAM;IAE9B,eAAe,UAAQ;IACvB,eAAe,UAAQ;IACvB,aAAa,UAAQ;IAEf,cAAc,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,cAAc,CAAC,CAK5F;IAED,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAE7B;IAED,YAAY,IAAI,IAAI,CAEnB;IAEK,UAAU,CAAC,cAAc,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,aAAa,CAAC,CAG9F;IAED,WAAW,IAAI,IAAI,CAElB;IAEK,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAE/C;IAED,QAAQ,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,IAAI,CAE7C;IAED,MAAM,CAAC,KAAK,EAAE,iBAAiB,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI,CAEtD;IAEK,OAAO,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAG/C;IAEK,KAAK,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAE1C;CACJ;AAKD,eAAO,MAAM,kBAAkB,EAAE,kBAEhC,CAAC"}
@@ -1,45 +0,0 @@
1
- export class RecordingDispatcher {
2
- calls = [];
3
- commandSucceeds = true;
4
- dialogConfirmed = true;
5
- confirmAnswer = true;
6
- async executeCommand(command, args) {
7
- this.calls.push(`executeCommand:${command}:${JSON.stringify(args)}`);
8
- return this.commandSucceeds
9
- ? { isSuccess: true }
10
- : { isSuccess: false, validationErrors: [{ member: 'amount', message: 'Must be positive' }] };
11
- }
12
- navigate(screen) {
13
- this.calls.push(`navigate:${screen}`);
14
- }
15
- navigateBack() {
16
- this.calls.push('navigateBack');
17
- }
18
- async openDialog(dialogTemplate, args) {
19
- this.calls.push(`openDialog:${dialogTemplate}:${JSON.stringify(args)}`);
20
- return { isConfirmed: this.dialogConfirmed, result: 'the-result' };
21
- }
22
- closeDialog() {
23
- this.calls.push('closeDialog');
24
- }
25
- async refreshQuery(query) {
26
- this.calls.push(`refreshQuery:${query}`);
27
- }
28
- setState(target, value) {
29
- this.calls.push(`setState:${target}:${String(value)}`);
30
- }
31
- notify(level, message) {
32
- this.calls.push(`notify:${level}:${message}`);
33
- }
34
- async confirm(message) {
35
- this.calls.push(`confirm:${message}`);
36
- return this.confirmAnswer;
37
- }
38
- async raise(trigger) {
39
- this.calls.push(`raise:${trigger}`);
40
- }
41
- }
42
- export const pathEchoingContext = {
43
- resolve: (binding) => `<${binding.path}>`,
44
- };
45
- //# sourceMappingURL=a_recording_dispatcher.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"a_recording_dispatcher.js","sourceRoot":"","sources":["../../../../for_runActions/given/a_recording_dispatcher.ts"],"names":[],"mappings":"AAaA,MAAM,OAAO,mBAAmB;IACnB,KAAK,GAAa,EAAE,CAAC;IAE9B,eAAe,GAAG,IAAI,CAAC;IACvB,eAAe,GAAG,IAAI,CAAC;IACvB,aAAa,GAAG,IAAI,CAAC;IAErB,KAAK,CAAC,cAAc,CAAC,OAAe,EAAE,IAA6B;QAC/D,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,kBAAkB,OAAO,IAAI,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACrE,OAAO,IAAI,CAAC,eAAe;YACvB,CAAC,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE;YACrB,CAAC,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,gBAAgB,EAAE,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,kBAAkB,EAAE,CAAC,EAAE,CAAC;IACtG,CAAC;IAED,QAAQ,CAAC,MAAc;QACnB,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,YAAY,MAAM,EAA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AAI,OAAO,CAAC,IAAI,GAAG;CAC/D,CAAC"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=when_running_a_sequence_of_actions.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"when_running_a_sequence_of_actions.d.ts","sourceRoot":"","sources":["../../../for_runActions/when_running_a_sequence_of_actions.ts"],"names":[],"mappings":""}
@@ -1,126 +0,0 @@
1
- import { InteractionActionKind, NotificationLevel } from '@cratis/scene.model';
2
- import { InteractionStop, runActions } from '../runActions';
3
- import { pathEchoingContext, RecordingDispatcher } from './given/a_recording_dispatcher';
4
- const action = (kind, extra = {}) => ({ kind, ...extra });
5
- describe('when running a sequence of actions', () => {
6
- it('should run them in the order they were declared', async () => {
7
- const dispatcher = new RecordingDispatcher();
8
- await runActions([
9
- action(InteractionActionKind.RefreshQuery, { query: 'Invoices' }),
10
- action(InteractionActionKind.Notify, { level: NotificationLevel.Info, message: { text: 'Done' } }),
11
- ], dispatcher, pathEchoingContext);
12
- dispatcher.calls.should.eql(['refreshQuery:Invoices', 'notify:Info:Done']);
13
- });
14
- it('should resolve an action\'s arguments through the binding resolver', async () => {
15
- const dispatcher = new RecordingDispatcher();
16
- await runActions([
17
- action(InteractionActionKind.ExecuteCommand, {
18
- command: 'CancelInvoice',
19
- arguments: [{ name: 'invoiceId', value: { path: 'item.invoiceId' } }],
20
- }),
21
- ], dispatcher, pathEchoingContext);
22
- dispatcher.calls.should.eql(['executeCommand:CancelInvoice:{"invoiceId":"<item.invoiceId>"}']);
23
- });
24
- it('should take the success branch when a command succeeds', async () => {
25
- const dispatcher = new RecordingDispatcher();
26
- const run = await runActions([
27
- action(InteractionActionKind.ExecuteCommand, {
28
- command: 'RegisterInvoice',
29
- onSuccess: [action(InteractionActionKind.CloseDialog)],
30
- onFailure: [action(InteractionActionKind.Notify, { level: NotificationLevel.Error, message: { text: 'Failed' } })],
31
- }),
32
- ], dispatcher, pathEchoingContext);
33
- dispatcher.calls.should.eql(['executeCommand:RegisterInvoice:{}', 'closeDialog']);
34
- run.stop.should.equal(InteractionStop.Completed);
35
- });
36
- it('should take the failure branch when a command fails', async () => {
37
- const dispatcher = new RecordingDispatcher();
38
- dispatcher.commandSucceeds = false;
39
- await runActions([
40
- action(InteractionActionKind.ExecuteCommand, {
41
- command: 'RegisterInvoice',
42
- onSuccess: [action(InteractionActionKind.CloseDialog)],
43
- onFailure: [action(InteractionActionKind.Notify, { level: NotificationLevel.Error, message: { text: 'Failed' } })],
44
- }),
45
- ], dispatcher, pathEchoingContext);
46
- dispatcher.calls.should.eql(['executeCommand:RegisterInvoice:{}', 'notify:Error:Failed']);
47
- });
48
- it('should stop the sequence when a confirm is declined', async () => {
49
- const dispatcher = new RecordingDispatcher();
50
- dispatcher.confirmAnswer = false;
51
- const run = await runActions([
52
- action(InteractionActionKind.Confirm, {
53
- message: { text: 'Are you sure?' },
54
- onSuccess: [action(InteractionActionKind.ExecuteCommand, { command: 'CancelInvoice' })],
55
- }),
56
- action(InteractionActionKind.Notify, { level: NotificationLevel.Info, message: { text: 'Cancelled' } }),
57
- ], dispatcher, pathEchoingContext);
58
- dispatcher.calls.should.eql(['confirm:Are you sure?']);
59
- run.stop.should.equal(InteractionStop.Declined);
60
- });
61
- it('should run the gated actions when a confirm is accepted', async () => {
62
- const dispatcher = new RecordingDispatcher();
63
- await runActions([
64
- action(InteractionActionKind.Confirm, {
65
- message: { text: 'Are you sure?' },
66
- onSuccess: [action(InteractionActionKind.ExecuteCommand, { command: 'CancelInvoice' })],
67
- }),
68
- ], dispatcher, pathEchoingContext);
69
- dispatcher.calls.should.eql(['confirm:Are you sure?', 'executeCommand:CancelInvoice:{}']);
70
- });
71
- it('should stop the sequence after a navigation', async () => {
72
- const dispatcher = new RecordingDispatcher();
73
- const run = await runActions([
74
- action(InteractionActionKind.Navigate, { screen: 'InvoiceList' }),
75
- action(InteractionActionKind.Notify, { level: NotificationLevel.Info, message: { text: 'Never runs' } }),
76
- ], dispatcher, pathEchoingContext);
77
- dispatcher.calls.should.eql(['navigate:InvoiceList']);
78
- run.stop.should.equal(InteractionStop.Navigated);
79
- });
80
- it('should stop the sequence after navigating back', async () => {
81
- const dispatcher = new RecordingDispatcher();
82
- const run = await runActions([action(InteractionActionKind.NavigateBack), action(InteractionActionKind.CloseDialog)], dispatcher, pathEchoingContext);
83
- dispatcher.calls.should.eql(['navigateBack']);
84
- run.stop.should.equal(InteractionStop.Navigated);
85
- });
86
- it('should run a dialog\'s result continuation after it closes', async () => {
87
- const dispatcher = new RecordingDispatcher();
88
- await runActions([
89
- action(InteractionActionKind.OpenDialog, {
90
- dialogTemplate: 'InvoiceDetails',
91
- arguments: [{ name: 'invoiceId', value: { path: 'item.invoiceId' } }],
92
- onResult: [action(InteractionActionKind.RefreshQuery, { query: 'Invoices' })],
93
- }),
94
- ], dispatcher, pathEchoingContext);
95
- dispatcher.calls.should.eql([
96
- 'openDialog:InvoiceDetails:{"invoiceId":"<item.invoiceId>"}',
97
- 'refreshQuery:Invoices',
98
- ]);
99
- });
100
- it('should resolve a message from a binding when it has one', async () => {
101
- const dispatcher = new RecordingDispatcher();
102
- await runActions([action(InteractionActionKind.Notify, { level: NotificationLevel.Info, message: { binding: { path: 'state.message' } } })], dispatcher, pathEchoingContext);
103
- dispatcher.calls.should.eql(['notify:Info:<state.message>']);
104
- });
105
- it('should localize a message given a strings key', async () => {
106
- const dispatcher = new RecordingDispatcher();
107
- await runActions([action(InteractionActionKind.Notify, { level: NotificationLevel.Info, message: { stringsKey: 'invoiceRegistered' } })], dispatcher, { resolve: () => undefined, localize: key => `localized(${key})` });
108
- dispatcher.calls.should.eql(['notify:Info:localized(invoiceRegistered)']);
109
- });
110
- it('should report an action kind it does not know instead of ignoring it', async () => {
111
- const dispatcher = new RecordingDispatcher();
112
- const run = await runActions([action('SomethingFromALaterVersion')], dispatcher, pathEchoingContext);
113
- dispatcher.calls.should.be.empty;
114
- run.stop.should.equal(InteractionStop.Reported);
115
- run.findings.should.have.lengthOf(1);
116
- run.findings[0].kind.should.equal('unknownAction');
117
- run.findings[0].detail.should.contain('SomethingFromALaterVersion');
118
- });
119
- it('should report a message binding that resolved to nothing', async () => {
120
- const dispatcher = new RecordingDispatcher();
121
- const run = await runActions([action(InteractionActionKind.Confirm, { message: { binding: { path: 'state.missing' } } })], dispatcher, { resolve: () => undefined });
122
- run.findings[0].kind.should.equal('unresolvedMessage');
123
- run.findings[0].detail.should.contain('state.missing');
124
- });
125
- });
126
- //# sourceMappingURL=when_running_a_sequence_of_actions.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"when_running_a_sequence_of_actions.js","sourceRoot":"","sources":["../../../for_runActions/when_running_a_sequence_of_actions.ts"],"names":[],"mappings":"AAGA,OAAO,EAAqB,qBAAqB,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAClG,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC5D,OAAO,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,gCAAgC,CAAC;AAEzF,MAAM,MAAM,GAAG,CAAC,IAA2B,EAAE,KAAK,GAA4B,EAAE,EAAqB,EAAE,CACnG,CAAC,EAAE,IAAI,EAAE,GAAG,KAAK,EAAE,CAAsB,CAAC;AAE9C,QAAQ,CAAC,oCAAoC,EAAE,GAAG,EAAE;IAChD,EAAE,CAAC,iDAAiD,EAAE,KAAK,IAAI,EAAE;QAC7D,MAAM,UAAU,GAAG,IAAI,mBAAmB,EAAE,CAAC;QAE7C,MAAM,UAAU,CACZ;YACI,MAAM,CAAC,qBAAqB,CAAC,YAAY,EAAE,EAAE,KAAK,EAAE,UAAU,EAAE,CAAC;YACjE,MAAM,CAAC,qBAAqB,CAAC,MAAM,EAAE,EAAE,KAAK,EAAE,iBAAiB,CAAC,IAAI,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,CAAC;SACrG,EACD,UAAU,EACV,kBAAkB,CACrB,CAAC;QAEF,UAAU,CAAC,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E,CAAC,KAAK,CAAC;QACjC,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,eAAe,CAAC,QAAQ,CAAC,CAAC;QAChD,GAAG,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;QACrC,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,eAAe,CAAC,CAAC;QACnD,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,4BAA4B,CAAC,CAAC;IACxE,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,0DAA0D,EAAE,KAAK,IAAI,EAAE;QACtE,MAAM,UAAU,GAAG,IAAI,mBAAmB,EAAE,CAAC;QAE7C,MAAM,GAAG,GAAG,MAAM,UAAU,CACxB,CAAC,MAAM,CAAC,qBAAqB,CAAC,OAAO,EAAE,EAAE,OAAO,EAAE,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,eAAe,EAAE,EAAE,EAAE,CAAC,CAAC,EAC5F,UAAU,EACV,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,SAAS,EAAE,CAC/B,CAAC;QAEF,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,mBAAmB,CAAC,CAAC;QACvD,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,eAAe,CAAC,CAAC;IAC3D,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=when_running_against_the_shared_fixture_corpus.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"when_running_against_the_shared_fixture_corpus.d.ts","sourceRoot":"","sources":["../../../for_runActions/when_running_against_the_shared_fixture_corpus.ts"],"names":[],"mappings":""}
@@ -1,61 +0,0 @@
1
- import { readFileSync } from 'node:fs';
2
- import { join } from 'node:path';
3
- import { InteractionActionKind, InteractionTriggerKind, NotificationLevel } from '@cratis/scene.model';
4
- import { resolveBehaviors } from '../resolveBehaviors';
5
- import { InteractionStop, runActions } from '../runActions';
6
- import { pathEchoingContext, RecordingDispatcher } from './given/a_recording_dispatcher';
7
- const manifestPath = join(import.meta.dirname, '..', '..', '..', '..', 'interaction-fixtures.json');
8
- const corpus = JSON.parse(readFileSync(manifestPath, 'utf-8'));
9
- function attachment(fixture) {
10
- return {
11
- level: fixture.level,
12
- depth: fixture.depth,
13
- behaviors: fixture.behaviors.map(behavior => ({
14
- name: behavior.name ?? undefined,
15
- order: behavior.order,
16
- bindings: [
17
- {
18
- trigger: { kind: InteractionTriggerKind[behavior.trigger] },
19
- actions: [],
20
- },
21
- ],
22
- })),
23
- };
24
- }
25
- function action(fixture) {
26
- return {
27
- kind: InteractionActionKind[fixture.kind] ?? fixture.kind,
28
- command: fixture.command,
29
- query: fixture.query,
30
- screen: fixture.screen,
31
- dialogTemplate: fixture.dialogTemplate,
32
- level: fixture.level === undefined ? undefined : NotificationLevel[fixture.level],
33
- message: fixture.text === undefined ? undefined : { text: fixture.text },
34
- onSuccess: (fixture.onSuccess ?? []).map(action),
35
- onFailure: (fixture.onFailure ?? []).map(action),
36
- onResult: (fixture.onResult ?? []).map(action),
37
- };
38
- }
39
- function callsWithoutArguments(calls) {
40
- return calls.map(call => call.replace(/:\{.*\}$/, ''));
41
- }
42
- describe('when running against the shared fixture corpus', () => {
43
- for (const fixture of corpus.resolutionCases) {
44
- it(`should resolve the case where ${fixture.name}`, () => {
45
- const resolved = resolveBehaviors(fixture.attachments.map(attachment), InteractionTriggerKind[fixture.trigger]);
46
- resolved.map(candidate => candidate.behaviorName ?? null).should.eql(fixture.expected);
47
- });
48
- }
49
- for (const fixture of corpus.sequencingCases) {
50
- it(`should sequence the case where ${fixture.name}`, async () => {
51
- const dispatcher = new RecordingDispatcher();
52
- dispatcher.commandSucceeds = fixture.commandSucceeds;
53
- dispatcher.confirmAnswer = fixture.confirmAnswer;
54
- const run = await runActions(fixture.actions.map(action), dispatcher, pathEchoingContext);
55
- callsWithoutArguments(dispatcher.calls).should.eql(fixture.expectedCalls);
56
- run.stop.should.equal(InteractionStop[fixture.expectedStop]);
57
- run.findings.map(finding => finding.kind).should.eql(fixture.expectedFindings ?? []);
58
- });
59
- }
60
- });
61
- //# sourceMappingURL=when_running_against_the_shared_fixture_corpus.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"when_running_against_the_shared_fixture_corpus.js","sourceRoot":"","sources":["../../../for_runActions/when_running_against_the_shared_fixture_corpus.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAqB,qBAAqB,EAAE,sBAAsB,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAC1H,OAAO,EAAsB,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAC3E,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC5D,OAAO,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,gCAAgC,CAAC;AAiDzF,MAAM,YAAY,GAAG,IAAI,CAAC,OAAO,IAAI,CAAC,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,2BAA2B,CAAC,CAAC;AACpG,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,YAAY,EAAE,OAAO,CAAC,CAAkB,CAAC;AAEhF,SAAS,UAAU,CAAC,OAA0B;IAC1C,OAAO;QACH,KAAK,EAAE,OAAO,CAAC,KAAK;QACpB,KAAK,EAAE,OAAO,CAAC,KAAK;QACpB,SAAS,EAAE,OAAO,CAAC,SAAS,CAAC,GAAG,CAAC,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QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,OAAO,CAAC,gBAAgB,IAAI,EAAE,CAAC,CAAC;QACzF,CAAC,CAAC,CAAC;IACP,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=when_checking_against_the_shared_fixture_corpus.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"when_checking_against_the_shared_fixture_corpus.d.ts","sourceRoot":"","sources":["../../../for_themeCompatibility/when_checking_against_the_shared_fixture_corpus.ts"],"names":[],"mappings":""}
@@ -1,18 +0,0 @@
1
- import { readFileSync } from 'node:fs';
2
- import { join } from 'node:path';
3
- import { applicableThemePackages, incompatiblePackages } from '../index';
4
- const manifestPath = join(import.meta.dirname, '..', '..', '..', '..', 'theme-compatibility-fixtures.json');
5
- const corpus = JSON.parse(readFileSync(manifestPath, 'utf-8'));
6
- describe('when checking against the shared fixture corpus', () => {
7
- for (const fixtureCase of corpus.cases) {
8
- const theme = { name: 'test-theme', compatibleWith: fixtureCase.theme.compatibleWith };
9
- const profile = { name: 'test-profile', targetPlatform: 'web', packages: fixtureCase.profile.packages };
10
- it(`should match the expected incompatible packages for "${fixtureCase.name}"`, () => {
11
- incompatiblePackages(theme, profile).should.deep.equal(fixtureCase.expectedIncompatible);
12
- });
13
- it(`should match the expected applicable packages for "${fixtureCase.name}"`, () => {
14
- applicableThemePackages(theme, profile).should.deep.equal(fixtureCase.expectedApplicable);
15
- });
16
- }
17
- });
18
- //# sourceMappingURL=when_checking_against_the_shared_fixture_corpus.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"when_checking_against_the_shared_fixture_corpus.js","sourceRoot":"","sources":["../../../for_themeCompatibility/when_checking_against_the_shared_fixture_corpus.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAA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