diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f04520572..83392fcd3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -83,6 +83,9 @@ jobs: runs-on: ubuntu-latest needs: [setup] timeout-minutes: 5 + strategy: + matrix: + leaflet: ["1.6.0", "1.7.1", "1.8.0"] steps: - uses: actions/checkout@v2 @@ -96,6 +99,9 @@ jobs: path: node_modules key: ${{ runner.os }}-node_modules-${{ hashFiles('**/package-lock.json') }} + - name: install specific leaflet version + run: npm install leaflet@${{ matrix.leaflet }} + - name: unit tests run: npm run ci:test env: diff --git a/src/SearchControl.ts b/src/SearchControl.ts index 9ca2b2d2f..ea30ce73e 100644 --- a/src/SearchControl.ts +++ b/src/SearchControl.ts @@ -164,7 +164,7 @@ const Control: SearchControl = { } // merge given options with control defaults - this.options = { ...this.options, ...options }; + this.options = { ...defaultOptions, ...options }; this.classNames = { ...this.classNames, ...options.classNames }; this.markers = new L.FeatureGroup(); diff --git a/src/__tests__/SearchControl.spec.js b/src/__tests__/SearchControl.spec.js index f4d108b03..faf3f27d0 100644 --- a/src/__tests__/SearchControl.spec.js +++ b/src/__tests__/SearchControl.spec.js @@ -84,3 +84,9 @@ test('Change view on result', () => { expect(map.setView).toHaveBeenCalled(); }); + +test('Default options are applied', () => { + const control = new SearchControl({ provider: jest.fn() }); + + expect(control.options).toEqual(expect.objectContaining({ style: 'button' })); +});