File tree Expand file tree Collapse file tree 2 files changed +21
-20
lines changed Expand file tree Collapse file tree 2 files changed +21
-20
lines changed Original file line number Diff line number Diff line change @@ -21,7 +21,6 @@ describe("Button component tests", () => {
2121
2222 const button = getByRole ( "button" ) ;
2323 expect ( button . getAttribute ( "aria-label" ) ) . toBe ( "Go home" ) ;
24- expect ( button . getAttribute ( "title" ) ) . toBe ( "Go home" ) ;
2524 expect ( button . getAttribute ( "tabindex" ) ) . toBe ( "1" ) ;
2625 } ) ;
2726} ) ;
Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ import { getMargin } from "../common/utils";
44import useTheme from "../useTheme" ;
55import ButtonPropsType from "./types" ;
66import DxcIcon from "../icon/Icon" ;
7+ import DxcTooltip from "../tooltip/Tooltip" ;
78
89const DxcButton = ( {
910 label = "" ,
@@ -22,25 +23,26 @@ const DxcButton = ({
2223
2324 return (
2425 < ThemeProvider theme = { colorsTheme . button } >
25- < Button
26- aria-label = { title }
27- disabled = { disabled }
28- onClick = { ( ) => {
29- onClick ( ) ;
30- } }
31- tabIndex = { disabled ? - 1 : tabIndex }
32- title = { title }
33- type = { type }
34- $mode = { mode !== "primary" && mode !== "secondary" && mode !== "text" ? "primary" : mode }
35- hasLabel = { label ? true : false }
36- hasIcon = { icon ? true : false }
37- iconPosition = { iconPosition }
38- size = { size }
39- margin = { margin }
40- >
41- { label && < LabelContainer > { label } </ LabelContainer > }
42- { icon && < IconContainer > { typeof icon === "string" ? < DxcIcon icon = { icon } /> : icon } </ IconContainer > }
43- </ Button >
26+ < DxcTooltip label = { title } >
27+ < Button
28+ aria-label = { title }
29+ disabled = { disabled }
30+ onClick = { ( ) => {
31+ onClick ( ) ;
32+ } }
33+ tabIndex = { disabled ? - 1 : tabIndex }
34+ type = { type }
35+ $mode = { mode !== "primary" && mode !== "secondary" && mode !== "text" ? "primary" : mode }
36+ hasLabel = { label ? true : false }
37+ hasIcon = { icon ? true : false }
38+ iconPosition = { iconPosition }
39+ size = { size }
40+ margin = { margin }
41+ >
42+ { label && < LabelContainer > { label } </ LabelContainer > }
43+ { icon && < IconContainer > { typeof icon === "string" ? < DxcIcon icon = { icon } /> : icon } </ IconContainer > }
44+ </ Button >
45+ </ DxcTooltip >
4446 </ ThemeProvider >
4547 ) ;
4648} ;
You can’t perform that action at this time.
0 commit comments