Skip to content

Picker multi select support - test fixed #885

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
Aug 6, 2020
Merged
6 changes: 3 additions & 3 deletions src/components/picker/__tests__/index.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ describe('Picker', () => {
describe('getLabel', () => {
it('should get label of a simple item', () => {
let uut = new Picker({value: countries[2]});
expect(uut.getLabel()).toEqual(countries[2].label);
expect(uut.getLabelValueText()).toEqual(countries[2].label);
uut = new Picker({value: countries[3]});
expect(uut.getLabel()).toEqual(countries[3].label);
expect(uut.getLabelValueText()).toEqual(countries[3].label);
});

it('should get label out of an array of items', () => {
const uut = new Picker({value: [countries[2], countries[4]]});
expect(uut.getLabel()).toEqual(`${countries[2].label}, ${countries[4].label}`);
expect(uut.getLabelValueText()).toEqual(`${countries[2].label}, ${countries[4].label}`);
});
});

Expand Down
6 changes: 3 additions & 3 deletions src/components/picker/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,8 @@ class Picker extends BaseComponent {
getAccessibilityInfo() {
const {placeholder} = this.props;
return {
accessibilityLabel: this.getLabel() ? `${placeholder}. selected. ${this.getLabel()}` : `Select ${placeholder}`,
accessibilityHint: this.getLabel()
accessibilityLabel: this.getLabelValueText() ? `${placeholder}. selected. ${this.getLabelValueText()}` : `Select ${placeholder}`,
accessibilityHint: this.getLabelValueText()
? 'Double tap to edit'
: `Goes to ${placeholder}. Suggestions will be provided`,
...this.extractAccessibilityProps()
Expand Down Expand Up @@ -224,7 +224,7 @@ class Picker extends BaseComponent {
const {items} = this.state;
const selectedItem = _.find(items, {value});
return _.get(selectedItem, 'label');
};
}

handlePickerOnPress = () => {
this.toggleExpandableModal(true);
Expand Down