@yuneta/gobj-ui 7.25.16 → 7.25.18
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/README.md +76 -0
- package/dist/gobj-ui.cjs.js +104 -34
- package/dist/gobj-ui.es.js +104 -34
- package/package.json +2 -2
- package/src/c_yui_schema_editor.js +41 -18
- package/src/c_yui_treedb_graph.js +71 -12
- package/src/c_yui_treedb_topics.js +23 -2
- package/src/schema_editor_reload.wiring.test.js +161 -0
- package/src/treedb_graph_writes.wiring.test.js +79 -4
- package/src/treedb_topics_transport.wiring.test.js +22 -7
|
@@ -29,6 +29,7 @@ const {register_c_yui_shell, yui_shell_set_connection_state} = await import("./c
|
|
|
29
29
|
const {register_c_yui_treedb_topics} = await import("./c_yui_treedb_topics.js");
|
|
30
30
|
|
|
31
31
|
const logged = [];
|
|
32
|
+
const written = []; /* the EV_RECORD_WRITTEN the host heard */
|
|
32
33
|
const answers = []; /* what the fake forms were told */
|
|
33
34
|
const loaded = []; /* the rows each fake form was loaded with */
|
|
34
35
|
const commands = []; /* what the fake transport was asked */
|
|
@@ -103,7 +104,10 @@ beforeAll(() => {
|
|
|
103
104
|
"C_TEST_VIEW_HOST",
|
|
104
105
|
[["EV_RECORD_WRITTEN", 0], ["EV_TOPIC_SELECTED", 0]],
|
|
105
106
|
[["ST_IDLE", [
|
|
106
|
-
["EV_RECORD_WRITTEN", () =>
|
|
107
|
+
["EV_RECORD_WRITTEN", (gobj, event, kw) => {
|
|
108
|
+
written.push(kw);
|
|
109
|
+
return 0;
|
|
110
|
+
}, null],
|
|
107
111
|
["EV_TOPIC_SELECTED", () => 0, null]
|
|
108
112
|
]]],
|
|
109
113
|
{}, 0, [SDATA_END()], {}, 0, 0, 0, 0
|
|
@@ -121,6 +125,7 @@ beforeAll(() => {
|
|
|
121
125
|
|
|
122
126
|
beforeEach(() => {
|
|
123
127
|
logged.length = 0;
|
|
128
|
+
written.length = 0;
|
|
124
129
|
answers.length = 0;
|
|
125
130
|
commands.length = 0;
|
|
126
131
|
loaded.length = 0;
|
|
@@ -228,16 +233,26 @@ describe("a Save in flight when the backend drops", () => {
|
|
|
228
233
|
save(topics, forms.roles, 1);
|
|
229
234
|
|
|
230
235
|
/* The answer of the users write, the way C_IEVENT_CLI delivers it:
|
|
231
|
-
* the request's frame on top of the
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
+
* the request's `__md_command__` as the frame on top of the
|
|
237
|
+
* command_stack, and nothing else of the request. */
|
|
238
|
+
const users_write = commands.find((c) => c.command === "update-node" &&
|
|
239
|
+
c.kw.topic_name === "users");
|
|
240
|
+
const ok = {result: 0, comment: "", data: [{id: "x", name: "stored"}], __md_iev__: {
|
|
241
|
+
command_stack: [{command: "update-node", kw: users_write.kw.__md_command__}]
|
|
236
242
|
}};
|
|
237
243
|
gobj_send_event(topics, "EV_MT_COMMAND_ANSWER", ok, remote);
|
|
238
244
|
expect(answers).toEqual([
|
|
239
245
|
{topic: "users", event: "EV_WRITE_DONE", form_write: 1},
|
|
240
246
|
]);
|
|
247
|
+
/* What the host is told names the treedb and carries the record
|
|
248
|
+
* the store answered: read off that frame, both arrived empty. */
|
|
249
|
+
expect(written).toEqual([{
|
|
250
|
+
treedb_name: "treedb_test",
|
|
251
|
+
topic_name: "users",
|
|
252
|
+
record: {id: "x", name: "stored"},
|
|
253
|
+
created: false,
|
|
254
|
+
command: "update-node"
|
|
255
|
+
}]);
|
|
241
256
|
|
|
242
257
|
yui_shell_set_connection_state(shell, false);
|
|
243
258
|
expect(answers).toEqual([
|
|
@@ -253,7 +268,7 @@ describe("a Save in flight when the backend drops", () => {
|
|
|
253
268
|
*/
|
|
254
269
|
function failed_write(topic_name, form_write)
|
|
255
270
|
{
|
|
256
|
-
const md = {topic_name: topic_name
|
|
271
|
+
const md = {topic_name: topic_name}; /* the request's __md_command__, and only it */
|
|
257
272
|
if(form_write) {
|
|
258
273
|
md.form_write = form_write;
|
|
259
274
|
}
|