@@ -12,7 +12,7 @@ import {
12
12
import {
13
13
editIEDWizard ,
14
14
removeIEDAndReferences ,
15
- removeIEDWizard
15
+ removeIEDWizard ,
16
16
} from '../../../src/wizards/ied.js' ;
17
17
18
18
import {
@@ -21,10 +21,9 @@ import {
21
21
expectUpdateAction ,
22
22
expectWizardNoUpdateAction ,
23
23
fetchDoc ,
24
- newWizard ,
25
24
setWizardTextFieldValue ,
26
25
} from './test-support.js' ;
27
- import { updateNamingAttributeWithReferencesAction } from " ../../../src/wizards/foundation/actions.js" ;
26
+ import { updateNamingAttributeWithReferencesAction } from ' ../../../src/wizards/foundation/actions.js' ;
28
27
29
28
describe ( 'Wizards for SCL element IED' , ( ) => {
30
29
let doc : XMLDocument ;
@@ -47,41 +46,67 @@ describe('Wizards for SCL element IED', () => {
47
46
inputs = Array . from ( element . wizardUI . inputs ) ;
48
47
} ) ;
49
48
it ( 'contains a wizard-textfield with a non-empty "type" value' , async ( ) => {
50
- expect ( ( < WizardTextField [ ] > inputs ) . find ( textField => textField . label == 'type' ) ?. value ) . to
51
- . be . equal ( ied . getAttribute ( 'type' ) || '-' ) ;
49
+ expect (
50
+ ( < WizardTextField [ ] > inputs ) . find ( textField => textField . label == 'type' )
51
+ ?. value
52
+ ) . to . be . equal ( ied . getAttribute ( 'type' ) || '-' ) ;
52
53
} ) ;
53
54
it ( 'contains a wizard-textfield with a non-empty "manufacturer" value' , async ( ) => {
54
- expect ( ( < WizardTextField [ ] > inputs ) . find ( textField => textField . label == 'manufacturer' ) ?. value ) . to
55
- . be . equal ( ied . getAttribute ( 'manufacturer' ) || '-' ) ;
55
+ expect (
56
+ ( < WizardTextField [ ] > inputs ) . find (
57
+ textField => textField . label == 'manufacturer'
58
+ ) ?. value
59
+ ) . to . be . equal ( ied . getAttribute ( 'manufacturer' ) || '-' ) ;
56
60
} ) ;
57
61
it ( 'contains a wizard-textfield with a non-empty "configVersion" value' , async ( ) => {
58
- expect ( ( < WizardTextField [ ] > inputs ) . find ( textField => textField . label == 'configVersion' ) ?. value ) . to
59
- . be . equal ( ied . getAttribute ( 'configVersion' ) || '-' ) ;
62
+ expect (
63
+ ( < WizardTextField [ ] > inputs ) . find (
64
+ textField => textField . label == 'configVersion'
65
+ ) ?. value
66
+ ) . to . be . equal ( ied . getAttribute ( 'configVersion' ) || '-' ) ;
60
67
} ) ;
61
68
it ( 'contains a wizard-textfield with a non-empty "originalSclVersion" value' , async ( ) => {
62
- expect ( ( < WizardTextField [ ] > inputs ) . find ( textField => textField . label == 'originalSclVersion' ) ?. value ) . to
63
- . contain ( ied . getAttribute ( 'originalSclVersion' ) || '-' ) ;
69
+ expect (
70
+ ( < WizardTextField [ ] > inputs ) . find (
71
+ textField => textField . label == 'originalSclVersion'
72
+ ) ?. value
73
+ ) . to . contain ( ied . getAttribute ( 'originalSclVersion' ) || '-' ) ;
64
74
} ) ;
65
75
it ( 'contains a wizard-textfield with an empty "engRight" value' , async ( ) => {
66
- expect ( ( < WizardTextField [ ] > inputs ) . find ( textField => textField . label == 'engRight' ) ?. value ) . to
67
- . be . equal ( ied . getAttribute ( 'engRight' ) || '-' ) ;
76
+ expect (
77
+ ( < WizardTextField [ ] > inputs ) . find (
78
+ textField => textField . label == 'engRight'
79
+ ) ?. value
80
+ ) . to . be . equal ( ied . getAttribute ( 'engRight' ) || '-' ) ;
68
81
} ) ;
69
82
it ( 'contains a wizard-textfield with a non-empty "owner" value' , async ( ) => {
70
- expect ( ( < WizardTextField [ ] > inputs ) . find ( textField => textField . label == 'owner' ) ?. value ) . to
71
- . be . equal ( ied . getAttribute ( 'owner' ) || '-' ) ;
83
+ expect (
84
+ ( < WizardTextField [ ] > inputs ) . find (
85
+ textField => textField . label == 'owner'
86
+ ) ?. value
87
+ ) . to . be . equal ( ied . getAttribute ( 'owner' ) || '-' ) ;
72
88
} ) ;
73
89
it ( 'update name should be updated in document' , async function ( ) {
74
90
await setWizardTextFieldValue ( < WizardTextField > inputs [ 0 ] , 'OtherIED3' ) ;
75
91
76
- const complexAction = updateNamingAttributeWithReferencesAction ( ied , 'ied.action.updateied' ) ( inputs , newWizard ( ) ) ;
92
+ const complexAction = updateNamingAttributeWithReferencesAction (
93
+ ied ,
94
+ 'ied.action.updateied'
95
+ ) ( inputs , element . wizardUI ) ;
77
96
expect ( complexAction . length ) . to . equal ( 1 ) ;
78
97
expect ( complexAction [ 0 ] ) . to . not . satisfy ( isSimple ) ;
79
98
80
99
const simpleActions = ( < ComplexAction > complexAction [ 0 ] ) . actions ;
81
100
expect ( simpleActions . length ) . to . equal ( 2 ) ;
82
101
83
102
expectUpdateAction ( simpleActions [ 0 ] , 'IED' , 'name' , 'IED3' , 'OtherIED3' ) ;
84
- expectReplaceAction ( simpleActions [ 1 ] , 'ConnectedAP' , 'iedName' , 'IED3' , 'OtherIED3' ) ;
103
+ expectReplaceAction (
104
+ simpleActions [ 1 ] ,
105
+ 'ConnectedAP' ,
106
+ 'iedName' ,
107
+ 'IED3' ,
108
+ 'OtherIED3'
109
+ ) ;
85
110
} ) ;
86
111
87
112
it ( 'update name should be unique in document' , async function ( ) {
@@ -95,18 +120,31 @@ describe('Wizards for SCL element IED', () => {
95
120
'Some description'
96
121
) ;
97
122
98
- const complexAction = updateNamingAttributeWithReferencesAction ( ied , 'ied.action.updateied' ) ( inputs , newWizard ( ) ) ;
123
+ const complexAction = updateNamingAttributeWithReferencesAction (
124
+ ied ,
125
+ 'ied.action.updateied'
126
+ ) ( inputs , element . wizardUI ) ;
99
127
expect ( complexAction . length ) . to . equal ( 1 ) ;
100
128
expect ( complexAction [ 0 ] ) . to . not . satisfy ( isSimple ) ;
101
129
102
130
const simpleActions = ( < ComplexAction > complexAction [ 0 ] ) . actions ;
103
131
expect ( simpleActions . length ) . to . equal ( 1 ) ;
104
132
105
- expectUpdateAction ( simpleActions [ 0 ] , 'IED' , 'desc' , null , 'Some description' ) ;
133
+ expectUpdateAction (
134
+ simpleActions [ 0 ] ,
135
+ 'IED' ,
136
+ 'desc' ,
137
+ null ,
138
+ 'Some description'
139
+ ) ;
106
140
} ) ;
107
141
108
142
it ( 'when no fields changed there will be no update action' , async function ( ) {
109
- expectWizardNoUpdateAction ( updateNamingAttributeWithReferencesAction ( ied , 'ied.action.updateied' ) , inputs ) ;
143
+ expectWizardNoUpdateAction (
144
+ updateNamingAttributeWithReferencesAction ( ied , 'ied.action.updateied' ) ,
145
+ element . wizardUI ,
146
+ inputs
147
+ ) ;
110
148
} ) ;
111
149
112
150
it ( 'looks like the latest snapshot' , async ( ) => {
@@ -126,7 +164,10 @@ describe('Wizards for SCL element IED', () => {
126
164
} ) ;
127
165
128
166
it ( 'remove IED should return expected actions' , async function ( ) {
129
- const complexAction = removeIEDAndReferences ( ied ) ( inputs , newWizard ( ) ) ;
167
+ const complexAction = removeIEDAndReferences ( ied ) (
168
+ inputs ,
169
+ element . wizardUI
170
+ ) ;
130
171
131
172
expect ( complexAction . length ) . to . equal ( 1 ) ;
132
173
expect ( complexAction [ 0 ] ) . to . not . satisfy ( isSimple ) ;
0 commit comments