Skip to content

Commit 8236c4b

Browse files
committed
format adjustments
1 parent 2279c00 commit 8236c4b

File tree

1 file changed

+53
-23
lines changed

1 file changed

+53
-23
lines changed

cypress/components/ui/alert.cy.tsx

Lines changed: 53 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,15 @@ describe('Alert Component', () => {
1111
});
1212

1313
it('renders Alert with default variant correctly', () => {
14-
cy.mount(<Alert variant="default">Default alert message</Alert>);
14+
cy.mount(<Alert variant='default'>Default alert message</Alert>);
1515

1616
cy.get('[data-slot="alert"]').should('exist');
1717
cy.get('[data-slot="alert"]').should('have.class', 'bg-card');
1818
cy.get('[data-slot="alert"]').should('have.class', 'text-card-foreground');
1919
});
2020

2121
it('renders Alert with destructive variant correctly', () => {
22-
cy.mount(<Alert variant="destructive">Destructive alert message</Alert>);
22+
cy.mount(<Alert variant='destructive'>Destructive alert message</Alert>);
2323

2424
cy.get('[data-slot="alert"]').should('exist');
2525
cy.get('[data-slot="alert"]').should('have.class', 'text-destructive');
@@ -28,7 +28,7 @@ describe('Alert Component', () => {
2828

2929
it('renders Alert with custom className correctly', () => {
3030
cy.mount(
31-
<Alert className="custom-alert-class">Alert with custom class</Alert>,
31+
<Alert className='custom-alert-class'>Alert with custom class</Alert>,
3232
);
3333

3434
cy.get('[data-slot="alert"]').should('have.class', 'custom-alert-class');
@@ -85,72 +85,91 @@ describe('Alert Component', () => {
8585
it('renders Alert with icon correctly', () => {
8686
cy.mount(
8787
<Alert>
88-
<svg data-testid="alert-icon" />
88+
<svg data-testid='alert-icon' />
8989
<AlertTitle>Alert with Icon</AlertTitle>
9090
<AlertDescription>This alert has an icon</AlertDescription>
9191
</Alert>,
9292
);
9393

9494
cy.get('[data-testid="alert-icon"]').should('exist');
95-
cy.get('[data-slot="alert"]').should('have.class', 'has-[>svg]:grid-cols-[calc(var(--spacing)*4)_1fr]');
95+
cy.get('[data-slot="alert"]').should(
96+
'have.class',
97+
'has-[>svg]:grid-cols-[calc(var(--spacing)*4)_1fr]',
98+
);
9699
});
97100

98101
it('renders destructive Alert with icon correctly', () => {
99102
cy.mount(
100-
<Alert variant="destructive">
101-
<svg data-testid="destructive-icon" />
103+
<Alert variant='destructive'>
104+
<svg data-testid='destructive-icon' />
102105
<AlertTitle>Destructive Alert</AlertTitle>
103-
<AlertDescription>This is a destructive alert with icon</AlertDescription>
106+
<AlertDescription>
107+
This is a destructive alert with icon
108+
</AlertDescription>
104109
</Alert>,
105110
);
106111

107112
cy.get('[data-testid="destructive-icon"]').should('exist');
108113
cy.get('[data-slot="alert"]').should('have.class', 'text-destructive');
109114
// Check that the alert description has the data-slot attribute and is styled appropriately
110115
cy.get('[data-slot="alert-description"]').should('exist');
111-
cy.get('[data-slot="alert-description"]').should('have.attr', 'data-slot', 'alert-description');
116+
cy.get('[data-slot="alert-description"]').should(
117+
'have.attr',
118+
'data-slot',
119+
'alert-description',
120+
);
112121
});
113122

114123
it('renders AlertTitle with custom className correctly', () => {
115124
cy.mount(
116125
<Alert>
117-
<AlertTitle className="custom-title-class">Custom Title</AlertTitle>
126+
<AlertTitle className='custom-title-class'>Custom Title</AlertTitle>
118127
</Alert>,
119128
);
120129

121-
cy.get('[data-slot="alert-title"]').should('have.class', 'custom-title-class');
130+
cy.get('[data-slot="alert-title"]').should(
131+
'have.class',
132+
'custom-title-class',
133+
);
122134
});
123135

124136
it('renders AlertDescription with custom className correctly', () => {
125137
cy.mount(
126138
<Alert>
127-
<AlertDescription className="custom-description-class">
139+
<AlertDescription className='custom-description-class'>
128140
Custom Description
129141
</AlertDescription>
130142
</Alert>,
131143
);
132144

133-
cy.get('[data-slot="alert-description"]').should('have.class', 'custom-description-class');
145+
cy.get('[data-slot="alert-description"]').should(
146+
'have.class',
147+
'custom-description-class',
148+
);
134149
});
135150

136151
it('renders multiple Alert components correctly', () => {
137152
cy.mount(
138153
<div>
139-
<Alert variant="default" data-testid="alert-1">
154+
<Alert variant='default' data-testid='alert-1'>
140155
<AlertTitle>First Alert</AlertTitle>
141156
<AlertDescription>First alert description</AlertDescription>
142157
</Alert>
143-
<Alert variant="destructive" data-testid="alert-2">
158+
<Alert variant='destructive' data-testid='alert-2'>
144159
<AlertTitle>Second Alert</AlertTitle>
145160
<AlertDescription>Second alert description</AlertDescription>
146161
</Alert>
147162
</div>,
148163
);
149164

150165
cy.get('[data-testid="alert-1"]').should('exist');
151-
cy.get('[data-testid="alert-1"] [data-slot="alert-title"]').contains('First Alert');
166+
cy.get('[data-testid="alert-1"] [data-slot="alert-title"]').contains(
167+
'First Alert',
168+
);
152169
cy.get('[data-testid="alert-2"]').should('exist');
153-
cy.get('[data-testid="alert-2"] [data-slot="alert-title"]').contains('Second Alert');
170+
cy.get('[data-testid="alert-2"] [data-slot="alert-title"]').contains(
171+
'Second Alert',
172+
);
154173
cy.get('[data-testid="alert-2"]').should('have.class', 'text-destructive');
155174
});
156175

@@ -159,7 +178,8 @@ describe('Alert Component', () => {
159178
<Alert>
160179
<AlertTitle>HTML Content Alert</AlertTitle>
161180
<AlertDescription>
162-
This alert contains <strong>bold text</strong> and <em>italic text</em>.
181+
This alert contains <strong>bold text</strong> and{' '}
182+
<em>italic text</em>.
163183
</AlertDescription>
164184
</Alert>,
165185
);
@@ -172,13 +192,23 @@ describe('Alert Component', () => {
172192

173193
it('renders Alert with accessibility attributes correctly', () => {
174194
cy.mount(
175-
<Alert aria-label="Custom alert" data-testid="accessible-alert">
195+
<Alert aria-label='Custom alert' data-testid='accessible-alert'>
176196
<AlertTitle>Accessible Alert</AlertTitle>
177-
<AlertDescription>This alert has custom accessibility attributes</AlertDescription>
197+
<AlertDescription>
198+
This alert has custom accessibility attributes
199+
</AlertDescription>
178200
</Alert>,
179201
);
180202

181-
cy.get('[data-testid="accessible-alert"]').should('have.attr', 'aria-label', 'Custom alert');
182-
cy.get('[data-testid="accessible-alert"]').should('have.attr', 'role', 'alert');
203+
cy.get('[data-testid="accessible-alert"]').should(
204+
'have.attr',
205+
'aria-label',
206+
'Custom alert',
207+
);
208+
cy.get('[data-testid="accessible-alert"]').should(
209+
'have.attr',
210+
'role',
211+
'alert',
212+
);
183213
});
184-
});
214+
});

0 commit comments

Comments
 (0)