@yuneta/gobj-ui 7.27.29 → 7.27.31
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 +31 -4
- package/dist/gobj-ui.cjs.js +92 -12
- package/dist/gobj-ui.es.js +92 -13
- package/index.js +1 -1
- package/package.json +2 -2
- package/src/c_yui_gclass.js +32 -0
- package/src/c_yui_gobj_tree_js.js +94 -22
- package/src/c_yui_node.js +21 -24
- package/src/c_yui_update_watch.js +48 -1
- package/src/c_yui_update_watch.wiring.test.js +80 -5
- package/src/gclass_language.wiring.test.js +141 -0
- package/src/gobj_tree_camera.wiring.test.js +81 -7
- package/src/gobj_tree_remote.wiring.test.js +173 -2
- package/src/node_stages.wiring.test.js +199 -0
- package/src/shell_view_shown.wiring.test.js +71 -1
|
@@ -3,7 +3,9 @@
|
|
|
3
3
|
*
|
|
4
4
|
* EV_VIEW_SHOWN: a view the shell shows AGAIN after hiding it
|
|
5
5
|
* (`keep_alive`) is told so, if it declares the event, and
|
|
6
|
-
* C_YUI_SERVICE_VIEW hands it on to the view it hosts.
|
|
6
|
+
* C_YUI_SERVICE_VIEW hands it on to the view it hosts. A
|
|
7
|
+
* C_YUI_NODE tree tells the content on screen once, from its own
|
|
8
|
+
* route change, and the shell does not tell it again.
|
|
7
9
|
*
|
|
8
10
|
* Driven through the real C_YUI_SHELL on a document double.
|
|
9
11
|
*
|
|
@@ -23,6 +25,7 @@ const {
|
|
|
23
25
|
} = await import("@yuneta/gobj-js");
|
|
24
26
|
const {register_c_yui_shell, yui_shell_navigate} = await import("./c_yui_shell.js");
|
|
25
27
|
const {register_c_yui_service_view} = await import("./c_yui_service_view.js");
|
|
28
|
+
const {register_c_yui_node} = await import("./c_yui_node.js");
|
|
26
29
|
const {register_c_yui_nav} = await import("./c_yui_nav.js");
|
|
27
30
|
|
|
28
31
|
const logged = [];
|
|
@@ -68,6 +71,7 @@ beforeAll(async () => {
|
|
|
68
71
|
register_c_yui_shell();
|
|
69
72
|
register_c_yui_nav();
|
|
70
73
|
register_c_yui_service_view();
|
|
74
|
+
register_c_yui_node();
|
|
71
75
|
yuno = gobj_create_yuno("view_shown_yuno", "C_TEST_SHOWN_HOST", {});
|
|
72
76
|
gobj_start(yuno);
|
|
73
77
|
gobj_create_service("test_transport", "C_TEST_SHOWN_HOST", {}, yuno);
|
|
@@ -112,6 +116,31 @@ function config()
|
|
|
112
116
|
target: target("C_TEST_PLAIN_VIEW", "keep_alive", "plain_view")},
|
|
113
117
|
{id: "gone", name: "gone", route: "/gone",
|
|
114
118
|
target: target("C_TEST_SHOWN_VIEW", "lazy_destroy", "gone_view")},
|
|
119
|
+
{id: "tree", name: "tree", route: "/tree",
|
|
120
|
+
target: {
|
|
121
|
+
stage: "main", gclass: "C_YUI_NODE", lifecycle: "keep_alive",
|
|
122
|
+
name: "the_tree",
|
|
123
|
+
kw: {
|
|
124
|
+
node_id: "tree", base_route: "/tree",
|
|
125
|
+
content: {gclass: "C_TEST_SHOWN_VIEW", kw: {}},
|
|
126
|
+
children: [
|
|
127
|
+
{id: "acc", label: "acc",
|
|
128
|
+
content: {gclass: "C_TEST_SHOWN_VIEW", kw: {}}},
|
|
129
|
+
{id: "deep", label: "deep", children: [
|
|
130
|
+
{id: "leaf", label: "leaf",
|
|
131
|
+
content: {gclass: "C_TEST_SHOWN_VIEW", kw: {}}}
|
|
132
|
+
]},
|
|
133
|
+
{id: "svc", label: "svc", content: {
|
|
134
|
+
gclass: "C_YUI_SERVICE_VIEW",
|
|
135
|
+
kw: {
|
|
136
|
+
view_gclass: "C_TEST_SHOWN_VIEW",
|
|
137
|
+
service_name: "#tree_svc_view",
|
|
138
|
+
transport_service: "test_transport"
|
|
139
|
+
}
|
|
140
|
+
}}
|
|
141
|
+
]
|
|
142
|
+
}
|
|
143
|
+
}},
|
|
115
144
|
{id: "hosted", name: "hosted", route: "/hosted",
|
|
116
145
|
target: {
|
|
117
146
|
stage: "main", gclass: "C_YUI_SERVICE_VIEW", lifecycle: "keep_alive",
|
|
@@ -181,6 +210,47 @@ describe("EV_VIEW_SHOWN", () => {
|
|
|
181
210
|
expect(shown.filter((s) => s.name === "gone_view")).toEqual([]);
|
|
182
211
|
});
|
|
183
212
|
|
|
213
|
+
/* The tree is told by its own route change (each node on the path
|
|
214
|
+
* comes back from ST_OFF to a content it already built), so the
|
|
215
|
+
* shell must not tell it a second time: C_YUI_NODE does not declare
|
|
216
|
+
* EV_VIEW_SHOWN. A view that asks for its data when shown and is
|
|
217
|
+
* busy until the answer took the second one as "action in progress". */
|
|
218
|
+
test("a keep_alive C_YUI_NODE tree tells the content on screen ONCE", () => {
|
|
219
|
+
const shell = new_shell();
|
|
220
|
+
yui_shell_navigate(shell, "/tree/acc");
|
|
221
|
+
expect(shown).toEqual([]);
|
|
222
|
+
|
|
223
|
+
yui_shell_navigate(shell, "/plain");
|
|
224
|
+
yui_shell_navigate(shell, "/tree/acc");
|
|
225
|
+
expect(shown.map((s) => s.kw.route)).toEqual(["/tree/acc"]);
|
|
226
|
+
expect(errors()).toEqual([]);
|
|
227
|
+
});
|
|
228
|
+
|
|
229
|
+
test("the root's own content, and a content deeper down, are told once", () => {
|
|
230
|
+
const shell = new_shell();
|
|
231
|
+
yui_shell_navigate(shell, "/tree");
|
|
232
|
+
yui_shell_navigate(shell, "/plain");
|
|
233
|
+
yui_shell_navigate(shell, "/tree");
|
|
234
|
+
expect(shown.map((s) => s.kw.route)).toEqual(["/tree"]);
|
|
235
|
+
|
|
236
|
+
shown.length = 0;
|
|
237
|
+
yui_shell_navigate(shell, "/tree/deep/leaf");
|
|
238
|
+
expect(shown).toEqual([]);
|
|
239
|
+
yui_shell_navigate(shell, "/plain");
|
|
240
|
+
yui_shell_navigate(shell, "/tree/deep/leaf");
|
|
241
|
+
expect(shown.map((s) => s.kw.route)).toEqual(["/tree/deep/leaf"]);
|
|
242
|
+
expect(errors()).toEqual([]);
|
|
243
|
+
});
|
|
244
|
+
|
|
245
|
+
test("a C_YUI_SERVICE_VIEW content of a node hands it on, once", () => {
|
|
246
|
+
const shell = new_shell();
|
|
247
|
+
yui_shell_navigate(shell, "/tree/svc");
|
|
248
|
+
yui_shell_navigate(shell, "/plain");
|
|
249
|
+
yui_shell_navigate(shell, "/tree/svc");
|
|
250
|
+
expect(shown.map((s) => s.name)).toEqual(["#tree_svc_view"]);
|
|
251
|
+
expect(errors()).toEqual([]);
|
|
252
|
+
});
|
|
253
|
+
|
|
184
254
|
test("C_YUI_SERVICE_VIEW hands it on to the view it hosts", () => {
|
|
185
255
|
const shell = new_shell();
|
|
186
256
|
yui_shell_navigate(shell, "/hosted");
|