Skip to content

Commit

Permalink
Update Picker placeholder to be shorter (#6796)
Browse files Browse the repository at this point in the history
  • Loading branch information
snowystinger authored Jul 31, 2024
1 parent 7aadd66 commit 1dcc870
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 26 deletions.
2 changes: 1 addition & 1 deletion packages/@react-spectrum/picker/intl/en-US.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"placeholder": "Select an option",
"placeholder": "Select…",
"loading": "Loading…"
}
50 changes: 25 additions & 25 deletions packages/@react-spectrum/picker/test/Picker.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ describe('Picker', function () {
expect(picker).toHaveAttribute('data-testid', 'test');

let label = getAllByText('Test')[0];
let value = getByText('Select an option…');
let value = getByText('Select…');
expect(label).toBeVisible();
expect(value).toBeVisible();
});
Expand Down Expand Up @@ -362,7 +362,7 @@ describe('Picker', function () {
expect(listbox).toBeVisible();
expect(onOpenChange).not.toBeCalled();

let picker = getByLabelText('Select an option…');
let picker = getByLabelText('Select…');
expect(picker).toHaveAttribute('aria-expanded', 'true');
expect(picker).toHaveAttribute('aria-controls', listbox.id);

Expand Down Expand Up @@ -393,7 +393,7 @@ describe('Picker', function () {
expect(listbox).toBeVisible();
expect(onOpenChange).not.toBeCalled();

let picker = getByLabelText('Select an option…');
let picker = getByLabelText('Select…');
expect(picker).toHaveAttribute('aria-expanded', 'true');
expect(picker).toHaveAttribute('aria-controls', listbox.id);

Expand Down Expand Up @@ -721,7 +721,7 @@ describe('Picker', function () {
expect(listbox).toBeVisible();
expect(onOpenChange).not.toBeCalled();

let picker = getByLabelText('Select an option…');
let picker = getByLabelText('Select…');
expect(picker).toHaveAttribute('aria-expanded', 'true');
expect(picker).toHaveAttribute('aria-controls', listbox.id);

Expand Down Expand Up @@ -751,7 +751,7 @@ describe('Picker', function () {
expect(getByRole('listbox')).toBeVisible();
expect(onOpenChange).not.toBeCalled();

let picker = getByLabelText('Select an option…');
let picker = getByLabelText('Select…');
expect(picker).toHaveAttribute('aria-expanded', 'true');

let listbox = getByRole('listbox');
Expand Down Expand Up @@ -804,7 +804,7 @@ describe('Picker', function () {
expect(picker).toHaveAttribute('aria-haspopup', 'listbox');

let label = getAllByText('Test')[0];
let value = getByText('Select an option…');
let value = getByText('Select…');
expect(label).toHaveAttribute('id');
expect(value).toHaveAttribute('id');
expect(picker).toHaveAttribute('aria-labelledby', `${value.id} ${label.id}`);
Expand All @@ -829,7 +829,7 @@ describe('Picker', function () {
);

let picker = getByRole('button');
let value = getByText('Select an option…');
let value = getByText('Select…');
expect(picker).toHaveAttribute('id');
expect(value).toHaveAttribute('id');
expect(picker).toHaveAttribute('aria-label', 'Test');
Expand All @@ -855,7 +855,7 @@ describe('Picker', function () {
);

let picker = getByRole('button');
let value = getByText('Select an option…');
let value = getByText('Select…');
expect(picker).toHaveAttribute('id');
expect(value).toHaveAttribute('id');
expect(picker).toHaveAttribute('aria-labelledby', `${value.id} foo`);
Expand All @@ -880,7 +880,7 @@ describe('Picker', function () {
);

let picker = getByRole('button');
let value = getByText('Select an option…');
let value = getByText('Select…');
expect(picker).toHaveAttribute('id');
expect(value).toHaveAttribute('id');
expect(picker).toHaveAttribute('aria-label', 'Test');
Expand Down Expand Up @@ -914,7 +914,7 @@ describe('Picker', function () {
expect(span).not.toHaveAttribute('aria-hidden');

let label = span.parentElement;
let value = getByText('Select an option…');
let value = getByText('Select…');
expect(label).toHaveAttribute('id');
expect(value).toHaveAttribute('id');
expect(picker).toHaveAttribute('aria-labelledby', `${value.id} ${label.id}`);
Expand Down Expand Up @@ -978,7 +978,7 @@ describe('Picker', function () {
);

let picker = getByRole('button');
expect(picker).toHaveTextContent('Select an option…');
expect(picker).toHaveTextContent('Select…');
await user.click(picker);
act(() => jest.runAllTimers());

Expand Down Expand Up @@ -1015,7 +1015,7 @@ describe('Picker', function () {
);

let picker = getByRole('button');
expect(picker).toHaveTextContent('Select an option…');
expect(picker).toHaveTextContent('Select…');
await user.click(picker);
act(() => jest.runAllTimers());

Expand Down Expand Up @@ -1086,7 +1086,7 @@ describe('Picker', function () {
);

let picker = getByRole('button');
expect(picker).toHaveTextContent('Select an option…');
expect(picker).toHaveTextContent('Select…');
await user.click(picker);
act(() => jest.runAllTimers());

Expand Down Expand Up @@ -1132,7 +1132,7 @@ describe('Picker', function () {
);

let picker = getByRole('button');
expect(picker).toHaveTextContent('Select an option…');
expect(picker).toHaveTextContent('Select…');
act(() => {picker.focus();});

fireEvent.keyDown(picker, {key: 'ArrowUp'});
Expand Down Expand Up @@ -1177,7 +1177,7 @@ describe('Picker', function () {
);

let picker = getByRole('button');
expect(picker).toHaveTextContent('Select an option…');
expect(picker).toHaveTextContent('Select…');
await user.click(picker);
act(() => jest.runAllTimers());

Expand Down Expand Up @@ -1223,7 +1223,7 @@ describe('Picker', function () {
);

let picker = getByRole('button');
expect(picker).toHaveTextContent('Select an option…');
expect(picker).toHaveTextContent('Select…');
expect(onOpenChangeSpy).toHaveBeenCalledTimes(0);
await user.click(picker);
act(() => jest.runAllTimers());
Expand Down Expand Up @@ -1370,7 +1370,7 @@ describe('Picker', function () {
);

let picker = getByRole('button');
expect(picker).toHaveTextContent('Select an option…');
expect(picker).toHaveTextContent('Select…');
await user.click(picker);
act(() => jest.runAllTimers());

Expand Down Expand Up @@ -1443,7 +1443,7 @@ describe('Picker', function () {
);

let picker = getByRole('button');
expect(picker).toHaveTextContent('Select an option…');
expect(picker).toHaveTextContent('Select…');
await user.click(picker);
act(() => jest.runAllTimers());

Expand Down Expand Up @@ -1545,7 +1545,7 @@ describe('Picker', function () {

let picker = getByRole('button');
act(() => {picker.focus();});
expect(picker).toHaveTextContent('Select an option…');
expect(picker).toHaveTextContent('Select…');
fireEvent.keyDown(picker, {key: 'ArrowDown'});
act(() => jest.runAllTimers());

Expand Down Expand Up @@ -1641,7 +1641,7 @@ describe('Picker', function () {

let picker = getByRole('button');
await user.tab();
expect(picker).toHaveTextContent('Select an option…');
expect(picker).toHaveTextContent('Select…');
await user.keyboard('{ArrowLeft}');
act(() => jest.runAllTimers());
expect(onSelectionChange).toHaveBeenCalledTimes(1);
Expand Down Expand Up @@ -1687,7 +1687,7 @@ describe('Picker', function () {

let picker = getByRole('button');
act(() => {picker.focus();});
expect(picker).toHaveTextContent('Select an option…');
expect(picker).toHaveTextContent('Select…');

fireEvent.keyDown(picker, {key: 't'});
fireEvent.keyUp(picker, {key: 't'});
Expand Down Expand Up @@ -1715,7 +1715,7 @@ describe('Picker', function () {

let picker = getByRole('button');
act(() => {picker.focus();});
expect(picker).toHaveTextContent('Select an option…');
expect(picker).toHaveTextContent('Select…');

fireEvent.keyDown(picker, {key: 't'});
fireEvent.keyUp(picker, {key: 't'});
Expand Down Expand Up @@ -1744,7 +1744,7 @@ describe('Picker', function () {

let picker = getByRole('button');
act(() => {picker.focus();});
expect(picker).toHaveTextContent('Select an option…');
expect(picker).toHaveTextContent('Select…');

fireEvent.keyDown(picker, {key: 't'});
fireEvent.keyUp(picker, {key: 't'});
Expand Down Expand Up @@ -1772,7 +1772,7 @@ describe('Picker', function () {
);

let picker = getByRole('button');
expect(picker).toHaveTextContent('Select an option…');
expect(picker).toHaveTextContent('Select…');

let hiddenLabel = getByText('Test', {hidden: true, selector: 'label'});
expect(hiddenLabel.tagName).toBe('LABEL');
Expand Down Expand Up @@ -2500,7 +2500,7 @@ describe('Picker', function () {
jest.runAllTimers();
});

expect(button).toHaveTextContent('Select an option…');
expect(button).toHaveTextContent('Select…');
expect(listbox).not.toBeInTheDocument();
expect(onClick.mock.calls[0][0].target).toBeInstanceOf(HTMLAnchorElement);
expect(onClick.mock.calls[0][0].target.href).toBe('https://google.com/');
Expand Down

1 comment on commit 1dcc870

@rspbot
Copy link

@rspbot rspbot commented on 1dcc870 Jul 31, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.