Fix: AccessibleButton does not set disabled attribute (PSF-1055) (#8682)
* remove old styles for pin drop buttons Signed-off-by: Kerry Archibald <kerrya@element.io> * fully disable share location button until location is shared Signed-off-by: Kerry Archibald <kerrya@element.io> * set disabled on button Signed-off-by: Kerry Archibald <kerrya@element.io> * test AccessibleButton disabled Signed-off-by: Kerry Archibald <kerrya@element.io> * remove disbaled check in LocationPicker Signed-off-by: Kerry Archibald <kerrya@element.io>
This commit is contained in:
parent
0d1bb3bd9a
commit
14cf6275d0
7 changed files with 291 additions and 9 deletions
|
@ -186,6 +186,28 @@ describe("LocationPicker", () => {
|
|||
expect(wrapper.find('MemberAvatar').length).toBeTruthy();
|
||||
});
|
||||
|
||||
it('disables submit button until geolocation completes', () => {
|
||||
const onChoose = jest.fn();
|
||||
const wrapper = getComponent({ shareType, onChoose });
|
||||
|
||||
// submit button is enabled when position is truthy
|
||||
expect(findByTestId(wrapper, 'location-picker-submit-button').at(0).props().disabled).toBeTruthy();
|
||||
act(() => {
|
||||
findByTestId(wrapper, 'location-picker-submit-button').at(0).simulate('click');
|
||||
});
|
||||
// nothing happens on button click
|
||||
expect(onChoose).not.toHaveBeenCalled();
|
||||
|
||||
act(() => {
|
||||
// @ts-ignore
|
||||
mocked(mockGeolocate).emit('geolocate', mockGeolocationPosition);
|
||||
wrapper.setProps({});
|
||||
});
|
||||
|
||||
// submit button is enabled when position is truthy
|
||||
expect(findByTestId(wrapper, 'location-picker-submit-button').at(0).props().disabled).toBeFalsy();
|
||||
});
|
||||
|
||||
it('submits location', () => {
|
||||
const onChoose = jest.fn();
|
||||
const wrapper = getComponent({ onChoose, shareType });
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue