File tree Expand file tree Collapse file tree 3 files changed +27
-10
lines changed
Expand file tree Collapse file tree 3 files changed +27
-10
lines changed Original file line number Diff line number Diff line change 11import Avatar from "../../src/Avatar.js" ;
2+ import Tag from "../../src/Tag.js" ;
3+ import Icon from "../../src/Icon.js" ;
24import "@ui5/webcomponents-icons/dist/supplier.js" ;
35
46describe ( "Accessibility" , ( ) => {
@@ -30,4 +32,24 @@ describe("Accessibility", () => {
3032 . find ( "svg" )
3133 . should ( "have.attr" , "aria-label" , ACCESSIBLE_NAME ) ;
3234 } ) ;
35+
36+ it ( "doesn't fire ui5-click event, when disabled property is set" , ( ) => {
37+ cy . mount (
38+ < div >
39+ < Avatar interactive disabled initials = "JD" id = "diabled-avatar" onClick = { increment } >
40+ < Tag slot = "badge" >
41+ < Icon slot = "icon" name = "accelerated" > </ Icon >
42+ </ Tag >
43+ </ Avatar >
44+ < input value = "0" id = "click-event" />
45+ </ div >
46+ ) ;
47+
48+ function increment ( ) {
49+ const input = document . getElementById ( "click-event" ) as HTMLInputElement ;
50+ input . value = "1" ;
51+ }
52+ cy . get ( "#diabled-avatar" ) . realClick ( ) ;
53+ cy . get ( "#click-event" ) . should ( "have.value" , "0" ) ;
54+ } ) ;
3355} ) ;
Original file line number Diff line number Diff line change 3232
3333: host ([disabled ]) {
3434 opacity : var (--sapContent_DisabledOpacity );
35+ pointer-events : none;
3536}
3637
3738: host {
302303
303304/* Slotted Badge */
304305::slotted ([slot = "badge" ]) {
305- pointer-events : initial;
306306 position : absolute;
307307 bottom : 0 ;
308308 right : 0 ;
315315 --_ui5-tag-height : 1.125rem ;
316316}
317317
318+ : host (: not ([disabled ])) ::slotted ([slot = "badge" ]) {
319+ pointer-events : initial;
320+ }
321+
318322: host ([_size = "L" ]) ::slotted ([slot = "badge" ]),
319323: host ([size = "L" ]) ::slotted ([slot = "badge" ]) {
320324 width : 1.25rem ;
Original file line number Diff line number Diff line change @@ -75,15 +75,6 @@ describe("Avatar", () => {
7575
7676 } ) ;
7777
78- it ( "tests clicking on interactive disabled avatar" , async ( ) => {
79-
80- const avatarRoot = await browser . $ ( "#interactive-disabled" ) . shadow$ ( ".ui5-avatar-root" ) ;
81- const input3 = await browser . $ ( "#click-event" ) ;
82-
83- await avatarRoot . click ( ) ;
84- assert . strictEqual ( await input3 . getAttribute ( "value" ) , "0" , "Mouse click event not thrown when avatar is interactive + disabled" ) ;
85- } ) ;
86-
8778 it ( "Tests noConflict 'ui5-click' event for interactive avatars" , async ( ) => {
8879 const avatarRoot = await browser . $ ( "#interactive-avatar" ) . shadow$ ( ".ui5-avatar-root" ) ;
8980 const input = await browser . $ ( "#click-event" ) ;
You can’t perform that action at this time.
0 commit comments