Skip to content

Commit 28ac291

Browse files
committed
feat toggle
1 parent 460f37e commit 28ac291

File tree

2 files changed

+61
-1
lines changed

2 files changed

+61
-1
lines changed

packages/components/src/components/Toggle/__tests__/__snapshots__/index.browser.test.tsx.snap

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,40 @@ exports[`Toggle > should Toggle snapshot 8`] = `
131131
`;
132132

133133
exports[`Toggle > should Toggle snapshot 9`] = `
134+
<div>
135+
<div
136+
class="toggle-switch test border-radius-0-500px--255 box-sizing-0-border-box--255 cursor-0-pointer--255 position-0-relative--255 cursor-0-not-allowed-7839325038755874321-255 background-0-var(--disabledBg,light-dark(#D6D7DE,#373737))-7839325038755874321-255 transition-0-.25s--255 background-0-var(--primary)--255 height-0-8px--255 justify-content-0-flex-end--255 background-0-var(--primaryHoverBg,light-dark(color-mix(in srgb,var(--primary) 100%,#000 15%),color-mix(in srgb,var(--primary) 100%,#FFF 15%)))-8554804559691125144-255 width-0-40px--255"
137+
>
138+
<div
139+
class="testToggle background-color-0-#FFF--255 border-radius-0-100%--255 height-0-20px--255 width-0-20px--255 outline-0-4px--255 position-0-absolute--255 filter-0-drop-shadow(0 0 3px var(--switchShadow,#0000001A))--255 outline-0-4px solid-5575642944241722847-255 outline-color-0-var(--switchHoverOutline,light-dark(color-mix(in srgb,var(--primary) 20%,transparent),color-mix(in srgb,var(--primary) 50%,transparent)))-5575642944241722847-255 top-0--6px--255 transform-0-translateX(calc(100% + 2px))--255 transition-0-transform .25s--255"
140+
/>
141+
</div>
142+
<input
143+
type="hidden"
144+
value="true"
145+
/>
146+
</div>
147+
`;
148+
149+
exports[`Toggle > should Toggle snapshot 10`] = `
150+
<div>
151+
<div
152+
class="toggle-switch undefined border-radius-0-500px--255 box-sizing-0-border-box--255 cursor-0-pointer--255 position-0-relative--255 cursor-0-not-allowed-7839325038755874321-255 background-0-var(--disabledBg,light-dark(#D6D7DE,#373737))-7839325038755874321-255 transition-0-.25s--255 background-0-var(--primary)--255 height-0-8px--255 justify-content-0-flex-end--255 background-0-var(--primaryHoverBg,light-dark(color-mix(in srgb,var(--primary) 100%,#000 15%),color-mix(in srgb,var(--primary) 100%,#FFF 15%)))-8554804559691125144-255 width-0-40px--255"
153+
style="background-color: blue;"
154+
>
155+
<div
156+
class=" background-color-0-#FFF--255 border-radius-0-100%--255 height-0-20px--255 width-0-20px--255 outline-0-4px--255 position-0-absolute--255 filter-0-drop-shadow(0 0 3px var(--switchShadow,#0000001A))--255 outline-0-4px solid-5575642944241722847-255 outline-color-0-var(--switchHoverOutline,light-dark(color-mix(in srgb,var(--primary) 20%,transparent),color-mix(in srgb,var(--primary) 50%,transparent)))-5575642944241722847-255 top-0--6px--255 transform-0-translateX(calc(100% + 2px))--255 transition-0-transform .25s--255"
157+
style="background-color: blue;"
158+
/>
159+
</div>
160+
<input
161+
type="hidden"
162+
value="true"
163+
/>
164+
</div>
165+
`;
166+
167+
exports[`Toggle > should Toggle snapshot 11`] = `
134168
<div>
135169
<div
136170
class="toggle-switch undefined border-radius-0-500px--255 box-sizing-0-border-box--255 cursor-0-pointer--255 position-0-relative--255 cursor-0-not-allowed-7839325038755874321-255 background-0-var(--disabledBg,light-dark(#D6D7DE,#373737))-7839325038755874321-255 transition-0-.25s--255 background-0-var(--bg,light-dark(#E4E4E4,#383838))--255 height-0-28px--255 padding-0-4px--255 background-0-var(--hoverBg,light-dark(#C3C2C8,#696A6F))-8554804559691125144-255 width-0-50px--255"
@@ -148,7 +182,7 @@ exports[`Toggle > should Toggle snapshot 9`] = `
148182
</div>
149183
`;
150184

151-
exports[`Toggle > should Toggle snapshot 10`] = `
185+
exports[`Toggle > should Toggle snapshot 12`] = `
152186
<div>
153187
<div
154188
class="toggle-switch undefined border-radius-0-500px--255 box-sizing-0-border-box--255 cursor-0-pointer--255 position-0-relative--255 cursor-0-not-allowed-7839325038755874321-255 background-0-var(--disabledBg,light-dark(#D6D7DE,#373737))-7839325038755874321-255 transition-0-.25s--255 background-0-var(--bg,light-dark(#E4E4E4,#383838))--255 height-0-8px--255 background-0-var(--hoverBg,light-dark(#C3C2C8,#696A6F))-8554804559691125144-255 width-0-40px--255"

packages/components/src/components/Toggle/__tests__/index.browser.test.tsx

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,32 @@ describe('Toggle', () => {
2626
expect(
2727
render(<Toggle value={true} variant="switch" />).container,
2828
).toMatchSnapshot()
29+
expect(
30+
render(
31+
<Toggle
32+
className="test"
33+
classNames={{ toggle: 'testToggle' }}
34+
value={true}
35+
variant="switch"
36+
/>,
37+
).container,
38+
).toMatchSnapshot()
39+
expect(
40+
render(
41+
<Toggle
42+
style={{
43+
backgroundColor: 'blue',
44+
}}
45+
styles={{
46+
toggle: {
47+
backgroundColor: 'blue',
48+
},
49+
}}
50+
value={true}
51+
variant="switch"
52+
/>,
53+
).container,
54+
).toMatchSnapshot()
2955
expect(
3056
render(
3157
<Toggle

0 commit comments

Comments
 (0)