Skip to content

Commit

Permalink
Merge pull request #710 from geoman-io/develop
Browse files Browse the repository at this point in the history
Release 2.8
  • Loading branch information
codeofsumit authored Nov 18, 2020
2 parents 4fc91ec + 2b22f19 commit ff58d54
Show file tree
Hide file tree
Showing 61 changed files with 3,580 additions and 1,215 deletions.
118 changes: 79 additions & 39 deletions README.md

Large diffs are not rendered by default.

29 changes: 29 additions & 0 deletions cypress/fixtures/FeatureCollectionEventFire.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"type":"FeatureCollection",
"features":[
{
"type":"Feature",
"geometry":{
"type":"MultiPoint",
"coordinates":[
[
32.83604819,
40.0169319
]
]
}
},
{
"type":"Feature",
"geometry":{
"type":"MultiPoint",
"coordinates":[
[
32.8298979,
40.02567418
]
]
}
}
]
}
153 changes: 153 additions & 0 deletions cypress/integration/circle.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,4 +84,157 @@ describe('Draw Circle', () => {
});
});
});

it('enable continueDrawing', () => {
cy.window().then(({ map }) => {
map.pm.setGlobalOptions({continueDrawing: true});
});

cy.toolbarButton('circle')
.click()
.closest('.button-container')
.should('have.class', 'active');

// draw first circle
cy.get(mapSelector)
.click(200, 200)
.click(250, 250);

// draw with continueDrawing: ture the second circle
cy.get(mapSelector)
.click(300, 200)
.click(350, 250);

cy.toolbarButton('edit').click();
cy.hasVertexMarkers(4);
});

it('set max radius of circle', () => {
let handFinish = false;

cy.toolbarButton('circle')
.click()
.closest('.button-container')
.should('have.class', 'active');

cy.window().then(({ map, L }) => {
L.marker(map.getCenter()).addTo(map);
map.pm.setGlobalOptions({
minRadiusCircle: 500,
maxRadiusCircle: 1500,
});
cy.get(mapSelector)
.click(250,200)
.click(620,190)
.then(() => {
map.eachLayer(layer => {
if (layer instanceof L.Circle) {
expect(layer.getRadius()).to.equal(1500);
}
});
});
});

cy.toolbarButton('edit')
.click()
.closest('.button-container')
.should('have.class', 'active');

cy.window().then(({ Hand, map, L }) => {
const handMarker = new Hand({
timing: 'frame',
onStop: ()=>{
map.eachLayer(layer => {
if (layer instanceof L.Circle) {
expect(true).to.equal(layer.getRadius() < 1500);
}
});
const handMarker2 = new Hand({
timing: 'frame',
onStop: () => {
handFinish = true;
map.eachLayer(layer => {
if (layer instanceof L.Circle) {
expect(true).to.equal(layer.getRadius() >= 1495 && layer.getRadius() < 1505);
}
});
}
});
const toucherMarker2 = handMarker2.growFinger('mouse');
toucherMarker2.wait(100).moveTo(317,198, 100).down().wait(500).moveTo(500,198, 600).up().wait(100)
}
});
const toucherMarker = handMarker.growFinger('mouse');
toucherMarker.wait(100).moveTo(379,198, 100).down().wait(500).moveTo(317,198, 400).up().wait(100)

// wait until hand is finished
cy.waitUntil(() => cy.window().then(() => handFinish)).then( ()=> {
expect(handFinish).to.equal(true);
});
});

});
it('set min radius of circle', () => {
let handFinish = false;

cy.toolbarButton('circle')
.click()
.closest('.button-container')
.should('have.class', 'active');

cy.window().then(({ map, L }) => {
L.marker(map.getCenter()).addTo(map);
map.pm.setGlobalOptions({
minRadiusCircle: 1500,
maxRadiusCircle: 3000,
});
cy.get(mapSelector)
.click(250,200)
.click(300,190)
.then(() => {
map.eachLayer(layer => {
if (layer instanceof L.Circle) {
expect(layer.getRadius()).to.equal(1500);
}
});
});
});

cy.toolbarButton('edit')
.click()
.closest('.button-container')
.should('have.class', 'active');

cy.window().then(({ Hand, map, L }) => {
const handMarker = new Hand({
timing: 'frame',
onStop: ()=>{
map.eachLayer(layer => {
if (layer instanceof L.Circle) {
expect(true).to.equal(layer.getRadius() > 1500)
}
});
const handMarker2 = new Hand({
timing: 'frame',
onStop: () =>{
handFinish = true;
map.eachLayer(layer => {
if (layer instanceof L.Circle) {
expect(true).to.equal(layer.getRadius() >= 1495 && layer.getRadius() < 1505);
}
});
}
});
const toucherMarker2 = handMarker2.growFinger('mouse');
toucherMarker2.wait(200).moveTo(490,198, 100).down().wait(500).moveTo(317,198, 600).up().wait(100)
}
});
const toucherMarker = handMarker.growFinger('mouse');
toucherMarker.wait(100).moveTo(379,198, 100).down().wait(500).moveTo(500,198, 400).up().wait(100)
// wait until hand is finished
cy.waitUntil(() => cy.window().then(() => handFinish)).then( ()=> {
expect(handFinish).to.equal(true);
});
});
});
});
Loading

0 comments on commit ff58d54

Please sign in to comment.