1
0
mirror of https://github.com/twirl/The-API-Book.git synced 2025-07-12 22:50:21 +02:00

examples refactoring

This commit is contained in:
Sergey Konstantinov
2023-08-01 01:25:30 +03:00
parent c35d5ae61d
commit 31e9a55e6c
19 changed files with 711 additions and 384 deletions

View File

@ -137,8 +137,9 @@ describe('OfferPanelComponent', () => {
});
expect(events).toEqual([
{
offerId: CAFEE_CHAMOMILE_LUNGO_OFFER_FULL_VIEW.offerId,
action: MOCK_ACTION
currentOfferId: CAFEE_CHAMOMILE_LUNGO_OFFER_FULL_VIEW.offerId,
action: MOCK_ACTION,
target: mockButton
}
]);
offerPanel.destroy();

View File

@ -161,7 +161,7 @@ describe('SearchBoxComposer', () => {
'createOrder',
() => {
mockOfferPanel.events.emit('action', {
offerId: CAFEE_CHAMOMILE_LUNGO_OFFER.offerId,
currentOfferId: CAFEE_CHAMOMILE_LUNGO_OFFER.offerId,
action: 'createOrder'
});
}
@ -180,7 +180,7 @@ describe('SearchBoxComposer', () => {
event = e;
});
mockOfferPanel.events.emit('action', {
offerId: 'fakeOfferId',
currentOfferId: 'fakeOfferId',
action: 'createOrder'
});
expect(event).toEqual(null);
@ -200,7 +200,7 @@ describe('SearchBoxComposer', () => {
'offerFullViewToggle',
() => {
mockOfferPanel.events.emit('action', {
offerId: CAFEE_CHAMOMILE_LUNGO_OFFER.offerId,
currentOfferId: CAFEE_CHAMOMILE_LUNGO_OFFER.offerId,
action: 'close'
});
}

View File

@ -14,7 +14,8 @@ export class DummyMapApi {
'background-size: cover',
'position: relative',
'width: 100%',
'height: 100%'
'height: 100%',
'overflow: hidden'
].join(';');
}
@ -35,6 +36,7 @@ export class DummyMapApi {
(this.bounds[1][1] - this.bounds[0][1])
) - 30;
const marker = document.createElement('div');
marker.dataset.markerId = markerId;
marker.style.cssText = [
'position: absolute',
'width: 30px',
@ -44,7 +46,8 @@ export class DummyMapApi {
'align: center',
'line-height: 30px',
'font-size: 30px',
'cursor: pointer'
'cursor: pointer',
'mix-blend-mode: luminosity'
].join(';');
marker.innerHTML =
'<a href="javascript:void(0)" style="text-decoration: none;">📍</a>';
@ -58,6 +61,17 @@ export class DummyMapApi {
this.container.appendChild(marker);
}
public selectSingleMarker(markerId: string) {
for (const marker of this.container.childNodes) {
const element = <HTMLElement>marker;
if (element.dataset?.markerId === markerId) {
element.style.mixBlendMode = 'unset';
} else {
element.style.mixBlendMode = 'luminosity';
}
}
}
public destroy() {
for (const dispose of this.listenerDisposers) {
dispose();