@@ -5,7 +5,10 @@ import { sendMouse, setViewport } from '@web/test-runner-commands';
5
5
6
6
import { visualDiff } from '@web/test-runner-visual-regression' ;
7
7
8
- import { dataSetDoc } from './data-set-editor.testfiles.js' ;
8
+ import {
9
+ dataSetDoc ,
10
+ dataSetDocWithDescs ,
11
+ } from './data-set-editor.testfiles.js' ;
9
12
10
13
import { DataSetElementEditor } from './data-set-element-editor.js' ;
11
14
@@ -35,7 +38,7 @@ describe('DataSet element editor component', () => {
35
38
36
39
it ( 'looks like the latest snapshot' , async ( ) => {
37
40
await editor . updateComplete ;
38
- await timeout ( 200 ) ;
41
+ await timeout ( 300 ) ;
39
42
await visualDiff (
40
43
editor ,
41
44
`dataset/data-set-element-editor/#1 Missing DataSet`
@@ -318,6 +321,49 @@ describe('DataSet element editor component', () => {
318
321
} ) ;
319
322
} ) ;
320
323
324
+ describe ( 'Allows to add DataAttributes with descriptions through TreeGrid' , ( ) => {
325
+ let editor : DataSetElementEditor ;
326
+ beforeEach ( async ( ) => {
327
+ await setViewport ( { width : 1900 , height : 1200 } ) ;
328
+
329
+ const dataSet = new DOMParser ( )
330
+ . parseFromString ( dataSetDocWithDescs , 'application/xml' )
331
+ . querySelector ( 'LDevice[inst="ldInst1"] DataSet' ) ! ;
332
+
333
+ editor = await fixture (
334
+ html `< data-set-element-editor
335
+ .element ="${ dataSet } "
336
+ > </ data-set-element-editor > `
337
+ ) ;
338
+ document . body . prepend ( editor ) ;
339
+ } ) ;
340
+
341
+ afterEach ( async ( ) => {
342
+ editor . remove ( ) ;
343
+ } ) ;
344
+
345
+ it ( 'looks like the latest snapshot' , async ( ) => {
346
+ editor . daPicker . paths = [
347
+ [
348
+ 'LDevice: IED>>ldInst1' ,
349
+ 'LN: IED>>ldInst1>prefix MMXU 1' ,
350
+ 'DO: #MMXU>PhV' ,
351
+ 'SDO: #WYE>phsA' ,
352
+ 'DA: #CMV>cVal' ,
353
+ 'BDA: #Vector>mag' ,
354
+ 'BDA: #AnalogueValue>f' ,
355
+ ] ,
356
+ ] ;
357
+ editor . daPickerButton . click ( ) ;
358
+ await editor . updateComplete ;
359
+ await timeout ( 200 ) ;
360
+ await visualDiff (
361
+ editor ,
362
+ `dataset/data-set-element-editor/#10 DataAttribute picker with descriptions`
363
+ ) ;
364
+ } ) ;
365
+ } ) ;
366
+
321
367
describe ( 'Allows to add DataObjects through TreeGrid' , ( ) => {
322
368
let editor : DataSetElementEditor ;
323
369
beforeEach ( async ( ) => {
@@ -359,6 +405,47 @@ describe('DataSet element editor component', () => {
359
405
} ) ;
360
406
} ) ;
361
407
408
+ describe ( 'Allows to add DataObjects with descriptions through TreeGrid' , ( ) => {
409
+ let editor : DataSetElementEditor ;
410
+ beforeEach ( async ( ) => {
411
+ await setViewport ( { width : 1900 , height : 1200 } ) ;
412
+
413
+ const dataSet = new DOMParser ( )
414
+ . parseFromString ( dataSetDocWithDescs , 'application/xml' )
415
+ . querySelector ( 'LDevice[inst="ldInst1"] DataSet' ) ! ;
416
+
417
+ editor = await fixture (
418
+ html `< data-set-element-editor
419
+ .element ="${ dataSet } "
420
+ > </ data-set-element-editor > `
421
+ ) ;
422
+ document . body . prepend ( editor ) ;
423
+ } ) ;
424
+
425
+ afterEach ( async ( ) => {
426
+ editor . remove ( ) ;
427
+ } ) ;
428
+
429
+ it ( 'looks like the latest snapshot' , async ( ) => {
430
+ editor . doPicker . paths = [
431
+ [
432
+ 'LDevice: IED>>ldInst1' ,
433
+ 'LN: IED>>ldInst1>prefix MMXU 1' ,
434
+ 'DO: #MMXU>PhV' ,
435
+ 'SDO: #WYE>phsA' ,
436
+ 'FC: MX' ,
437
+ ] ,
438
+ ] ;
439
+ editor . doPickerButton . click ( ) ;
440
+ await editor . updateComplete ;
441
+ await timeout ( 200 ) ;
442
+ await visualDiff (
443
+ editor ,
444
+ `dataset/data-set-element-editor/#11 DataObject picker with descriptions`
445
+ ) ;
446
+ } ) ;
447
+ } ) ;
448
+
362
449
describe ( 'Allows to re-order FCDA child elements' , ( ) => {
363
450
let editor : DataSetElementEditor ;
364
451
beforeEach ( async ( ) => {
@@ -417,7 +504,7 @@ describe('DataSet element editor component', () => {
417
504
editor . inputs ! [ 0 ] . value = 'someNewDataSetName' ;
418
505
editor . inputs ! [ 1 ] . nullSwitch ?. click ( ) ;
419
506
420
- await editor . requestUpdate ( ) ;
507
+ await editor . updateComplete ;
421
508
await timeout ( 500 ) ;
422
509
await visualDiff (
423
510
editor ,
0 commit comments