Free, Open Source, Self-Hosted WhatsApp API Gateway
TypeScript apibotgatewayself-hostedwhatsappwhatsapp-apiwhatsapp-automationwhatsapp-botwhatsapp-gatewaywhatsapp-gateway-apiwhatsapp-webwhatsapp-web-api
fix(dashboard): keep Message Tester numbers and ids in order in RTL
Yudhi Armyndharisf596bd91f0b9
diff --git a/dashboard/src/pages/MessageTester.test.ts b/dashboard/src/pages/MessageTester.test.tsindex aa1bd832a..3d3b89026 100644--- a/dashboard/src/pages/MessageTester.test.ts+++ b/dashboard/src/pages/MessageTester.test.ts@@ -1225,3 +1225,22 @@ test('an old lookup cannot complete a new operation after signing in with the saclient.clear();sessionStorage.removeItem('openwa_api_key');});++// A phone number or chat id typed into a plain text field is laid out right to left in an Arabic or Hebrew+// page: "+62 812 3456 7890" reads "7890 3456 812 62+" and "[email protected]" splits around the at sign. The+// dashboard forces left to right on tel inputs only, so a phone field is a tel input and the fields that+// take a chat id or a mixed list say dir="ltr" themselves.+test('phone fields are tel inputs and id fields are left to right', async () => {+ stubGateway();+ renderTesterAsWriter();+ await rtl.screen.findByRole('option', { name: /Main/ });+ const attr = (id: string, name: string): string | null => byId(id).getAttribute(name);++ assert.equal(attr('mt-13', 'type'), 'tel');+ rtl.fireEvent.click(rtl.screen.getByRole('button', { name: 'Contact' }));+ assert.equal(attr('mt-7', 'type'), 'tel');+ rtl.fireEvent.click(rtl.screen.getByRole('button', { name: 'Forward' }));+ for (const id of ['mt-17', 'mt-9', 'mt-10']) assert.equal(attr(id, 'dir'), 'ltr', id);+ rtl.fireEvent.click(rtl.screen.getByRole('button', { name: 'Bulk' }));+ assert.equal(attr('mt-11', 'dir'), 'ltr');+});diff --git a/dashboard/src/pages/MessageTester.tsx b/dashboard/src/pages/MessageTester.tsxindex 36c017a02..3444b7a7a 100644--- a/dashboard/src/pages/MessageTester.tsx+++ b/dashboard/src/pages/MessageTester.tsx@@ -816,7 +816,7 @@ export function MessageTester() {<label htmlFor="mt-13">{t('messageTester.recipientPhone')}</label><inputid="mt-13"- type="text"+ type="tel"value={recipient}onChange={e => setRecipient(e.target.value)}placeholder="+62812345678"@@ -975,7 +975,7 @@ export function MessageTester() {<label htmlFor="mt-7">{t('messageTester.contactNumber')}</label><inputid="mt-7"- type="text"+ type="tel"value={contactNumber}onChange={e => setContactNumber(e.target.value)}placeholder="+62812345678"@@ -1054,6 +1054,7 @@ export function MessageTester() {<inputid="mt-17"type="text"+ dir="ltr"value={forwardFrom}onChange={e => setForwardFrom(e.target.value)}placeholder={@@ -1068,6 +1069,7 @@ export function MessageTester() {<inputid="mt-9"type="text"+ dir="ltr"value={forwardTo}onChange={e => setForwardTo(e.target.value)}placeholder={t('messageTester.forwardToPlaceholder')}@@ -1078,6 +1080,7 @@ export function MessageTester() {<inputid="mt-10"type="text"+ dir="ltr"value={forwardMessageId}onChange={e => setForwardMessageId(e.target.value)}/>@@ -1113,6 +1116,7 @@ export function MessageTester() {</div><textareaid="mt-11"+ dir="ltr"value={bulkRecipients}onChange={e => setBulkRecipients(e.target.value)}placeholder={t('messageTester.bulkRecipientsPlaceholder')}