@yuneta/gobj-ui 7.27.29 → 7.27.30
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 +20 -2
- package/dist/gobj-ui.cjs.js +78 -12
- package/dist/gobj-ui.es.js +78 -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 +66 -22
- package/src/c_yui_node.js +6 -22
- 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 +102 -2
- package/src/shell_view_shown.wiring.test.js +71 -1
|
@@ -7,7 +7,9 @@
|
|
|
7
7
|
* camera was saved as nulls (a NaN has no json text) and gobj-js
|
|
8
8
|
* 7.26.27 refuses the whole value with an ERROR. Only real numbers
|
|
9
9
|
* are written now; a camera that is not readable keeps the one
|
|
10
|
-
* saved before, and a saved camera of nulls is not restored.
|
|
10
|
+
* saved before, and a saved camera of nulls is not restored. What
|
|
11
|
+
* is saved is getPosition(), and it is brought back with
|
|
12
|
+
* translateTo() through G6's closed forms, at any zoom.
|
|
11
13
|
*
|
|
12
14
|
* The real gclass, on a G6 Graph double whose camera the test sets.
|
|
13
15
|
*
|
|
@@ -31,7 +33,14 @@ if(typeof globalThis.ResizeObserver === "undefined") {
|
|
|
31
33
|
}
|
|
32
34
|
|
|
33
35
|
const camera = vi.hoisted(() => ({zoom: NaN, position: [NaN, NaN], zoomed: [], moved: [],
|
|
34
|
-
size: null, viewport: null, plugins: []}));
|
|
36
|
+
size: null, viewport: null, plugins: [], g6: null}));
|
|
37
|
+
|
|
38
|
+
/* `camera.g6`, when set, is a camera that obeys G6 5.x's own closed
|
|
39
|
+
* forms, with C the canvas centre, Z the zoom and P the camera's
|
|
40
|
+
* position: getPosition() = C/Z - P, an absolute translateTo(T) leaves
|
|
41
|
+
* P = C - T/Z, zoomTo() keeps P, and a point n lands at (n - P)*Z + C.
|
|
42
|
+
* {Z, P, node}: `node` is where every card is. */
|
|
43
|
+
const CENTRE = [400, 300];
|
|
35
44
|
vi.mock("@antv/g6", async (importOriginal) => {
|
|
36
45
|
const real = await importOriginal();
|
|
37
46
|
class FakeGraph {
|
|
@@ -50,17 +59,28 @@ vi.mock("@antv/g6", async (importOriginal) => {
|
|
|
50
59
|
on() {
|
|
51
60
|
}
|
|
52
61
|
getZoom() {
|
|
53
|
-
return camera.zoom;
|
|
62
|
+
return camera.g6? camera.g6.Z: camera.zoom;
|
|
54
63
|
}
|
|
55
64
|
getPosition() {
|
|
65
|
+
const g = camera.g6;
|
|
66
|
+
if(g) {
|
|
67
|
+
return [CENTRE[0] / g.Z - g.P[0], CENTRE[1] / g.Z - g.P[1]];
|
|
68
|
+
}
|
|
56
69
|
return camera.position;
|
|
57
70
|
}
|
|
58
71
|
zoomTo(z) {
|
|
59
72
|
camera.zoomed.push(z);
|
|
73
|
+
if(camera.g6) {
|
|
74
|
+
camera.g6.Z = z;
|
|
75
|
+
}
|
|
60
76
|
return Promise.resolve();
|
|
61
77
|
}
|
|
62
78
|
translateTo(p) {
|
|
63
79
|
camera.moved.push(p);
|
|
80
|
+
const g = camera.g6;
|
|
81
|
+
if(g) {
|
|
82
|
+
g.P = [CENTRE[0] - p[0] / g.Z, CENTRE[1] - p[1] / g.Z];
|
|
83
|
+
}
|
|
64
84
|
return Promise.resolve();
|
|
65
85
|
}
|
|
66
86
|
/* Where a card lands on screen: `camera.viewport` for every one
|
|
@@ -73,15 +93,19 @@ vi.mock("@antv/g6", async (importOriginal) => {
|
|
|
73
93
|
return camera.size;
|
|
74
94
|
}
|
|
75
95
|
getElementPosition() {
|
|
76
|
-
return [0, 0];
|
|
96
|
+
return camera.g6? camera.g6.node: [0, 0];
|
|
77
97
|
}
|
|
78
98
|
getElementData() {
|
|
79
99
|
return {};
|
|
80
100
|
}
|
|
81
101
|
getCanvasCenter() {
|
|
82
|
-
return
|
|
102
|
+
return CENTRE;
|
|
83
103
|
}
|
|
84
|
-
getViewportByCanvas() {
|
|
104
|
+
getViewportByCanvas(n) {
|
|
105
|
+
const g = camera.g6;
|
|
106
|
+
if(g) {
|
|
107
|
+
return [(n[0] - g.P[0]) * g.Z + CENTRE[0], (n[1] - g.P[1]) * g.Z + CENTRE[1]];
|
|
108
|
+
}
|
|
85
109
|
return camera.viewport;
|
|
86
110
|
}
|
|
87
111
|
getData() {
|
|
@@ -156,6 +180,7 @@ beforeEach(() => {
|
|
|
156
180
|
camera.size = null;
|
|
157
181
|
camera.viewport = null;
|
|
158
182
|
camera.plugins = [];
|
|
183
|
+
camera.g6 = null;
|
|
159
184
|
});
|
|
160
185
|
|
|
161
186
|
function errors()
|
|
@@ -249,8 +274,57 @@ describe("C_YUI_GOBJ_TREE_JS does not restore a camera that shows nothing", () =
|
|
|
249
274
|
await mount(name);
|
|
250
275
|
await new Promise((resolve) => setTimeout(resolve, 0));
|
|
251
276
|
expect(camera.zoomed).toEqual([0.5]);
|
|
252
|
-
|
|
277
|
+
/* getPosition() handed back to translateTo() at zoom 0.5:
|
|
278
|
+
* T = (S + C) * Z - C, not S itself */
|
|
279
|
+
expect(camera.moved).toEqual([[(10 + 400) * 0.5 - 400, (20 + 300) * 0.5 - 300]]);
|
|
280
|
+
expect(errors()).toEqual([]);
|
|
281
|
+
});
|
|
282
|
+
});
|
|
283
|
+
|
|
284
|
+
describe("C_YUI_GOBJ_TREE_JS brings the camera back where it was, at any zoom", () => {
|
|
285
|
+
async function round_trip(zoom, P)
|
|
286
|
+
{
|
|
287
|
+
const name = `camera_${++seq}`;
|
|
288
|
+
camera.size = [800, 600];
|
|
289
|
+
camera.g6 = {Z: 1, P: [400, 300], node: [100, 50]};
|
|
290
|
+
const first = await mount(name);
|
|
291
|
+
await new Promise((resolve) => setTimeout(resolve, 0));
|
|
292
|
+
|
|
293
|
+
/* the reader zooms and pans; the move is saved */
|
|
294
|
+
camera.g6.Z = zoom;
|
|
295
|
+
camera.g6.P = P.slice();
|
|
296
|
+
gobj_send_event(first, "EV_REFRESH", {}, first);
|
|
297
|
+
const S = [400 / zoom - P[0], 300 / zoom - P[1]];
|
|
298
|
+
expect(saved(name).zoom).toBe(zoom);
|
|
299
|
+
expect(saved(name).position[0]).toBeCloseTo(S[0], 6);
|
|
300
|
+
expect(saved(name).position[1]).toBeCloseTo(S[1], 6);
|
|
301
|
+
/* (the refresh frames that view again, later: let it) */
|
|
302
|
+
await new Promise((resolve) => setTimeout(resolve, 0));
|
|
303
|
+
|
|
304
|
+
/* a new opening, on a fresh camera */
|
|
305
|
+
camera.g6 = {Z: 1, P: [400, 300], node: [100, 50]};
|
|
306
|
+
camera.zoomed = [];
|
|
307
|
+
await mount(name);
|
|
308
|
+
await new Promise((resolve) => setTimeout(resolve, 0));
|
|
309
|
+
expect(camera.zoomed).toEqual([zoom]);
|
|
310
|
+
expect(camera.g6.Z).toBe(zoom);
|
|
311
|
+
expect(camera.g6.P[0]).toBeCloseTo(P[0], 6);
|
|
312
|
+
expect(camera.g6.P[1]).toBeCloseTo(P[1], 6);
|
|
313
|
+
expect(logged.filter((l) => l.level === "warning").map((l) => l.msg).join(" "))
|
|
314
|
+
.not.toMatch(/the saved view shows none of the/);
|
|
253
315
|
expect(errors()).toEqual([]);
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
test("at zoom 0.3: kept, not judged to show nothing", async () => {
|
|
319
|
+
await round_trip(0.3, [150, 80]);
|
|
320
|
+
});
|
|
321
|
+
|
|
322
|
+
test("at zoom 0.8: not shifted", async () => {
|
|
323
|
+
await round_trip(0.8, [180, 20]);
|
|
324
|
+
});
|
|
325
|
+
|
|
326
|
+
test("at zoom 2", async () => {
|
|
327
|
+
await round_trip(2, [90, 60]);
|
|
254
328
|
});
|
|
255
329
|
});
|
|
256
330
|
|
|
@@ -6,8 +6,10 @@
|
|
|
6
6
|
* wants (the tree, the trace levels of a gclass, a trace set) and
|
|
7
7
|
* the host loads the answers. Asserted here: what reaches the host,
|
|
8
8
|
* what the TRACES block of a card shows for each origin of a level,
|
|
9
|
-
* that a reload keeps the card open,
|
|
10
|
-
*
|
|
9
|
+
* that a reload keeps the card open, that the open gclass viewer is
|
|
10
|
+
* locked only by a set that moves what it shows (and unlocked by
|
|
11
|
+
* the answer it waits for), and that a LOCAL tree publishes none of
|
|
12
|
+
* it (its hosts declare none of these events).
|
|
11
13
|
*
|
|
12
14
|
* The real gclass, on a G6 Graph double.
|
|
13
15
|
*
|
|
@@ -94,6 +96,7 @@ const {
|
|
|
94
96
|
gobj_start, gobj_read_attr, gobj_send_event, set_log_callback, register_c_timer,
|
|
95
97
|
} = await import("@yuneta/gobj-js");
|
|
96
98
|
const {register_c_yui_gobj_tree_js} = await import("./c_yui_gobj_tree_js.js");
|
|
99
|
+
const {register_c_yui_window} = await import("./c_yui_window.js");
|
|
97
100
|
|
|
98
101
|
const logged = [];
|
|
99
102
|
const wanted = [];
|
|
@@ -144,6 +147,7 @@ beforeAll(async () => {
|
|
|
144
147
|
});
|
|
145
148
|
register_c_timer();
|
|
146
149
|
register_c_yui_gobj_tree_js();
|
|
150
|
+
register_c_yui_window();
|
|
147
151
|
gclass_create("C_TEST_TREE_YUNO", [], [["ST_IDLE", []]], {}, 0,
|
|
148
152
|
[SDATA_END()], {}, 0, 0, 0, 0);
|
|
149
153
|
gclass_create("C_TEST_TREE_HOST",
|
|
@@ -379,6 +383,102 @@ describe("C_YUI_GOBJ_TREE_JS, source remote", () => {
|
|
|
379
383
|
});
|
|
380
384
|
});
|
|
381
385
|
|
|
386
|
+
/* The `view-gclass` answer for C_TCP, enough for the viewer. */
|
|
387
|
+
const TCP_DESCRIPTION = {
|
|
388
|
+
id: "C_TCP", gcflag: [], instances: 1, attrs: [], commands: [],
|
|
389
|
+
gclass_methods: [], internal_methods: [],
|
|
390
|
+
FSM: {events: [], states: {}},
|
|
391
|
+
info_gclass_trace: {traffic: "Trace dump traffic", connections: "Trace connections"},
|
|
392
|
+
};
|
|
393
|
+
|
|
394
|
+
/* The tree with the gclass viewer of C_TCP open, and its levels read. */
|
|
395
|
+
async function open_tcp_viewer()
|
|
396
|
+
{
|
|
397
|
+
const view = await mount("remote", host);
|
|
398
|
+
await open_tcp_card(view);
|
|
399
|
+
gobj_send_event(view, "EV_TRACE_INFO", TCP_INFO, host);
|
|
400
|
+
gobj_send_event(view, "EV_OPEN_GCLASS", {}, view);
|
|
401
|
+
gobj_send_event(view, "EV_GCLASS_DESCRIPTION",
|
|
402
|
+
{gclass: "C_TCP", description: TCP_DESCRIPTION}, host);
|
|
403
|
+
const viewer = view.priv.gclass_view && view.priv.gclass_view.json_gobj;
|
|
404
|
+
expect(viewer).toBeTruthy();
|
|
405
|
+
wanted.length = 0;
|
|
406
|
+
return {view, viewer};
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
function viewer_box(viewer, level)
|
|
410
|
+
{
|
|
411
|
+
return gobj_read_attr(viewer, "$container").querySelectorAll(".GCLASS_TRACE_GCLASS")
|
|
412
|
+
.find((b) => b.getAttribute("data-level") === level);
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
describe("C_YUI_GOBJ_TREE_JS, source remote: the open gclass viewer", () => {
|
|
416
|
+
test("a set of the viewer's gclass locks it until ITS answer", async () => {
|
|
417
|
+
const {view, viewer} = await open_tcp_viewer();
|
|
418
|
+
expect(viewer_box(viewer, "traffic").disabled).toBe(false);
|
|
419
|
+
gobj_send_event(view, "EV_SET_GCLASS_TRACE", {gclass: "C_TCP", levels: ["traffic"], set: true}, viewer);
|
|
420
|
+
expect(viewer_box(viewer, "traffic").disabled).toBe(true);
|
|
421
|
+
|
|
422
|
+
gobj_send_event(view, "EV_TRACE_INFO", Object.assign({}, TCP_INFO, {gclass: "C_TIMER"}), host);
|
|
423
|
+
expect(viewer_box(viewer, "traffic").disabled).toBe(true);
|
|
424
|
+
|
|
425
|
+
gobj_send_event(view, "EV_TRACE_INFO", Object.assign({}, TCP_INFO,
|
|
426
|
+
{gclass_on: ["connections", "traffic"]}), host);
|
|
427
|
+
expect([viewer_box(viewer, "traffic").checked, viewer_box(viewer, "traffic").disabled])
|
|
428
|
+
.toEqual([true, false]);
|
|
429
|
+
expect(problems()).toEqual([]);
|
|
430
|
+
});
|
|
431
|
+
|
|
432
|
+
test("a gobj set on the card of ANOTHER gclass leaves the viewer alone", async () => {
|
|
433
|
+
const {view, viewer} = await open_tcp_viewer();
|
|
434
|
+
const root_id = node_id_of(view, "C_YUNO^gate");
|
|
435
|
+
gobj_send_event(view, "EV_NODE_CLICK", {id: root_id, client_x: 10, client_y: 10}, view);
|
|
436
|
+
gobj_send_event(view, "EV_TRACE_INFO", YUNO_INFO, host);
|
|
437
|
+
|
|
438
|
+
const {$gobj} = row_of(view, "ev_kw");
|
|
439
|
+
$gobj.checked = true;
|
|
440
|
+
$gobj.dispatchEvent(fake_event("change"));
|
|
441
|
+
expect(wanted.filter((w) => w.event === "EV_SET_TRACE_LEVEL").map((w) => [w.kw.scope, w.kw.gclass]))
|
|
442
|
+
.toEqual([["gobj", "C_YUNO"]]);
|
|
443
|
+
expect(viewer_box(viewer, "traffic").disabled).toBe(false);
|
|
444
|
+
|
|
445
|
+
gobj_send_event(view, "EV_TRACE_INFO", YUNO_INFO, host);
|
|
446
|
+
expect(viewer_box(viewer, "traffic").disabled).toBe(false);
|
|
447
|
+
expect(problems()).toEqual([]);
|
|
448
|
+
});
|
|
449
|
+
|
|
450
|
+
test("a set of the yuno's scope locks it until the yuno's answer AND its own", async () => {
|
|
451
|
+
const {view, viewer} = await open_tcp_viewer();
|
|
452
|
+
gobj_read_attr(view, "$container").querySelector(".GOBJ_TREE_YUNO_TRACES_BUTTON").click();
|
|
453
|
+
gobj_send_event(view, "EV_TRACE_INFO", YUNO_INFO, host);
|
|
454
|
+
wanted.length = 0;
|
|
455
|
+
|
|
456
|
+
const ev_kw = row_of(view, "ev_kw");
|
|
457
|
+
ev_kw.$global.checked = true;
|
|
458
|
+
ev_kw.$global.dispatchEvent(fake_event("change"));
|
|
459
|
+
expect(viewer_box(viewer, "traffic").disabled).toBe(true);
|
|
460
|
+
|
|
461
|
+
/* the answer of an unrelated gclass, arriving first */
|
|
462
|
+
gobj_send_event(view, "EV_TRACE_INFO", Object.assign({}, TCP_INFO, {gclass: "C_TIMER"}), host);
|
|
463
|
+
expect(viewer_box(viewer, "traffic").disabled).toBe(true);
|
|
464
|
+
wanted.length = 0;
|
|
465
|
+
|
|
466
|
+
/* the yuno's: the viewer's own is asked for, still locked */
|
|
467
|
+
gobj_send_event(view, "EV_TRACE_INFO", Object.assign({}, YUNO_INFO,
|
|
468
|
+
{global_on: ["machine", "ev_kw"]}), host);
|
|
469
|
+
expect(wanted.map((w) => [w.event, w.kw.gclass])).toEqual([["EV_TRACE_INFO_WANTED", "C_TCP"]]);
|
|
470
|
+
expect(viewer_box(viewer, "traffic").disabled).toBe(true);
|
|
471
|
+
|
|
472
|
+
gobj_send_event(view, "EV_TRACE_INFO", Object.assign({}, TCP_INFO,
|
|
473
|
+
{global_levels: YUNO_INFO.global_levels,
|
|
474
|
+
gclass_on: ["connections", "ev_kw"], global_on: ["ev_kw"]}), host);
|
|
475
|
+
expect(viewer_box(viewer, "traffic").disabled).toBe(false);
|
|
476
|
+
expect([viewer_box(viewer, "ev_kw").checked, viewer_box(viewer, "ev_kw").disabled])
|
|
477
|
+
.toEqual([true, true]);
|
|
478
|
+
expect(problems()).toEqual([]);
|
|
479
|
+
});
|
|
480
|
+
});
|
|
481
|
+
|
|
382
482
|
describe("C_YUI_GOBJ_TREE_JS, source local", () => {
|
|
383
483
|
test("publishes nothing: its host declares none of the remote events", async () => {
|
|
384
484
|
const view = await mount("local", yuno);
|
|
@@ -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");
|