Skip to content

Commit

Permalink
test: update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mgadewoll committed May 14, 2024
1 parent 5da213d commit 1098b86
Show file tree
Hide file tree
Showing 2 changed files with 113 additions and 37 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -87,51 +87,100 @@ exports[`EuiDatePicker localization accepts the locale prop 1`] = `
<div
class="react-datepicker__day-name"
>
<span>
<span
aria-hidden="true"
>
</span>
<span
class="emotion-euiScreenReaderOnly"
>
일요일
</span>
</div>
<div
class="react-datepicker__day-name"
>
<span>
<span
aria-hidden="true"
>
</span>
<span
class="emotion-euiScreenReaderOnly"
>
월요일
</span>
</div>
<div
class="react-datepicker__day-name"
>
<span>
<span
aria-hidden="true"
>
</span>
<span
class="emotion-euiScreenReaderOnly"
>
화요일
</span>
</div>
<div
class="react-datepicker__day-name"
>
<span>
<span
aria-hidden="true"
>
</span>
<span
class="emotion-euiScreenReaderOnly"
>
수요일
</span>
</div>
<div
class="react-datepicker__day-name"
>
<span>
<span
aria-hidden="true"
>
</span>
<span
class="emotion-euiScreenReaderOnly"
>
목요일
</span>
</div>
<div
class="react-datepicker__day-name"
>
<span>
<span
aria-hidden="true"
>
</span>
<span
class="emotion-euiScreenReaderOnly"
>
금요일
</span>
</div>
<div
class="react-datepicker__day-name"
>
<span>
<span
aria-hidden="true"
>
</span>
<span
class="emotion-euiScreenReaderOnly"
>
토요일
</span>
</div>
</div>
</div>
Expand Down Expand Up @@ -504,51 +553,100 @@ exports[`EuiDatePicker localization inherits locale from context 1`] = `
<div
class="react-datepicker__day-name"
>
<span>
<span
aria-hidden="true"
>
lu
</span>
<span
class="emotion-euiScreenReaderOnly"
>
lundi
</span>
</div>
<div
class="react-datepicker__day-name"
>
<span>
<span
aria-hidden="true"
>
ma
</span>
<span
class="emotion-euiScreenReaderOnly"
>
mardi
</span>
</div>
<div
class="react-datepicker__day-name"
>
<span>
<span
aria-hidden="true"
>
me
</span>
<span
class="emotion-euiScreenReaderOnly"
>
mercredi
</span>
</div>
<div
class="react-datepicker__day-name"
>
<span>
<span
aria-hidden="true"
>
je
</span>
<span
class="emotion-euiScreenReaderOnly"
>
jeudi
</span>
</div>
<div
class="react-datepicker__day-name"
>
<span>
<span
aria-hidden="true"
>
ve
</span>
<span
class="emotion-euiScreenReaderOnly"
>
vendredi
</span>
</div>
<div
class="react-datepicker__day-name"
>
<span>
<span
aria-hidden="true"
>
sa
</span>
<span
class="emotion-euiScreenReaderOnly"
>
samedi
</span>
</div>
<div
class="react-datepicker__day-name"
>
<span>
<span
aria-hidden="true"
>
di
</span>
<span
class="emotion-euiScreenReaderOnly"
>
dimanche
</span>
</div>
</div>
</div>
Expand Down
24 changes: 1 addition & 23 deletions packages/eui/src/components/date_picker/date_picker.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ describe('EuiDatePicker', () => {
).toHaveTextContent('Sunday');
});

it('adds long-text sr-only week names when locale is set to european English', () => {
it('adds long-text sr-only week names when locale is set', () => {
const selectedDate = moment('2019-07-01T00:00:00-0700');

const { container } = render(
Expand All @@ -105,27 +105,5 @@ describe('EuiDatePicker', () => {
.lastChild
).toHaveTextContent('Monday');
});

it('does not add long-text week names when locale is not English', () => {
const selectedDate = moment('2019-07-01T00:00:00-0700');

const { container } = render(
<EuiDatePicker
{...requiredProps}
inline
selected={selectedDate}
locale="fr"
/>
);

expect(
container.getElementsByClassName('react-datepicker__day-name')[0]
.children.length
).toEqual(1);
expect(
container.getElementsByClassName('react-datepicker__day-name')[0]
.firstChild
).not.toHaveAttribute('aria-hidden');
});
});
});

0 comments on commit 1098b86

Please sign in to comment.