diff options
| author | Erik Larkö <erik@mullvad.net> | 2017-09-26 11:08:39 +0200 |
|---|---|---|
| committer | Erik Larkö <erik@mullvad.net> | 2017-09-27 07:32:55 +0200 |
| commit | ffff41f7395d5cd5ca8e80ab1e3d12238dc7f6d1 (patch) | |
| tree | 82b897b556e78dfc2e4d23ff379ef6b67100d423 | |
| parent | e3c78f5b93484bb2480049939cb81e2361fc8c58 (diff) | |
| download | mullvadvpn-ffff41f7395d5cd5ca8e80ab1e3d12238dc7f6d1.tar.xz mullvadvpn-ffff41f7395d5cd5ca8e80ab1e3d12238dc7f6d1.zip | |
Don't reconnect to the previously preferred server
| -rw-r--r-- | app/components/SelectLocation.js | 4 | ||||
| -rw-r--r-- | test/components/SelectLocation.spec.js | 6 |
2 files changed, 6 insertions, 4 deletions
diff --git a/app/components/SelectLocation.js b/app/components/SelectLocation.js index 5a1fb5d342..4f2218d08c 100644 --- a/app/components/SelectLocation.js +++ b/app/components/SelectLocation.js @@ -18,7 +18,9 @@ export default class SelectLocation extends Component { _selectedCell: ?HTMLElement; onSelect(name: string) { - this.props.onSelect(name); + if (!this.isSelected(name)) { + this.props.onSelect(name); + } } isSelected(server: string) { diff --git a/test/components/SelectLocation.spec.js b/test/components/SelectLocation.spec.js index 28e21eb697..783a3adbf9 100644 --- a/test/components/SelectLocation.spec.js +++ b/test/components/SelectLocation.spec.js @@ -43,8 +43,8 @@ describe('components/SelectLocation', () => { onSelect: (_server) => done() }); const elements = ReactTestUtils.scryRenderedDOMComponentsWithClass(render(props), 'select-location__cell'); - expect(elements).to.have.length.greaterThan(0); - Simulate.click(elements[0]); + expect(elements).to.have.length.greaterThan(1); + Simulate.click(elements[1]); }); -});
\ No newline at end of file +}); |
