chore: merge master

This commit is contained in:
James
2023-07-29 11:18:39 -04:00
523 changed files with 55727 additions and 20120 deletions

View File

@@ -1,7 +1,7 @@
/* eslint-disable @typescript-eslint/ban-ts-comment */
import path from 'path';
import fs from 'fs';
import { buildConfig } from '../buildConfig';
import { buildConfigWithDefaults } from '../buildConfigWithDefaults';
import { devUser } from '../credentials';
import ArrayFields, { arrayDoc } from './collections/Array';
import BlockFields, { blocksDoc } from './collections/Blocks';
@@ -26,7 +26,7 @@ import Uploads2 from './collections/Upload2';
import Uploads3 from './collections/Uploads3';
import RowFields from './collections/Row';
export default buildConfig({
export default buildConfigWithDefaults({
admin: {
webpack: (config) => ({
...config,

View File

@@ -411,6 +411,88 @@ describe('fields', () => {
const customRowLabel = await page.locator('#rowLabelAsComponent-row-0 >> .row-label :text("custom row label")');
await expect(customRowLabel).toHaveCSS('text-transform', 'uppercase');
});
describe('row manipulation', () => {
test('should add 2 new rows', async () => {
await page.goto(url.create);
await page.locator('#field-potentiallyEmptyArray > .array-field__add-button-wrap > button').click();
await page.locator('#field-potentiallyEmptyArray > .array-field__add-button-wrap > button').click();
await page.locator('#field-potentiallyEmptyArray__0__text').fill('array row 1');
await page.locator('#field-potentiallyEmptyArray__1__text').fill('array row 2');
await saveDocAndAssert(page);
});
test('should remove 2 new rows', async () => {
await page.goto(url.create);
await page.locator('#field-potentiallyEmptyArray > .array-field__add-button-wrap > button').click();
await page.locator('#field-potentiallyEmptyArray > .array-field__add-button-wrap > button').click();
await page.locator('#field-potentiallyEmptyArray__0__text').fill('array row 1');
await page.locator('#field-potentiallyEmptyArray__1__text').fill('array row 2');
await page.locator('#potentiallyEmptyArray-row-1 .array-actions__button').click();
await page.locator('#potentiallyEmptyArray-row-1 .popup__scroll .array-actions__remove').click();
await page.locator('#potentiallyEmptyArray-row-0 .array-actions__button').click();
await page.locator('#potentiallyEmptyArray-row-0 .popup__scroll .array-actions__remove').click();
const rowsContainer = await page.locator('#field-potentiallyEmptyArray > .array-field__draggable-rows');
const directChildDivCount = await rowsContainer.evaluate((element) => {
const childDivCount = element.querySelectorAll(':scope > div');
return childDivCount.length;
});
expect(directChildDivCount).toBe(0);
});
test('should remove existing row', async () => {
await page.goto(url.create);
await page.locator('#field-potentiallyEmptyArray > .array-field__add-button-wrap > button').click();
await page.locator('#field-potentiallyEmptyArray__0__text').fill('array row 1');
await saveDocAndAssert(page);
await page.locator('#potentiallyEmptyArray-row-0 .array-actions__button').click();
await page.locator('#potentiallyEmptyArray-row-0 .popup__scroll .array-actions__action.array-actions__remove').click();
const rowsContainer = await page.locator('#field-potentiallyEmptyArray > .array-field__draggable-rows');
const directChildDivCount = await rowsContainer.evaluate((element) => {
const childDivCount = element.querySelectorAll(':scope > div');
return childDivCount.length;
});
expect(directChildDivCount).toBe(0);
});
test('should add row after removing existing row', async () => {
await page.goto(url.create);
await page.locator('#field-potentiallyEmptyArray > .array-field__add-button-wrap > button').click();
await page.locator('#field-potentiallyEmptyArray > .array-field__add-button-wrap > button').click();
await page.locator('#field-potentiallyEmptyArray__0__text').fill('array row 1');
await page.locator('#field-potentiallyEmptyArray__1__text').fill('array row 2');
await saveDocAndAssert(page);
await page.locator('#potentiallyEmptyArray-row-1 .array-actions__button').click();
await page.locator('#potentiallyEmptyArray-row-1 .popup__scroll .array-actions__action.array-actions__remove').click();
await page.locator('#field-potentiallyEmptyArray > .array-field__add-button-wrap > button').click();
await page.locator('#field-potentiallyEmptyArray__1__text').fill('updated array row 2');
await saveDocAndAssert(page);
const rowsContainer = await page.locator('#field-potentiallyEmptyArray > .array-field__draggable-rows');
const directChildDivCount = await rowsContainer.evaluate((element) => {
const childDivCount = element.querySelectorAll(':scope > div');
return childDivCount.length;
});
expect(directChildDivCount).toBe(2);
});
});
});
describe('tabs', () => {
@@ -494,7 +576,7 @@ describe('fields', () => {
await wait(200);
await editLinkModal.locator('button[type="submit"]').click();
const errorField = await page.locator('[id^=drawer_1_rich-text-link-] .render-fields > :nth-child(3)');
const hasErrorClass = await errorField.evaluate(el => el.classList.contains('error'));
const hasErrorClass = await errorField.evaluate((el) => el.classList.contains('error'));
expect(hasErrorClass).toBe(true);
});