This repository was archived by the owner on Jul 29, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +21
-10
lines changed Expand file tree Collapse file tree 2 files changed +21
-10
lines changed Original file line number Diff line number Diff line change @@ -28,16 +28,17 @@ const BUTTON_CLASS_NAME = 'mdc-button__icon';
28
28
29
29
type ButtonTypes = HTMLAnchorElement | HTMLButtonElement ;
30
30
31
- export interface ButtonProps < T extends ButtonTypes > extends Ripple . InjectedProps < T > , React . HTMLAttributes < T > {
32
- raised ?: boolean ;
33
- unelevated ?: boolean ;
34
- outlined ?: boolean ;
35
- dense ?: boolean ;
36
- disabled ?: boolean ;
37
- className ?: string ;
38
- icon ?: React . ReactElement < React . HTMLProps < HTMLOrSVGElement > > ;
39
- href ?: string ;
40
- trailingIcon ?: React . ReactElement < React . HTMLProps < HTMLOrSVGElement > > ;
31
+ export interface ButtonProps < T extends ButtonTypes >
32
+ extends Ripple . InjectedProps < T > , React . AnchorHTMLAttributes < T > , React . ButtonHTMLAttributes < T > {
33
+ raised ?: boolean ;
34
+ unelevated ?: boolean ;
35
+ outlined ?: boolean ;
36
+ dense ?: boolean ;
37
+ disabled ?: boolean ;
38
+ className ?: string ;
39
+ icon ?: React . ReactElement < React . HTMLProps < HTMLOrSVGElement > > ;
40
+ href ?: string ;
41
+ trailingIcon ?: React . ReactElement < React . HTMLProps < HTMLOrSVGElement > > ;
41
42
}
42
43
43
44
export const Button = < T extends ButtonTypes > (
Original file line number Diff line number Diff line change @@ -66,6 +66,16 @@ test('renders a button with an anchor tag', () => {
66
66
assert . equal ( wrapper . type ( ) , 'a' ) ;
67
67
} ) ;
68
68
69
+ test ( 'renders a button with a button attribute' , ( ) => {
70
+ const wrapper = shallow ( < Button type = 'submit' /> ) ;
71
+ assert . equal ( wrapper . prop ( 'type' ) , 'submit' ) ;
72
+ } ) ;
73
+
74
+ test ( 'renders a button with an anchor attribute' , ( ) => {
75
+ const wrapper = shallow ( < Button download /> ) ;
76
+ assert . equal ( wrapper . prop ( 'download' ) , true ) ;
77
+ } ) ;
78
+
69
79
test ( 'default initRipple function' , ( ) => {
70
80
const initRipple = coerceForTesting < ( surface : HTMLButtonElement ) => { } > ( td . func ( ) ) ;
71
81
mount ( < Button initRipple = { initRipple } /> ) ;
You can’t perform that action at this time.
0 commit comments