Skip to content

Commit

Permalink
fix(Select): add text ellipsising to the option
Browse files Browse the repository at this point in the history
  • Loading branch information
ej9x committed Apr 24, 2019
1 parent 678165b commit baa7e88
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 2 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 7 additions & 0 deletions e2e/__tests__/select.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,13 @@ import { baisy } from '../setup/TestSuiter';

const SUITES = [
baisy.suite('Components/Select', 'common'),
baisy.suite('Components/Select', 'common', 'open')
.addRootHeight(50)
.setEnhancer(async (iframe) => {
const selectTrigger = await iframe.waitForXPath('(//input)[4]');

await selectTrigger.click();
}),
];


Expand Down
5 changes: 5 additions & 0 deletions src/components/Select/Select.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,11 @@ const customStyles = ({ hasError, zIndex = Z_INDEX.DROPDOWN }) => ({
...style,
padding: '0 8px',
}),
option: (style) => ({
...style,
textOverflow: 'ellipsis',
overflow: 'hidden',
}),
});

class Select extends React.Component<SelectProps> {
Expand Down
4 changes: 2 additions & 2 deletions src/components/Select/Select.stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const OPTIONS = [{
}];

const LONG_OPTIONS = [{
label: 'Geoglossaceae nontransportation laemodipodiform gluttonously spaework ankylorrhinia zain carlet ironheartedness topia antiorthodox cerebropedal Sothis whispered basilica idealizer outvalue thwacking unafraid coining nak friskily renishly stringsman',
label: 'GeoglossaceaenontransportationlaemodipodiformgluttonouslyspaeworkankylorrhiniazaincarletironheartednesstopiaantiorthodoxcerebropedalSothiswhisperedbasilicaidealizeroutvaluethwackingunafraidcoiningnakfriskilyrenishlystringsman',
value: 'ovenlike',
}, {
label: 'backhander unpersecuted platch antisymmetrical fumaroid chromitite Microthelyphonida epigraphically myope supramechanical pageant ankle camphory nitronaphthalene thieve umquhile mornings gynomonoecism unvulgarize rickmatic saltless sternoglossal pungi pronumber',
Expand All @@ -36,7 +36,7 @@ export default (asStory) => {
<StateContainer value={ [OPTIONS[1].value, OPTIONS[2].value] }>
<Select name="name" placeholder="Select an option" options={ OPTIONS } multiple />
</StateContainer>
<StateContainer value={ [LONG_OPTIONS[1].value, LONG_OPTIONS[2].value] }>
<StateContainer value={ [LONG_OPTIONS[1].value] }>
<Select name="name" placeholder="Select an option" options={ LONG_OPTIONS } multiple />
</StateContainer>
<StateContainer value={ [OPTIONS[1].value, OPTIONS[2].value] }>
Expand Down

0 comments on commit baa7e88

Please sign in to comment.