@@ -5,35 +5,48 @@ describe("Icon general interaction", () => {
5
5
6
6
it ( "Tests icon rendering" , ( ) => {
7
7
const iconRoot = browser . $ ( "#interactive-icon" ) . shadow$ ( "ui5-icon-root" ) ;
8
+ const iconWithTooltip = browser . $ ( "#iconWithTooltip" ) ;
9
+ const iconTooltip = iconWithTooltip . shadow$ ( `#${ iconWithTooltip . getProperty ( "_id" ) } -tooltip` ) ;
10
+ const ICON_TOOLTIP_TEXT = "Save" ;
8
11
9
12
assert . ok ( iconRoot , "Icon is rendered" ) ;
10
- } ) ;
13
+ assert . strictEqual ( iconTooltip . getHTML ( false ) . includes ( ICON_TOOLTIP_TEXT ) , true ,
14
+ "Built-in tooltip is correct" ) ;
15
+ } ) ;
16
+
17
+ it ( "Tests noConflict 'ui5-click' event is thrown for interactive icons" , ( ) => {
18
+ const iconRoot = browser . $ ( "#interactive-icon" ) . shadow$ ( ".ui5-icon-root" ) ;
19
+ const input = browser . $ ( "#click-event" ) ;
20
+
21
+ iconRoot . click ( ) ;
22
+ assert . strictEqual ( input . getAttribute ( "value" ) , "1" , "Mouse click throws event" ) ;
11
23
12
- it ( "Tests if clicked event is thrown for interactive icons" , ( ) => {
13
- const iconRoot = browser . $ ( "#interactive-icon" ) . shadow$ ( ".ui5-icon-root" ) ;
14
- const input = browser . $ ( "#click-event" ) ;
24
+ iconRoot . keys ( "Enter" ) ;
25
+ assert . strictEqual ( input . getAttribute ( "value" ) , "2" , "Enter throws event" ) ;
15
26
16
- iconRoot . click ( ) ;
17
- assert . strictEqual ( input . getAttribute ( "value" ) , "1" , "Mouse click throws event" ) ;
27
+ iconRoot . keys ( "Space" ) ;
28
+ assert . strictEqual ( input . getAttribute ( "value" ) , "3" , "Space throws event" ) ;
29
+ } ) ;
30
+
31
+ it ( "Tests noConflict 'ui5-click' event is not thrown for non interactive icons" , ( ) => {
32
+ const iconRoot = browser . $ ( "#non-interactive-icon" ) ;
33
+ const input = browser . $ ( "#click-event" ) ;
18
34
19
- iconRoot . keys ( "Enter" ) ;
20
- assert . strictEqual ( input . getAttribute ( "value" ) , "2 " , "Enter throws event" ) ;
35
+ iconRoot . click ( ) ;
36
+ assert . strictEqual ( input . getAttribute ( "value" ) , "3 " , "Mouse click throws event" ) ;
21
37
22
- iconRoot . keys ( "Space" ) ;
23
- assert . strictEqual ( input . getAttribute ( "value" ) , "3" , "Space throws event" ) ;
24
- } ) ;
25
-
26
- it ( "Tests if clicked event is not thrown for non interactive icons" , ( ) => {
27
- const iconRoot = browser . $ ( "#non-interactive-icon" ) ;
28
- const input = browser . $ ( "#click-event" ) ;
38
+ iconRoot . keys ( "Enter" ) ;
39
+ assert . strictEqual ( input . getAttribute ( "value" ) , "3" , "Enter throws event" ) ;
29
40
30
- iconRoot . click ( ) ;
31
- assert . strictEqual ( input . getAttribute ( "value" ) , "3" , "Mouse click throws event" ) ;
41
+ iconRoot . keys ( "Space" ) ;
42
+ assert . strictEqual ( input . getAttribute ( "value" ) , "3" , "Space throws event" ) ;
43
+ } ) ;
32
44
33
- iconRoot . keys ( "Enter" ) ;
34
- assert . strictEqual ( input . getAttribute ( "value" ) , "3" , "Enter throws event" ) ;
45
+ it ( "Tests native 'click' event thrown" , ( ) => {
46
+ const icon = browser . $ ( "#myInteractiveIcon" ) ;
47
+ const input = browser . $ ( "#click-event-2" ) ;
35
48
36
- iconRoot . keys ( "Space" ) ;
37
- assert . strictEqual ( input . getAttribute ( "value" ) , "3 " , "Space throws event" ) ;
49
+ icon . click ( ) ;
50
+ assert . strictEqual ( input . getAttribute ( "value" ) , "1 " , "Mouse click throws event" ) ;
38
51
} ) ;
39
- } ) ;
52
+ } ) ;
0 commit comments