Skip to content

Commit

Permalink
add 2 setTimeout instead of wait for 1s
Browse files Browse the repository at this point in the history
  • Loading branch information
Algorush committed May 21, 2024
1 parent 57711f3 commit 1407151
Showing 1 changed file with 40 additions and 32 deletions.
72 changes: 40 additions & 32 deletions test/browserTests/street-geo-test-bdd.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -33,26 +33,30 @@ describe('street-geo component', function() {
el.setAttribute('street-geo', 'maps', 'google3d');

setTimeout(() => {
const updatedMapbox2dElement = el.querySelector('[data-layer-name="Mapbox Satellite Streets"]');
const updatedGoogle3dElement = el.querySelector('[data-layer-name="Google 3D Tiles"]');

expect(updatedMapbox2dElement).to.not.exist;
expect(updatedGoogle3dElement).to.exist;

done();
}, 1000);
setTimeout(() => {
const updatedMapbox2dElement = el.querySelector('[data-layer-name="Mapbox Satellite Streets"]');
const updatedGoogle3dElement = el.querySelector('[data-layer-name="Google 3D Tiles"]');

expect(updatedMapbox2dElement).to.not.exist;
expect(updatedGoogle3dElement).to.exist;

done();
});
});
});

it('should create both mapbox2d and google3d elements', (done) => {
el.setAttribute('street-geo', 'maps', 'mapbox2d, google3d');

setTimeout(() => {
const mapbox2dElement = el.querySelector('[data-layer-name="Mapbox Satellite Streets"]');
const google3dElement = el.querySelector('[data-layer-name="Google 3D Tiles"]');
expect(mapbox2dElement).to.exist;
expect(google3dElement).to.exist;
done();
}, 1000);
setTimeout(() => {
const mapbox2dElement = el.querySelector('[data-layer-name="Mapbox Satellite Streets"]');
const google3dElement = el.querySelector('[data-layer-name="Google 3D Tiles"]');
expect(mapbox2dElement).to.exist;
expect(google3dElement).to.exist;
done();
});
});
});

it('should delete mapbox2d and google3d elements after setting maps attribute to empty', (done) => {
Expand All @@ -65,14 +69,16 @@ describe('street-geo component', function() {
el.setAttribute('street-geo', 'maps', '');

setTimeout(() => {
const updatedMapbox2dElement = el.querySelector('[data-layer-name="Mapbox Satellite Streets"]');
const updatedGoogle3dElement = el.querySelector('[data-layer-name="Google 3D Tiles"]');

expect(updatedMapbox2dElement).to.not.exist;
expect(updatedGoogle3dElement).to.not.exist;

done();
}, 1000);
setTimeout(() => {
const updatedMapbox2dElement = el.querySelector('[data-layer-name="Mapbox Satellite Streets"]');
const updatedGoogle3dElement = el.querySelector('[data-layer-name="Google 3D Tiles"]');

expect(updatedMapbox2dElement).to.not.exist;
expect(updatedGoogle3dElement).to.not.exist;

done();
});
});
});

it('should update latitude, longitude, and elevation for google3d', (done) => {
Expand All @@ -82,15 +88,17 @@ describe('street-geo component', function() {
el.setAttribute('street-geo', 'elevation', 100);

setTimeout(() => {
const google3dElement = el.querySelector('[data-layer-name="Google 3D Tiles"]');
expect(google3dElement).to.exist;

const loader3dtilesAttr = google3dElement.getAttribute('loader-3dtiles');
expect(loader3dtilesAttr.long).to.equal(40);
expect(loader3dtilesAttr.lat).to.equal(50);
expect(loader3dtilesAttr.height).to.equal(100 - 32.49158);

done();
}, 1000);
setTimeout(() => {
const google3dElement = el.querySelector('[data-layer-name="Google 3D Tiles"]');
expect(google3dElement).to.exist;

const loader3dtilesAttr = google3dElement.getAttribute('loader-3dtiles');
expect(loader3dtilesAttr.long).to.equal(40);
expect(loader3dtilesAttr.lat).to.equal(50);
expect(loader3dtilesAttr.height).to.equal(100 - 32.49158);

done();
});
});
});
});

0 comments on commit 1407151

Please sign in to comment.