Skip to content

Commit 4f1a937

Browse files
authored
Subscriber Later Binding (GOOSE): Connect FCDA to ExtRef (openscd#1004)
* fix: extRefLists title not rendering correctly * test: connect FCDA to extRef and verify correct available/subscribed lists length * test: missing snapshot test update
1 parent 38911fd commit 4f1a937

File tree

3 files changed

+46
-104
lines changed

3 files changed

+46
-104
lines changed

src/editors/subscription/later-binding/ext-ref-later-binding-list.ts

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -244,14 +244,11 @@ export class ExtRefLaterBindingList extends LitElement {
244244
: undefined;
245245

246246
return html`<h1>
247-
${translate(
248-
'subscription.laterBinding.extRefList.SampledValueControl.title',
249-
{
250-
controlTag: this.controlTag,
251-
controlElementName: controlElementName ?? '-',
252-
fcdaName: fcdaName ?? '-',
253-
}
254-
)}
247+
${translate('subscription.laterBinding.extRefList.title', {
248+
controlTag: this.controlTag,
249+
controlElementName: controlElementName ?? '-',
250+
fcdaName: fcdaName ?? '-',
251+
})}
255252
</h1>`;
256253
}
257254

test/integration/editors/GooseSubscriberLaterBinding.test.ts

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,39 @@ describe('GOOSE Subscribe Later Binding Plugin', () => {
2929
);
3030
});
3131

