diff --git a/app/components/place-details.gjs b/app/components/place-details.gjs index b3b362a..26794f0 100644 --- a/app/components/place-details.gjs +++ b/app/components/place-details.gjs @@ -142,7 +142,10 @@ export default class PlaceDetails extends Component { if (type === 'phone') { return htmlSafe( - parts.map((p) => `${p}`).join('
') + parts.map((p) => { + const safeTel = p.replace(/[\s-]+/g, ''); + return `${p}`; + }).join('
') ); } diff --git a/app/icons/whatsapp.svg b/app/icons/whatsapp.svg new file mode 100644 index 0000000..85109bf --- /dev/null +++ b/app/icons/whatsapp.svg @@ -0,0 +1,4 @@ + + + + diff --git a/tests/integration/components/place-details-test.gjs b/tests/integration/components/place-details-test.gjs index 4956952..9cefb7e 100644 --- a/tests/integration/components/place-details-test.gjs +++ b/tests/integration/components/place-details-test.gjs @@ -260,8 +260,8 @@ module('Integration | Component | place-details', function (hooks) { const place = { title: 'Phone Shop', osmTags: { - phone: '+1 234 567 8900', - 'contact:phone': '+1 234 567 8900; +1 000 000 0000', + phone: '+1-234-567-8900', + 'contact:phone': '+1-234-567-8900; +1 000 000 0000', mobile: '+1 987 654 3210', 'contact:mobile': '+1 987 654 3210', }, @@ -287,7 +287,11 @@ module('Integration | Component | place-details', function (hooks) { 'Rendered exactly 3 unique phone links' ); - assert.dom(links[0]).hasText('+1 234 567 8900'); + assert.strictEqual(links[0].getAttribute('href'), 'tel:+12345678900'); + assert.strictEqual(links[1].getAttribute('href'), 'tel:+10000000000'); + assert.strictEqual(links[2].getAttribute('href'), 'tel:+19876543210'); + + assert.dom(links[0]).hasText('+1-234-567-8900'); assert.dom(links[1]).hasText('+1 000 000 0000'); assert.dom(links[2]).hasText('+1 987 654 3210'); });