pict-section-form 1.3.16 → 1.3.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/source/providers/inputs/Pict-Provider-Input-Chart-CSS.js +49 -0
- package/example_applications/nested_distill_sandbox/Sandbox-Driver-Headlight.js +0 -17
- package/example_applications/nested_distill_sandbox/Sandbox-Driver.js +0 -369
- package/example_applications/nested_distill_sandbox/Sandbox-Runner.js +0 -372
- package/example_applications/nested_distill_sandbox/approaches/A1-tabular-trigger-group.js +0 -67
- package/example_applications/nested_distill_sandbox/approaches/A3-crossmap-selectoptionsrefresh.js +0 -61
- package/example_applications/nested_distill_sandbox/approaches/A4-graph-solvers-flat-list.js +0 -53
- package/example_applications/nested_distill_sandbox/approaches/A5-facet-filter.js +0 -75
- package/example_applications/nested_distill_sandbox/approaches/A5b-facet-filter-symmetric.js +0 -15
- package/example_applications/nested_distill_sandbox/approaches/A5h-facet-filter-headlight-picker.js +0 -15
- package/example_applications/nested_distill_sandbox/approaches/R0-original-jmf-manifest-headlight.js +0 -27
- package/example_applications/nested_distill_sandbox/approaches/R1-real-jmf-manifest-headlight.js +0 -136
- package/example_applications/nested_distill_sandbox/approaches/_Common.js +0 -344
- package/example_applications/nested_distill_sandbox/approaches/_Scenarios.js +0 -262
|
@@ -1,262 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
The user stories every approach is scored on. An approach declares which behaviours it claims
|
|
3
|
-
(pCapabilities); a check for a behaviour it does not claim is reported as [known], not [fail].
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
const libCommon = require('./_Common.js');
|
|
7
|
-
|
|
8
|
-
const SUMMARY_ADDRESS = `${libCommon.MARSHAL_ROOT}.FormulaData.AggregateBlendGsb`;
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* @param {Record<string, any>} pFixtures
|
|
12
|
-
* @param {Record<string, boolean>} pCapabilities
|
|
13
|
-
* @param {Array<string>} pSelectColumns
|
|
14
|
-
* @return {Array<Record<string, any>>}
|
|
15
|
-
*/
|
|
16
|
-
function scenarios(pFixtures, pCapabilities, pSelectColumns)
|
|
17
|
-
{
|
|
18
|
-
const tmpCan = (pKey) => (pCapabilities[pKey] === false) ? false : undefined;
|
|
19
|
-
const tmpState = pFixtures.StateGraph;
|
|
20
|
-
const tmpAllPits = libCommon.distinctStrings(tmpState.map((pRow) => pRow.PitNumber));
|
|
21
|
-
const tmpProductA = pFixtures.UniquePitProduct;
|
|
22
|
-
const tmpProductB = pFixtures.ProductElsewhere;
|
|
23
|
-
const tmpProductC = tmpState.find((pRow) => (pRow.Gsb !== undefined) && (pRow.IDProduct !== tmpProductA.IDProduct) && (pRow.IDProduct !== tmpProductB.IDProduct) && (pRow.Site !== tmpProductA.Site) && (pRow.Site !== tmpProductB.Site));
|
|
24
|
-
const tmpHasSelect = (pColumn) => pSelectColumns.indexOf(pColumn) >= 0;
|
|
25
|
-
const fRowMatches = (pRow, pProduct) => pRow && (String(pRow.Data.Material) === String(pProduct.IDProduct)) && (pRow.Data.Site === pProduct.Site) && (String(pRow.Data.PitNumber) === String(pProduct.PitNumber)) && ((pProduct.Gsb === undefined) ? ((pRow.Data.Gsb === undefined) || (pRow.Data.Gsb === '')) : (Number(pRow.Data.Gsb) === Number(pProduct.Gsb)));
|
|
26
|
-
const fSummaryHas = (pSnapshot, pProduct) => (pProduct.Gsb === undefined) || (String(pSnapshot.Probe[SUMMARY_ADDRESS] || '').split(',').indexOf(String(pProduct.Gsb)) >= 0);
|
|
27
|
-
const fIntegrity = (pResults, pGraph) => libCommon.integrityChecks(pResults, pGraph, pSelectColumns, tmpCan('Integrity'));
|
|
28
|
-
|
|
29
|
-
const tmpScenarios = [];
|
|
30
|
-
|
|
31
|
-
tmpScenarios.push(
|
|
32
|
-
{
|
|
33
|
-
Name: 'product-first',
|
|
34
|
-
Script:
|
|
35
|
-
[
|
|
36
|
-
{ Action: 'choose', Row: 1, Column: 'Material', Value: String(tmpProductB.IDProduct), SettleMs: 0, Label: 'choose product' },
|
|
37
|
-
{ Action: 'snapshot', Label: 'immediate' },
|
|
38
|
-
{ Action: 'wait', Ms: 600 },
|
|
39
|
-
{ Action: 'snapshot', Label: 'settled' },
|
|
40
|
-
],
|
|
41
|
-
checks: (pResults, pFixtures2, pGraph) =>
|
|
42
|
-
{
|
|
43
|
-
const tmpImmediate = libCommon.snapshot(pResults, 'immediate');
|
|
44
|
-
const tmpSettled = libCommon.snapshot(pResults, 'settled');
|
|
45
|
-
return (
|
|
46
|
-
[
|
|
47
|
-
libCommon.check('choosing a product fills its Site, Pit and Gsb into that row', fRowMatches(tmpSettled.Rows[1], tmpProductB), tmpSettled.Rows[1].Data, tmpCan('AutofillFromProduct')),
|
|
48
|
-
libCommon.check('the fill is in place in the same solve (no lag)', fRowMatches(tmpImmediate.Rows[1], tmpProductB), tmpImmediate.Rows[1].Data, tmpCan('NoLag')),
|
|
49
|
-
libCommon.check('the form-level summary sees the new row values in the same solve', fSummaryHas(tmpImmediate, tmpProductB), tmpImmediate.Probe, tmpCan('NoLag')),
|
|
50
|
-
libCommon.check('the summary is right once settled', fSummaryHas(tmpSettled, tmpProductB), tmpSettled.Probe, tmpCan('AutofillFromProduct')),
|
|
51
|
-
libCommon.check('other rows are untouched', [ 0, 2, 3 ].every((pIndex) => !tmpSettled.Rows[pIndex].Data.Material && !tmpSettled.Rows[pIndex].Data.Site), [ 0, 2, 3 ].map((pIndex) => tmpSettled.Rows[pIndex].Data), tmpCan('RowIsolation')),
|
|
52
|
-
].concat(fIntegrity(pResults, pGraph)));
|
|
53
|
-
}
|
|
54
|
-
});
|
|
55
|
-
|
|
56
|
-
if (tmpHasSelect('Site'))
|
|
57
|
-
{
|
|
58
|
-
tmpScenarios.push(
|
|
59
|
-
{
|
|
60
|
-
Name: 'site-first',
|
|
61
|
-
Script:
|
|
62
|
-
[
|
|
63
|
-
{ Action: 'choose', Row: 0, Column: 'Site', Value: pFixtures.MultiPitSite, Label: 'choose site' },
|
|
64
|
-
{ Action: 'snapshot', Label: 'site' },
|
|
65
|
-
{ Action: 'choose', Row: 0, Column: 'PitNumber', Value: pFixtures.UniquePit, Label: 'choose pit' },
|
|
66
|
-
{ Action: 'snapshot', Label: 'pit' },
|
|
67
|
-
],
|
|
68
|
-
checks: (pResults, pFixtures2, pGraph) =>
|
|
69
|
-
{
|
|
70
|
-
const tmpSite = libCommon.snapshot(pResults, 'site');
|
|
71
|
-
const tmpPit = libCommon.snapshot(pResults, 'pit');
|
|
72
|
-
const tmpProductsAtSite = libCommon.matching(tmpState, { Site: pFixtures.MultiPitSite }).map((pRow) => pRow.IDProduct);
|
|
73
|
-
return (
|
|
74
|
-
[
|
|
75
|
-
libCommon.check('the Pit list narrows to the pits at the chosen Site', libCommon.sameSet(tmpSite.Rows[0].Options.PitNumber, pFixtures.PitsOfMultiPitSite), { Offered: tmpSite.Rows[0].Options.PitNumber, Expected: pFixtures.PitsOfMultiPitSite }, tmpCan('NarrowByRow')),
|
|
76
|
-
libCommon.check('the Product list narrows to the products at the chosen Site', libCommon.sameSet(tmpSite.Rows[0].Options.Material, tmpProductsAtSite), { Offered: (tmpSite.Rows[0].Options.Material || []).length, Expected: tmpProductsAtSite.length }, tmpCan('NarrowByRow')),
|
|
77
|
-
libCommon.check('another row\'s Pit list is not narrowed by this row', libCommon.sameSet(tmpSite.Rows[1].Options.PitNumber, tmpAllPits), { Offered: (tmpSite.Rows[1].Options.PitNumber || []).length, Expected: tmpAllPits.length }, tmpCan('RowIsolation')),
|
|
78
|
-
libCommon.check('a Pit with exactly one product at that Site fills the product', fRowMatches(tmpPit.Rows[0], tmpProductA), tmpPit.Rows[0].Data, tmpCan('AutofillUnique')),
|
|
79
|
-
libCommon.check('the summary sees the filled product in the same solve', fSummaryHas(tmpPit, tmpProductA), tmpPit.Probe, tmpCan('AutofillUnique')),
|
|
80
|
-
].concat(fIntegrity(pResults, pGraph)));
|
|
81
|
-
}
|
|
82
|
-
});
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
if (tmpHasSelect('Site') && pFixtures.MultiProductPit)
|
|
86
|
-
{
|
|
87
|
-
tmpScenarios.push(
|
|
88
|
-
{
|
|
89
|
-
Name: 'pit-with-several-products',
|
|
90
|
-
Script:
|
|
91
|
-
[
|
|
92
|
-
{ Action: 'choose', Row: 2, Column: 'PitNumber', Value: pFixtures.MultiProductPit, Label: 'choose pit' },
|
|
93
|
-
{ Action: 'snapshot', Label: 'pit' },
|
|
94
|
-
],
|
|
95
|
-
checks: (pResults, pFixtures2, pGraph) =>
|
|
96
|
-
{
|
|
97
|
-
const tmpPit = libCommon.snapshot(pResults, 'pit');
|
|
98
|
-
const tmpProducts = libCommon.matching(tmpState, { PitNumber: pFixtures.MultiProductPit });
|
|
99
|
-
const tmpSites = libCommon.distinctStrings(tmpProducts.map((pRow) => pRow.Site));
|
|
100
|
-
return (
|
|
101
|
-
[
|
|
102
|
-
libCommon.check('an ambiguous Pit leaves the product blank', !tmpPit.Rows[2].Data.Material, tmpPit.Rows[2].Data, tmpCan('AutofillUnique')),
|
|
103
|
-
libCommon.check('the Product list narrows to that Pit\'s products', libCommon.sameSet(tmpPit.Rows[2].Options.Material, tmpProducts.map((pRow) => pRow.IDProduct)), { Offered: (tmpPit.Rows[2].Options.Material || []).length, Expected: tmpProducts.length }, tmpCan('NarrowByRow')),
|
|
104
|
-
libCommon.check((tmpSites.length === 1) ? 'a Pit found at exactly one Site fills the Site' : 'a Pit found at several Sites leaves the Site blank', (tmpSites.length === 1) ? (tmpPit.Rows[2].Data.Site === tmpSites[0]) : !tmpPit.Rows[2].Data.Site, tmpPit.Rows[2].Data, tmpCan('AutofillUnique')),
|
|
105
|
-
].concat(fIntegrity(pResults, pGraph)));
|
|
106
|
-
}
|
|
107
|
-
});
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
tmpScenarios.push(
|
|
111
|
-
{
|
|
112
|
-
Name: 'change-site-after-product',
|
|
113
|
-
Script: tmpHasSelect('Site') ?
|
|
114
|
-
[
|
|
115
|
-
{ Action: 'choose', Row: 0, Column: 'Material', Value: String(tmpProductA.IDProduct), Label: 'choose product' },
|
|
116
|
-
{ Action: 'wait', Ms: 400 },
|
|
117
|
-
{ Action: 'choose', Row: 0, Column: 'Site', Value: pFixtures.OtherSite, Label: 'change site' },
|
|
118
|
-
{ Action: 'wait', Ms: 400 },
|
|
119
|
-
{ Action: 'snapshot', Label: 'changed' },
|
|
120
|
-
] :
|
|
121
|
-
[
|
|
122
|
-
{ Action: 'choose', Row: 0, Column: 'Material', Value: String(tmpProductA.IDProduct), Label: 'choose product' },
|
|
123
|
-
{ Action: 'wait', Ms: 400 },
|
|
124
|
-
{ Action: 'choose', Row: 0, Column: 'Material', Value: String(tmpProductB.IDProduct), Label: 'change product' },
|
|
125
|
-
{ Action: 'wait', Ms: 400 },
|
|
126
|
-
{ Action: 'snapshot', Label: 'changed' },
|
|
127
|
-
],
|
|
128
|
-
checks: (pResults, pFixtures2, pGraph) =>
|
|
129
|
-
{
|
|
130
|
-
const tmpChanged = libCommon.snapshot(pResults, 'changed');
|
|
131
|
-
const tmpRow = tmpChanged.Rows[0].Data;
|
|
132
|
-
const tmpChecks = [];
|
|
133
|
-
if (tmpHasSelect('Site'))
|
|
134
|
-
{
|
|
135
|
-
tmpChecks.push(libCommon.check('changing the Site keeps the new Site and drops the product that is not there', (tmpRow.Site === pFixtures.OtherSite) && (!tmpRow.Material || (libCommon.matching(tmpState, { Site: tmpRow.Site, IDProduct: tmpRow.Material }).length > 0)), tmpRow, tmpCan('ClearOnChange')));
|
|
136
|
-
}
|
|
137
|
-
else
|
|
138
|
-
{
|
|
139
|
-
tmpChecks.push(libCommon.check('changing the product re-derives Site, Pit and Gsb', fRowMatches(tmpChanged.Rows[0], tmpProductB), tmpRow, tmpCan('AutofillFromProduct')));
|
|
140
|
-
}
|
|
141
|
-
return tmpChecks.concat(fIntegrity(pResults, pGraph));
|
|
142
|
-
}
|
|
143
|
-
});
|
|
144
|
-
|
|
145
|
-
tmpScenarios.push(
|
|
146
|
-
{
|
|
147
|
-
Name: 'delete-row',
|
|
148
|
-
Script:
|
|
149
|
-
[
|
|
150
|
-
{ Action: 'addRow' },
|
|
151
|
-
{ Action: 'wait', Ms: 100 },
|
|
152
|
-
{ Action: 'choose', Row: 0, Column: 'Material', Value: String(tmpProductA.IDProduct) },
|
|
153
|
-
{ Action: 'wait', Ms: 400 },
|
|
154
|
-
{ Action: 'choose', Row: 1, Column: 'Material', Value: String(tmpProductB.IDProduct) },
|
|
155
|
-
{ Action: 'wait', Ms: 400 },
|
|
156
|
-
{ Action: 'choose', Row: 2, Column: 'Material', Value: String(tmpProductC.IDProduct) },
|
|
157
|
-
{ Action: 'wait', Ms: 400 },
|
|
158
|
-
{ Action: 'deleteRow', Row: 0 },
|
|
159
|
-
{ Action: 'wait', Ms: 200 },
|
|
160
|
-
{ Action: 'snapshot', Label: 'deleted' },
|
|
161
|
-
{ Action: 'choose', Row: 2, Column: 'Material', Value: String(tmpProductA.IDProduct), Label: 'choose after delete' },
|
|
162
|
-
{ Action: 'wait', Ms: 600 },
|
|
163
|
-
{ Action: 'snapshot', Label: 'after' },
|
|
164
|
-
],
|
|
165
|
-
checks: (pResults, pFixtures2, pGraph) =>
|
|
166
|
-
{
|
|
167
|
-
const tmpDeleted = libCommon.snapshot(pResults, 'deleted');
|
|
168
|
-
const tmpAfter = libCommon.snapshot(pResults, 'after');
|
|
169
|
-
return (
|
|
170
|
-
[
|
|
171
|
-
libCommon.check('rows shift up intact after a delete', fRowMatches(tmpDeleted.Rows[0], tmpProductB) && fRowMatches(tmpDeleted.Rows[1], tmpProductC), tmpDeleted.Rows.map((pRow) => pRow.Data), tmpCan('AutofillFromProduct')),
|
|
172
|
-
libCommon.check('a pick after the delete fills the row it was made in', fRowMatches(tmpAfter.Rows[2], tmpProductA), tmpAfter.Rows[2].Data, tmpCan('RowIdentity')),
|
|
173
|
-
libCommon.check('...and leaves the other rows alone', fRowMatches(tmpAfter.Rows[0], tmpProductB) && fRowMatches(tmpAfter.Rows[1], tmpProductC), [ tmpAfter.Rows[0].Data, tmpAfter.Rows[1].Data ], tmpCan('RowIdentity')),
|
|
174
|
-
].concat(fIntegrity(pResults, pGraph)));
|
|
175
|
-
}
|
|
176
|
-
});
|
|
177
|
-
|
|
178
|
-
if (pFixtures.ExpiredProduct)
|
|
179
|
-
{
|
|
180
|
-
const tmpExpired = pFixtures.ExpiredProduct;
|
|
181
|
-
const tmpSavedRows =
|
|
182
|
-
[
|
|
183
|
-
{ Material: String(tmpExpired.IDProduct), Site: tmpExpired.Metadata.Current.Site, PitNumber: tmpExpired.Metadata.PitNumber, BlendPct: '40.0', Gsb: '2.500', DesignYear: 2019 },
|
|
184
|
-
{ Material: String(tmpProductB.IDProduct), Site: tmpProductB.Site, PitNumber: tmpProductB.PitNumber, BlendPct: '60.0' },
|
|
185
|
-
{}, {},
|
|
186
|
-
];
|
|
187
|
-
tmpScenarios.push(
|
|
188
|
-
{
|
|
189
|
-
Name: 'saved-document-with-expired-product',
|
|
190
|
-
AppData: libCommon.appData(tmpSavedRows),
|
|
191
|
-
Script:
|
|
192
|
-
[
|
|
193
|
-
{ Action: 'snapshot', Label: 'opened' },
|
|
194
|
-
{ Action: 'choose', Row: 2, Column: 'Material', Value: String(tmpProductA.IDProduct), Label: 'edit another row' },
|
|
195
|
-
{ Action: 'wait', Ms: 600 },
|
|
196
|
-
{ Action: 'snapshot', Label: 'edited' },
|
|
197
|
-
],
|
|
198
|
-
checks: (pResults, pFixtures2, pGraph) =>
|
|
199
|
-
{
|
|
200
|
-
const tmpOpened = libCommon.snapshot(pResults, 'opened');
|
|
201
|
-
const tmpEdited = libCommon.snapshot(pResults, 'edited');
|
|
202
|
-
const tmpRow = tmpEdited.Rows[0];
|
|
203
|
-
return (
|
|
204
|
-
[
|
|
205
|
-
libCommon.check('the expired product still shows on the saved row', !tmpHasSelect('Material') || (String(tmpOpened.Rows[0].Shown.Material) === String(tmpExpired.IDProduct)), tmpOpened.Rows[0], tmpCan('SavedValues')),
|
|
206
|
-
libCommon.check('the saved row keeps its product, Site and Pit after other edits', (String(tmpRow.Data.Material) === String(tmpExpired.IDProduct)) && (tmpRow.Data.Site === tmpExpired.Metadata.Current.Site), tmpRow.Data, tmpCan('SavedValues')),
|
|
207
|
-
libCommon.check('values carried at save time are kept, not re-derived from today\'s catalog', (String(tmpRow.Data.Gsb) === '2.500') && (String(tmpRow.Data.DesignYear) === '2019'), tmpRow.Data, tmpCan('SnapshotCarry')),
|
|
208
|
-
].concat(fIntegrity(pResults, pGraph)));
|
|
209
|
-
}
|
|
210
|
-
});
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
tmpScenarios.push(
|
|
214
|
-
{
|
|
215
|
-
Name: 'clear-product',
|
|
216
|
-
Script:
|
|
217
|
-
[
|
|
218
|
-
{ Action: 'choose', Row: 0, Column: 'Material', Value: String(tmpProductA.IDProduct) },
|
|
219
|
-
{ Action: 'wait', Ms: 400 },
|
|
220
|
-
{ Action: 'choose', Row: 0, Column: 'Material', Value: '', Label: 'clear product' },
|
|
221
|
-
{ Action: 'wait', Ms: 400 },
|
|
222
|
-
{ Action: 'snapshot', Label: 'cleared' },
|
|
223
|
-
],
|
|
224
|
-
checks: (pResults, pFixtures2, pGraph) =>
|
|
225
|
-
{
|
|
226
|
-
const tmpRow = libCommon.snapshot(pResults, 'cleared').Rows[0].Data;
|
|
227
|
-
return (
|
|
228
|
-
[
|
|
229
|
-
libCommon.check('a cleared product stays cleared', !tmpRow.Material, tmpRow, tmpCan('Clear')),
|
|
230
|
-
libCommon.check('...and its carried values go with it', !tmpRow.Gsb && !tmpRow.DesignYear && !tmpRow.Producer, tmpRow, tmpCan('Clear')),
|
|
231
|
-
].concat(fIntegrity(pResults, pGraph)));
|
|
232
|
-
}
|
|
233
|
-
});
|
|
234
|
-
|
|
235
|
-
tmpScenarios.push(
|
|
236
|
-
{
|
|
237
|
-
Name: 'add-row',
|
|
238
|
-
Script:
|
|
239
|
-
[
|
|
240
|
-
{ Action: 'addRow' },
|
|
241
|
-
{ Action: 'wait', Ms: 200 },
|
|
242
|
-
{ Action: 'snapshot', Label: 'added' },
|
|
243
|
-
{ Action: 'choose', Row: 4, Column: 'Material', Value: String(tmpProductB.IDProduct) },
|
|
244
|
-
{ Action: 'wait', Ms: 600 },
|
|
245
|
-
{ Action: 'snapshot', Label: 'filled' },
|
|
246
|
-
],
|
|
247
|
-
checks: (pResults, pFixtures2, pGraph) =>
|
|
248
|
-
{
|
|
249
|
-
const tmpAdded = libCommon.snapshot(pResults, 'added');
|
|
250
|
-
const tmpFilled = libCommon.snapshot(pResults, 'filled');
|
|
251
|
-
return (
|
|
252
|
-
[
|
|
253
|
-
libCommon.check('a new row offers the state\'s products', (tmpAdded.Rows[4] && (tmpAdded.Rows[4].Options.Material || []).length) >= tmpState.length, tmpAdded.Rows[4] && (tmpAdded.Rows[4].Options.Material || []).length, tmpCan('AddRow')),
|
|
254
|
-
libCommon.check('a new row fills like any other', fRowMatches(tmpFilled.Rows[4], tmpProductB), tmpFilled.Rows[4] && tmpFilled.Rows[4].Data, tmpCan('AddRow')),
|
|
255
|
-
].concat(fIntegrity(pResults, pGraph)));
|
|
256
|
-
}
|
|
257
|
-
});
|
|
258
|
-
|
|
259
|
-
return tmpScenarios;
|
|
260
|
-
}
|
|
261
|
-
|
|
262
|
-
module.exports = { scenarios, SUMMARY_ADDRESS };
|