32+
it('when subscribing an available ExtRef then the lists are changed', async () => {
33+
const svcListElement = getFCDALaterBindingList(element);
34+
const extRefListElement = getExtrefLaterBindingList(element);
35+
36+
(<HTMLElement>(
37+
svcListElement.shadowRoot!.querySelector(
38+
'mwc-list-item[value="GOOSE_Publisher>>QB2_Disconnector>GOOSE1 GOOSE_Publisher>>QB2_Disconnector>GOOSE1sDataSet>QB1_Disconnector/ CSWI 1.Pos q (ST)"]'
39+
)
40+
)).click();
41+
await element.requestUpdate();
42+
43+
expect(
44+
extRefListElement['getSubscribedExtRefElements']().length
45+
).to.be.equal(0);
46+
expect(
47+
extRefListElement['getAvailableExtRefElements']().length
48+
).to.be.equal(2);
49+
50+
(<HTMLElement>(
51+
extRefListElement.shadowRoot!.querySelector(
52+
'mwc-list-item[value="GOOSE_Subscriber>>Earth_Switch> CILO 1>Pos;CSWI1/Pos/stVal[0]"]'
53+
)
54+
)).click();
55+
await element.requestUpdate();
56+
57+
expect(
58+
extRefListElement['getSubscribedExtRefElements']().length
59+
).to.be.equal(1);
60+
expect(
61+
extRefListElement['getAvailableExtRefElements']().length
62+
).to.be.equal(1);
63+
});
64+
3265
it('when unsubscribing a subscribed ExtRef then the lists are changed', async () => {
3366
const gooseListElement = getFCDALaterBindingList(element);
3467
const extRefListElement = getExtrefLaterBindingList(element);

test/unit/editors/subscription/later-binding/__snapshots__/ext-ref-laterbinding-list.test.snap.js

Lines changed: 8 additions & 96 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ snapshots["smv-list with document loaded looks like the latest snapshot, but no
2222
snapshots["smv-list with document loaded when SVC has no subscriptions looks like the latest snapshot, when SVC has no subscriptions"] =
2323
`<section tabindex="0">
2424
<h1>
25-
[subscription.laterBinding.extRefList.SampledValueControl.title]
25+
[subscription.laterBinding.extRefList.title]
2626
</h1>
2727
<filtered-list>
2828
<mwc-list-item
@@ -224,7 +224,7 @@ snapshots["smv-list with document loaded when SVC has no subscriptions looks lik
224224
snapshots["smv-list with document loaded when SVC has a single subscriptions looks like the latest snapshot, "] =
225225
`<section tabindex="0">
226226
<h1>
227-
[subscription.laterBinding.extRefList.SampledValueControl.title]
227+
[subscription.laterBinding.extRefList.title]
228228
</h1>
229229
<filtered-list>
230230
<mwc-list-item
@@ -437,7 +437,7 @@ snapshots["smv-list with document loaded when SVC has a single subscriptions loo
437437
snapshots["smv-list when SVC has a multiple subscriptions looks like the latest snapshot, "] =
438438
`<section tabindex="0">
439439
<h1>
440-
[subscription.laterBinding.extRefList.SampledValueControl.title]
440+
[subscription.laterBinding.extRefList.title]
441441
</h1>
442442
<filtered-list>
443443
<mwc-list-item
@@ -688,10 +688,10 @@ snapshots["gse-list with gse document loaded looks like the latest snapshot, but
688688
`;
689689
/* end snapshot gse-list with gse document loaded looks like the latest snapshot, but no event fired */
690690

691-
snapshots["gse-list with gse document loaded when GSEControl has no subscriptions looks like the latest snapshot, when SVC has no subscriptions"] =
691+
snapshots["gse-list with gse document loaded when GSEControl has no subscriptions looks like the latest snapshot, when GSEControl has no subscriptions"] =
692692
`<section tabindex="0">
693693
<h1>
694-
[subscription.laterBinding.extRefList.SampledValueControl.title]
694+
[subscription.laterBinding.extRefList.title]
695695
</h1>
696696
<filtered-list>
697697
<mwc-list-item
@@ -774,12 +774,12 @@ snapshots["gse-list with gse document loaded when GSEControl has no subscription
774774
</filtered-list>
775775
</section>
776776
`;
777-
/* end snapshot gse-list with gse document loaded when GSEControl has no subscriptions looks like the latest snapshot, when SVC has no subscriptions */
777+
/* end snapshot gse-list with gse document loaded when GSEControl has no subscriptions looks like the latest snapshot, when GSEControl has no subscriptions */
778778

779779
snapshots["gse-list with gse document loaded when GSEControl has a single subscription looks like the latest snapshot, "] =
780780
`<section tabindex="0">
781781
<h1>
782-
[subscription.laterBinding.extRefList.SampledValueControl.title]
782+
[subscription.laterBinding.extRefList.title]
783783
</h1>
784784
<filtered-list>
785785
<mwc-list-item
@@ -878,7 +878,7 @@ snapshots["gse-list with gse document loaded when GSEControl has a single subscr
878878
snapshots["gse-list when GSEControl has a multiple subscriptions looks like the latest snapshot, "] =
879879
`<section tabindex="0">
880880
<h1>
881-
[subscription.laterBinding.extRefList.SampledValueControl.title]
881+
[subscription.laterBinding.extRefList.title]
882882
</h1>
883883
<filtered-list>
884884
<mwc-list-item
@@ -990,91 +990,3 @@ snapshots["gse-list when GSEControl has a multiple subscriptions looks like the
990990
`;
991991
/* end snapshot gse-list when GSEControl has a multiple subscriptions looks like the latest snapshot, */
992992

993-
snapshots["gse-list with gse document loaded when GSEControl has no subscriptions looks like the latest snapshot, when GSEControl has no subscriptions"] =
994-
`<section tabindex="0">
995-
<h1>
996-
[subscription.laterBinding.extRefList.SampledValueControl.title]
997-
</h1>
998-
<filtered-list>
999-
<mwc-list-item
1000-
aria-disabled="false"
1001-
noninteractive=""
1002-
tabindex="-1"
1003-
value=""
1004-
>
1005-
<span>
1006-
[subscription.subscriber.subscribed]
1007-
</span>
1008-
</mwc-list-item>
1009-
<li
1010-
divider=""
1011-
role="separator"
1012-
>
1013-
</li>
1014-
<mwc-list-item
1015-
aria-disabled="false"
1016-
graphic="large"
1017-
noninteractive=""
1018-
tabindex="-1"
1019-
>
1020-
[subscription.laterBinding.extRefList.noSubscribedExtRefs]
1021-
</mwc-list-item>
1022-
<mwc-list-item
1023-
aria-disabled="false"
1024-
noninteractive=""
1025-
tabindex="-1"
1026-
value="Interlocking.Input GOOSE_Subscriber>>Earth_Switch> CILO 1>Pos;CSWI1/Pos/stVal[0] Restricted To Pos GOOSE_Subscriber>>Earth_Switch> CSWI 1>someRestrictedExtRef[0]"
1027-
>
1028-
<span>
1029-
[subscription.subscriber.availableToSubscribe]
1030-
</span>
1031-
</mwc-list-item>
1032-
<li
1033-
divider=""
1034-
role="separator"
1035-
>
1036-
</li>
1037-
<mwc-list-item
1038-
aria-disabled="false"
1039-
graphic="large"
1040-
mwc-list-item=""
1041-
tabindex="-1"
1042-
twoline=""
1043-
value="GOOSE_Subscriber>>Earth_Switch> CILO 1>Pos;CSWI1/Pos/stVal[0]"
1044-
>
1045-
<span>
1046-
Pos;CSWI1/Pos/stVal
1047-
(Interlocking.Input)
1048-
</span>
1049-
<span slot="secondary">
1050-
GOOSE_Subscriber>>Earth_Switch> CILO 1>Pos;CSWI1/Pos/stVal[0]
1051-
</span>
1052-
<mwc-icon slot="graphic">
1053-
arrow_back
1054-
</mwc-icon>
1055-
</mwc-list-item>
1056-
<mwc-list-item
1057-
aria-disabled="true"
1058-
disabled=""
1059-
graphic="large"
1060-
mwc-list-item=""
1061-
tabindex="-1"
1062-
twoline=""
1063-
value="GOOSE_Subscriber>>Earth_Switch> CSWI 1>someRestrictedExtRef[0]"
1064-
>
1065-
<span>
1066-
someRestrictedExtRef
1067-
(Restricted To Pos)
1068-
</span>
1069-
<span slot="secondary">
1070-
GOOSE_Subscriber>>Earth_Switch> CSWI 1>someRestrictedExtRef[0]
1071-
</span>
1072-
<mwc-icon slot="graphic">
1073-
arrow_back
1074-
</mwc-icon>
1075-
</mwc-list-item>
1076-
</filtered-list>
1077-
</section>
1078-
`;
1079-
/* end snapshot gse-list with gse document loaded when GSEControl has no subscriptions looks like the latest snapshot, when GSEControl has no subscriptions */
1080-

0 commit comments

Comments
 (0)