mirror of
https://github.com/CorentinTh/it-tools.git
synced 2025-04-24 00:36:14 -04:00
refactor(c-key-value-list): got rid of table for layout (#611)
This commit is contained in:
parent
c7d4562d3b
commit
7ab9204e96
6 changed files with 49 additions and 33 deletions
|
@ -1,14 +1,15 @@
|
|||
import { type Page, expect, test } from '@playwright/test';
|
||||
import _ from 'lodash';
|
||||
|
||||
async function extractIbanInfo({ page }: { page: Page }) {
|
||||
const tdHandles = await page.locator('table tr td').elementHandles();
|
||||
const tdTextContents = await Promise.all(tdHandles.map(el => el.textContent()));
|
||||
const itemsLines = await page
|
||||
.locator('.c-key-value-list__item').all();
|
||||
|
||||
return _.chain(tdTextContents)
|
||||
.map(tdTextContent => tdTextContent?.trim().replace(' Copy to clipboard', ''))
|
||||
.chunk(2)
|
||||
.value();
|
||||
return await Promise.all(
|
||||
itemsLines.map(async item => [
|
||||
(await item.locator('.c-key-value-list__key').textContent() ?? '').trim(),
|
||||
(await item.locator('.c-key-value-list__value').textContent() ?? '').trim(),
|
||||
]),
|
||||
);
|
||||
}
|
||||
|
||||
test.describe('Tool - Iban validator and parser', () => {
|
||||
|
@ -41,7 +42,7 @@ test.describe('Tool - Iban validator and parser', () => {
|
|||
|
||||
expect(ibanInfo).toEqual([
|
||||
['Is IBAN valid ?', 'No'],
|
||||
['IBAN errors', 'Wrong account bank branch checksumWrong IBAN checksum Copy to clipboard'],
|
||||
['IBAN errors', 'Wrong account bank branch checksum Wrong IBAN checksum'],
|
||||
['Is IBAN a QR-IBAN ?', 'No'],
|
||||
['Country code', 'N/A'],
|
||||
['BBAN', 'N/A'],
|
||||
|
|
|
@ -60,7 +60,7 @@ const ibanExamples = [
|
|||
<div>
|
||||
<c-input-text v-model:value="rawIban" placeholder="Enter an IBAN to check for validity..." test-id="iban-input" />
|
||||
|
||||
<c-key-value-list :items="ibanInfo" my-5 />
|
||||
<c-key-value-list :items="ibanInfo" my-5 data-test-id="iban-info" />
|
||||
|
||||
<c-card title="Valid IBAN examples">
|
||||
<div v-for="iban in ibanExamples" :key="iban">
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue