diff --git a/src/WguApp.vue b/src/WguApp.vue index d98198c8..8c6b048b 100644 --- a/src/WguApp.vue +++ b/src/WguApp.vue @@ -5,6 +5,11 @@ + + + +
+ + + {{icon}} + {{text}} + + +
+ + + + + + + diff --git a/test/unit/specs/maxextentbutton/ZoomToMaxExtentButton.spec.js b/test/unit/specs/maxextentbutton/ZoomToMaxExtentButton.spec.js new file mode 100644 index 00000000..279eb2e6 --- /dev/null +++ b/test/unit/specs/maxextentbutton/ZoomToMaxExtentButton.spec.js @@ -0,0 +1,36 @@ +import Vue from 'vue' +import ZoomToMaxExtentButton from '@/components/maxextentbutton/ZoomToMaxExtentButton' +import OlMap from 'ol/map'; +import OlView from 'ol/view'; + +describe('maxextentbutton/ZoomToMaxExtentButton.vue', () => { + // Check methods + it('has a method onClick', () => { + const Constructor = Vue.extend(ZoomToMaxExtentButton); + const ztmeb = new Constructor({ + }).$mount(); + expect(typeof ztmeb.onClick).to.equal('function'); + }); + + it('onClick sets correct center and zoom', () => { + const Constructor = Vue.extend(ZoomToMaxExtentButton); + const ztmeb = new Constructor({ + }).$mount(); + + ztmeb.$appConfig = { + mapCenter: [0, 0], + mapZoom: 0 + }; + ztmeb.map = new OlMap({ + view: new OlView({ + center: [1, 1], + zoom: 1 + }) + }); + + ztmeb.onClick(); + expect(ztmeb.map.getView().getCenter()[0]).to.equal(0); + expect(ztmeb.map.getView().getCenter()[1]).to.equal(0); + expect(ztmeb.map.getView().getZoom()).to.equal(0); + }); +});