chore: perform e2e rebase test (#33390)

This commit is contained in:
Pavel Feldman 2024-11-01 12:25:05 -07:00 committed by GitHub
parent 3b4b8f9e49
commit fc0ce7046b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 43 additions and 1 deletions

View File

@ -48,3 +48,14 @@ test('setExpanded is called', async ({ mount }) => {
await component.getByText('Title').click(); await component.getByText('Title').click();
expect(expandedValues).toEqual([true]); expect(expandedValues).toEqual([true]);
}); });
test('setExpanded should work', async ({ mount }) => {
const component = await mount(<AutoChip header='Title' initialExpanded={false}>
Body
</AutoChip>);
await component.getByText('Title').click();
await expect(component).toMatchAriaSnapshot(`
- button "Title" [expanded]
- region: Body
`);
});

View File

@ -32,6 +32,8 @@ export const Chip: React.FC<{
}> = ({ header, expanded, setExpanded, children, noInsets, dataTestId, targetRef }) => { }> = ({ header, expanded, setExpanded, children, noInsets, dataTestId, targetRef }) => {
return <div className='chip' data-testid={dataTestId} ref={targetRef}> return <div className='chip' data-testid={dataTestId} ref={targetRef}>
<div <div
role='button'
aria-expanded={!!expanded}
className={clsx('chip-header', setExpanded && ' expanded-' + expanded)} className={clsx('chip-header', setExpanded && ' expanded-' + expanded)}
onClick={() => setExpanded?.(!expanded)} onClick={() => setExpanded?.(!expanded)}
title={typeof header === 'string' ? header : undefined}> title={typeof header === 'string' ? header : undefined}>
@ -39,7 +41,7 @@ export const Chip: React.FC<{
{setExpanded && !expanded && icons.rightArrow()} {setExpanded && !expanded && icons.rightArrow()}
{header} {header}
</div> </div>
{(!setExpanded || expanded) && <div className={clsx('chip-body', noInsets && 'chip-body-no-insets')}>{children}</div>} {(!setExpanded || expanded) && <div role='region' className={clsx('chip-body', noInsets && 'chip-body-no-insets')}>{children}</div>}
</div>; </div>;
}; };

View File

@ -16,6 +16,7 @@
import * as fs from 'fs'; import * as fs from 'fs';
import { test, expect, playwrightCtConfigText } from './playwright-test-fixtures'; import { test, expect, playwrightCtConfigText } from './playwright-test-fixtures';
import { execSync } from 'child_process';
test.describe.configure({ mode: 'parallel' }); test.describe.configure({ mode: 'parallel' });
@ -47,6 +48,10 @@ test('should update snapshot with the update-snapshots flag', async ({ runInline
}); });
`); `);
execSync(`patch -p1 < ${patchPath}`, { cwd: testInfo.outputPath() });
const result2 = await runInlineTest({});
expect(result2.exitCode).toBe(0);
}); });
test('should update missing snapshots', async ({ runInlineTest }, testInfo) => { test('should update missing snapshots', async ({ runInlineTest }, testInfo) => {
@ -76,6 +81,10 @@ test('should update missing snapshots', async ({ runInlineTest }, testInfo) => {
}); });
`); `);
execSync(`patch -p1 < ${patchPath}`, { cwd: testInfo.outputPath() });
const result2 = await runInlineTest({});
expect(result2.exitCode).toBe(0);
}); });
test('should generate baseline with regex', async ({ runInlineTest }, testInfo) => { test('should generate baseline with regex', async ({ runInlineTest }, testInfo) => {
@ -126,6 +135,10 @@ test('should generate baseline with regex', async ({ runInlineTest }, testInfo)
}); });
`); `);
execSync(`patch -p1 < ${patchPath}`, { cwd: testInfo.outputPath() });
const result2 = await runInlineTest({});
expect(result2.exitCode).toBe(0);
}); });
test('should generate baseline with special characters', async ({ runInlineTest }, testInfo) => { test('should generate baseline with special characters', async ({ runInlineTest }, testInfo) => {
@ -168,6 +181,10 @@ test('should generate baseline with special characters', async ({ runInlineTest
}); });
`); `);
execSync(`patch -p1 < ${patchPath}`, { cwd: testInfo.outputPath() });
const result2 = await runInlineTest({});
expect(result2.exitCode).toBe(0);
}); });
test('should update missing snapshots in tsx', async ({ runInlineTest }, testInfo) => { test('should update missing snapshots in tsx', async ({ runInlineTest }, testInfo) => {
@ -207,6 +224,10 @@ test('should update missing snapshots in tsx', async ({ runInlineTest }, testInf
}); });
`); `);
execSync(`patch -p1 < ${patchPath}`, { cwd: testInfo.outputPath() });
const result2 = await runInlineTest({});
expect(result2.exitCode).toBe(0);
}); });
test('should update multiple files', async ({ runInlineTest }, testInfo) => { test('should update multiple files', async ({ runInlineTest }, testInfo) => {
@ -269,6 +290,10 @@ test('should update multiple files', async ({ runInlineTest }, testInfo) => {
}); });
`); `);
execSync(`patch -p1 < ${patchPath}`, { cwd: testInfo.outputPath() });
const result2 = await runInlineTest({});
expect(result2.exitCode).toBe(0);
}); });
test('should generate baseline for input values', async ({ runInlineTest }, testInfo) => { test('should generate baseline for input values', async ({ runInlineTest }, testInfo) => {
@ -298,4 +323,8 @@ test('should generate baseline for input values', async ({ runInlineTest }, test
}); });
`); `);
execSync(`patch -p1 < ${patchPath}`, { cwd: testInfo.outputPath() });
const result2 = await runInlineTest({});
expect(result2.exitCode).toBe(0);
}); });