Skip to content

Commit

Permalink
[UXPT]: Update select to use pointer on hover (#1475)
Browse files Browse the repository at this point in the history
  • Loading branch information
JordonHong authored Mar 26, 2024
1 parent c8898ef commit 4daf2c3
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"changes": [
{
"packageName": "pcln-design-system",
"comment": "Updated Select to use pointer while hovering",
"type": "minor"
}
],
"packageName": "pcln-design-system"
}
12 changes: 12 additions & 0 deletions packages/core/src/FormField/__snapshots__/FormField.spec.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,10 @@ exports[`FormField disabled state renders select with icon - disabled 1`] = `
display: none;
}
.c10:hover {
cursor: pointer;
}
.c10:disabled {
background-color: #f4f6f8;
color: #4f6f8f;
Expand Down Expand Up @@ -1048,6 +1052,10 @@ exports[`FormField renders with Select 1`] = `
display: none;
}
.c4:hover {
cursor: pointer;
}
.c4:disabled {
background-color: #f4f6f8;
color: #4f6f8f;
Expand Down Expand Up @@ -1251,6 +1259,10 @@ exports[`FormField renders with Select and Icon 1`] = `
display: none;
}
.c8:hover {
cursor: pointer;
}
.c8:disabled {
background-color: #f4f6f8;
color: #4f6f8f;
Expand Down
18 changes: 15 additions & 3 deletions packages/core/src/Select/Select.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ import { getPaletteColor } from '../utils/utils'
import { Select } from './Select'

describe('Select', () => {
test('renders', () => {
it('renders', () => {
const json = rendererCreateWithTheme(<Select />).toJSON()
expect(json).toMatchSnapshot()
})

test('it renders disabled', () => {
it('renders disabled', () => {
const paletteTheme = createTheme(theme)
render(
<Select data-testId='disabled-select' defaultValue='Premium Economy' disabled>
Expand All @@ -38,7 +38,7 @@ describe('Select', () => {
it('should render correctly', () => {
const paletteTheme = createTheme(theme)
render(
<Select data-testId='select' defaultValue='Premium Economy' variation='subtle'>
<Select data-testId='select' defaultValue='Premium Economy' variation='subtle' size='lg'>
<option>Premium Economy</option>
</Select>
)
Expand All @@ -54,6 +54,7 @@ describe('Select', () => {
)
expect(select).toHaveStyleRule('color', getPaletteColor('primary.base')({ theme: paletteTheme }))
expect(select).toHaveStyleRule('font-weight', 'bold')
expect(select).toHaveStyleRule('border-radius', '12px')
expect(select).toHaveStyleRule(
'background-color',
getPaletteColor('background.tint')({ theme: paletteTheme }),
Expand Down Expand Up @@ -87,6 +88,17 @@ describe('Select', () => {
)
})

it('should render with round border in small or medium sizes', () => {
render(
<Select data-testId='select' defaultValue='Premium Economy' variation='subtle' size='md'>
<option>Premium Economy</option>
</Select>
)

const select = screen.getByTestId('select')
expect(select).toHaveStyleRule('border-radius', '9999px')
})

it('should render correctly when disabled', () => {
const paletteTheme = createTheme(theme)
render(
Expand Down
4 changes: 4 additions & 0 deletions packages/core/src/Select/Select.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,10 @@ const SelectBase: React.FC<SelectProps> = styled.select.attrs(borderRadiusAttrs)
display: none;
}
&:hover {
cursor: pointer;
}
&:disabled {
background-color: ${getPaletteColor('background.light')};
color: ${getPaletteColor('text.light')};
Expand Down
4 changes: 4 additions & 0 deletions packages/core/src/Select/__snapshots__/Select.spec.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@ exports[`Select renders 1`] = `
display: none;
}
.c2:hover {
cursor: pointer;
}
.c2:disabled {
background-color: #f4f6f8;
color: #4f6f8f;
Expand Down

0 comments on commit 4daf2c3

Please sign in to comment.