From 86d5c71ca9ad9100559fbbc3a40538b5360762ae Mon Sep 17 00:00:00 2001 From: flisowna Date: Mon, 12 Dec 2022 22:28:07 +0300 Subject: [PATCH] clean code --- .../smartsheet/column/BarcodeOptions.vue | 5 +--- tests/playwright/tests/columnBarcode.spec.ts | 23 +++++-------------- 2 files changed, 7 insertions(+), 21 deletions(-) diff --git a/packages/nc-gui/components/smartsheet/column/BarcodeOptions.vue b/packages/nc-gui/components/smartsheet/column/BarcodeOptions.vue index 810ab30866..79de2228de 100644 --- a/packages/nc-gui/components/smartsheet/column/BarcodeOptions.vue +++ b/packages/nc-gui/components/smartsheet/column/BarcodeOptions.vue @@ -26,9 +26,7 @@ const columnsAllowedAsQrValue = computed(() => { return fields.value ?.filter( (el) => - el.fk_column_id && - // AllowedColumnTypesForQrCode.map((el) => el.toString()).includes(metaColumnById.value[el.fk_column_id].uidt), - AllowedColumnTypesForQrAndBarcodes.includes(metaColumnById.value[el.fk_column_id].uidt as UITypes), + el.fk_column_id && AllowedColumnTypesForQrAndBarcodes.includes(metaColumnById.value[el.fk_column_id].uidt as UITypes), ) .map((field) => { return { @@ -55,7 +53,6 @@ const supportedBarcodeFormats = [ onMounted(() => { // set default value vModel.value.fk_barcode_value_column_id = (column?.value?.colOptions as Record)?.fk_barcode_value_column_id || '' - // vModel.value.meta.barcode_format = (column?.value?.colOptions as Record)?.barcode_format || '' }) setAdditionalValidations({ diff --git a/tests/playwright/tests/columnBarcode.spec.ts b/tests/playwright/tests/columnBarcode.spec.ts index 18aac6e2fe..52cc5e5be2 100644 --- a/tests/playwright/tests/columnBarcode.spec.ts +++ b/tests/playwright/tests/columnBarcode.spec.ts @@ -6,15 +6,8 @@ import { GridPage } from '../pages/Dashboard/Grid'; interface ExpectedBarcodeData { referencedValue: string; barcodeSvg: string; - // barcodeSvgForModal: string; } -// interface ExpectedBarcodeDataWithOverlay extends ExpectedBarcodeData { -// barcodeSvgForModal: string; -// } - -// const ONE_SVG_BARCODE_HTML = `A Corua (La Corua)`; - test.describe('Virtual Columns', () => { let dashboard: DashboardPage; let grid: GridPage; @@ -27,7 +20,7 @@ test.describe('Virtual Columns', () => { }); test.describe('Barcode Column', () => { - const expectedBarcodeCellValues: ExpectedBarcodeData[] = [ + const initiallyExpectedBarcodeCellValues: ExpectedBarcodeData[] = [ { referencedValue: 'A Corua (La Corua)', barcodeSvg: @@ -44,16 +37,12 @@ test.describe('Virtual Columns', () => { referencedValue: 'Berlin', barcodeSvg: 'Berlin', - // barcodeSvgForOverlay: - // 'Berlin', }; const barcodeCellValuesForIstanbul = { referencedValue: 'Istanbul', barcodeSvg: 'Istanbul', - // barcodeSvgForOverlay: - // 'Berlin', }; const barcodeCode39SvgForBerlin = @@ -61,7 +50,7 @@ test.describe('Virtual Columns', () => { const expectedBarcodeCellValuesAfterCityNameChange = [ barcodeCellValuesForBerlin, - ...expectedBarcodeCellValues.slice(1), + ...initiallyExpectedBarcodeCellValues.slice(1), ]; async function barcodeColumnVerify(barcodeColumnTitle: string, expectedBarcodeCodeData: ExpectedBarcodeData[]) { @@ -74,7 +63,7 @@ test.describe('Virtual Columns', () => { } } test('creation, showing, updating value and change barcode column title and reference column', async () => { - // Add qr code column referencing the City column + // Add barcode code column referencing the City column // and compare the base64 encoded codes/src attributes for the first 3 rows. // Column data from City table (Sakila DB) /** @@ -94,7 +83,7 @@ test.describe('Virtual Columns', () => { barcodeValueColumnTitle: 'City', }); - await barcodeColumnVerify('Barcode1', expectedBarcodeCellValues); + await barcodeColumnVerify('Barcode1', initiallyExpectedBarcodeCellValues); await grid.cell.fillText({ columnHeader: 'City', index: 0, text: 'Berlin' }); @@ -105,7 +94,7 @@ test.describe('Virtual Columns', () => { await barcodeGridOverlay.verifyBarcodeSvgValue(barcodeCellValuesForBerlin.barcodeSvg); await barcodeGridOverlay.clickCloseButton(); - // Change the QR Code column title + // Change the barcode column title await grid.column.openEdit({ title: 'Barcode1' }); await grid.column.fillTitle({ title: 'Barcode1 Renamed' }); await grid.column.save({ isUpdated: true }); @@ -128,7 +117,7 @@ test.describe('Virtual Columns', () => { await dashboard.closeTab({ title: 'City' }); }); - test('deletion of the barcode column: directly and indirectly when the reference value column is deleted', async () => { + test('deletion of the barcode column: a) directly and b) indirectly when the reference value column is deleted', async () => { await dashboard.closeTab({ title: 'Team & Auth' }); await dashboard.treeView.openTable({ title: 'City' });