You've already forked The-API-Book
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:
@ -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();
|
||||
|
@ -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'
|
||||
});
|
||||
}
|
||||
|
@ -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();
|
||||
|
Reference in New Issue
Block a user