1
+ import ProgressIndicator from "../../src/ProgressIndicator.js" ;
2
+ import { setAnimationMode } from "@ui5/webcomponents-base/dist/config/AnimationMode.js" ;
3
+
4
+ describe ( "API" , ( ) => {
5
+ before ( ( ) => {
6
+ cy . wrap ( { setAnimationMode } )
7
+ . then ( api => {
8
+ return api . setAnimationMode ( "none" ) ;
9
+ } ) ;
10
+ } )
11
+
12
+ it ( "tests value validation" , ( ) => {
13
+ cy . mount ( < ProgressIndicator > </ ProgressIndicator > ) ;
14
+
15
+ cy . get ( "[ui5-progress-indicator]" ) . invoke ( "prop" , "value" , 50 ) ;
16
+ cy . get ( "[ui5-progress-indicator]" ) . should ( "have.prop" , "validatedValue" , 50 ) ;
17
+
18
+ cy . get ( "[ui5-progress-indicator]" ) . invoke ( "prop" , "value" , - 10 ) ;
19
+ cy . get ( "[ui5-progress-indicator]" ) . should ( "have.prop" , "validatedValue" , 0 ) ;
20
+
21
+ cy . get ( "[ui5-progress-indicator]" ) . invoke ( "prop" , "value" , 110 ) ;
22
+ cy . get ( "[ui5-progress-indicator]" ) . should ( "have.prop" , "validatedValue" , 100 ) ;
23
+ } ) ;
24
+
25
+ it ( "tests displayValue property" , ( ) => {
26
+ cy . mount ( < ProgressIndicator value = { 50 } > </ ProgressIndicator > ) ;
27
+
28
+ const customDisplayValue = "Custom Display Value" ;
29
+
30
+ cy . get ( "[ui5-progress-indicator]" ) . should ( "have.prop" , "validatedValue" , 50 ) ;
31
+
32
+ cy . get ( "[ui5-progress-indicator]" ) . invoke ( "attr" , "display-value" , customDisplayValue ) ;
33
+
34
+ cy . get ( "[ui5-progress-indicator]" )
35
+ . shadow ( )
36
+ . find ( ".ui5-progress-indicator-value" )
37
+ . should ( "contain.text" , customDisplayValue ) ;
38
+
39
+ cy . get ( "[ui5-progress-indicator]" ) . invoke ( "attr" , "display-value" , "" ) ;
40
+
41
+ cy . get ( "[ui5-progress-indicator]" )
42
+ . shadow ( )
43
+ . find ( ".ui5-progress-indicator-value" )
44
+ . should ( "contain.text" , "50%" ) ;
45
+ } ) ;
46
+
47
+ it ( "tests accessibleName property" , ( ) => {
48
+ const accName = "Hello world" ;
49
+ const accNameNew = "Hello world 2" ;
50
+
51
+ cy . mount ( < ProgressIndicator value = { 100 } accessibleName = { accName } > </ ProgressIndicator > ) ;
52
+
53
+ cy . get ( "[ui5-progress-indicator]" ) . should ( "have.prop" , "accessibleName" , accName ) ;
54
+
55
+ cy . get ( "[ui5-progress-indicator]" )
56
+ . shadow ( )
57
+ . find ( "div" )
58
+ . should ( "have.attr" , "aria-label" , accName ) ;
59
+
60
+ cy . get ( "[ui5-progress-indicator]" ) . invoke ( "prop" , "accessibleName" , accNameNew ) ;
61
+
62
+ cy . get ( "[ui5-progress-indicator]" ) . should ( "have.prop" , "accessibleName" , accNameNew ) ;
63
+
64
+ cy . get ( "[ui5-progress-indicator]" )
65
+ . shadow ( )
66
+ . find ( "div" )
67
+ . should ( "have.attr" , "aria-label" , accNameNew ) ;
68
+ } ) ;
69
+ } ) ;
0 commit comments