Skip to content

Commit 9e6cae5

Browse files
made snapshots match the new output (#13)
* add type="button" to all buttons to not do a "submit" when used inside a form container * made snapshots match the new output * Update src/styled.tsx Use .attrs instead of an anonymous component Co-Authored-By: Kotaro Sugawara <kotarella1110@gmail.com> * Use default props instead Co-authored-by: Kotaro Sugawara <kotarella1110@gmail.com>
1 parent ee66078 commit 9e6cae5

4 files changed

Lines changed: 16 additions & 2 deletions

File tree

src/__snapshots__/devTool.test.tsx.snap

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ exports[`DevTool render correctly 1`] = `
2424
<button
2525
class="css-7zizgu"
2626
title="Close dev panel"
27+
type="button"
2728
>
2829
2930
</button>
@@ -38,13 +39,15 @@ exports[`DevTool render correctly 1`] = `
3839
class="css-4vv12s"
3940
style="border-right: 1px solid #0e101c; text-transform: none; font-size: 11px; line-height: 1;"
4041
title="Update values and state the form"
42+
type="button"
4143
>
4244
♺ UPDATE
4345
</button>
4446
<button
4547
class="css-4vv12s"
4648
style="border-right: 1px solid #0e101c; text-transform: none; font-size: 11px; line-height: 1;"
4749
title="Toggle entire fields"
50+
type="button"
4851
>
4952
[+] EXPAND
5053
</button>
@@ -79,13 +82,15 @@ exports[`DevTool render correctly 1`] = `
7982
class="css-4vv12s"
8083
style="border: 1px solid #516391; border-radius: 2px; padding: 3px 5px; display: inline-block; font-size: 10px; line-height: 12px; width: 20px; text-align: center; margin-right: 10px;"
8184
title="Toggle field table"
85+
type="button"
8286
>
8387
+
8488
</button>
8589
<button
8690
class="css-4vv12s"
8791
style="border: 1px solid #516391; border-radius: 2px; padding: 3px 5px; display: inline-block; font-size: 10px; line-height: 12px; text-align: center; margin-right: 10px;"
8892
title="Scroll into view"
93+
type="button"
8994
>
9095
Native
9196
</button>
@@ -124,13 +129,15 @@ exports[`DevTool render correctly 1`] = `
124129
class="css-4vv12s"
125130
style="border: 1px solid #516391; border-radius: 2px; padding: 3px 5px; display: inline-block; font-size: 10px; line-height: 12px; width: 20px; text-align: center; margin-right: 10px;"
126131
title="Toggle field table"
132+
type="button"
127133
>
128134
+
129135
</button>
130136
<button
131137
class="css-4vv12s"
132138
style="border: 1px solid #516391; border-radius: 2px; padding: 3px 5px; display: inline-block; font-size: 10px; line-height: 12px; text-align: center; margin-right: 10px;"
133139
title="Scroll into view"
140+
type="button"
134141
>
135142
Native
136143
</button>
@@ -157,6 +164,7 @@ exports[`DevTool render correctly 1`] = `
157164
class="css-4vv12s"
158165
style="margin: 0px; width: 100%; padding: 8px 10px; text-transform: none; font-size: 12px; line-height: 14px;"
159166
title="Toggle form state panel"
167+
type="button"
160168
>
161169
<span
162170
style="transition: 0.5s all; color: rgb(236, 89, 144);"

src/__snapshots__/header.test.tsx.snap

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ exports[`header should render correct color when form pass 1`] = `
1818
<button
1919
class="css-7zizgu"
2020
title="Close dev panel"
21+
type="button"
2122
>
2223
2324
</button>
@@ -43,6 +44,7 @@ exports[`header should render correct when form failed 1`] = `
4344
<button
4445
class="css-7zizgu"
4546
title="Close dev panel"
47+
type="button"
4648
>
4749
4850
</button>

src/__snapshots__/panelTable.test.tsx.snap

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,15 @@ exports[`PanelTable should render correctly 1`] = `
1919
class="css-4vv12s"
2020
style="border: 1px solid #516391; border-radius: 2px; padding: 3px 5px; display: inline-block; font-size: 10px; line-height: 12px; width: 20px; text-align: center; margin-right: 10px;"
2121
title="Toggle field table"
22+
type="button"
2223
>
2324
+
2425
</button>
2526
<button
2627
class="css-4vv12s"
2728
style="border: 1px solid #516391; border-radius: 2px; padding: 3px 5px; display: inline-block; font-size: 10px; line-height: 12px; text-align: center; margin-right: 10px; cursor: not-allowed; background: rgb(81, 99, 145);"
2829
title="Scroll into view"
30+
type="button"
2931
>
3032
Custom
3133
</button>

src/styled.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ import styled from '@emotion/styled';
22
import colors from './colors';
33

44
export const paraGraphDefaultStyle = {
5-
fontSize: 14,
6-
lineHeight: '22px',
5+
fontSize: 14,
6+
lineHeight: '22px',
77
};
88

99
const Button = styled.button`
@@ -21,6 +21,8 @@ const Button = styled.button`
2121
}
2222
`;
2323

24+
Button.defaultProps = { type: 'button' };
25+
2426
const CircleButton = styled(Button)`
2527
font-size: 14px;
2628
font-weight: bold;

0 commit comments

Comments
 (0)