Skip to content

Commit

Permalink
chore: merge next into corel
Browse files Browse the repository at this point in the history
  • Loading branch information
jordanl17 committed Jan 16, 2025
1 parent 287f032 commit a179930
Show file tree
Hide file tree
Showing 20 changed files with 557 additions and 348 deletions.
2 changes: 2 additions & 0 deletions .github/renovate.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
"@sanity/insert-menu",
"@sanity/mutate",
"@sanity/presentation",
"@sanity/template-validator",
"@sanity/ui",
"get-it",
"groq-js",
Expand All @@ -73,6 +74,7 @@
"@sanity/mutate",
"@sanity/pkg-utils",
"@sanity/presentation",
"@sanity/template-validator",
"@sanity/tsdoc",
"@sanity/ui",
"esbuild",
Expand Down
13 changes: 7 additions & 6 deletions .github/workflows/e2e-ct.yml
Original file line number Diff line number Diff line change
Expand Up @@ -152,10 +152,10 @@ jobs:
NODE_OPTIONS: --max_old_space_size=8192
run: pnpm --filter sanity test:ct --project ${{ matrix.project }} --shard ${{ matrix.shardIndex }}/${{ matrix.shardTotal }}

- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
if: always()
with:
name: playwright-ct-report
name: playwright-ct-report-${{ matrix.project }}-${{ matrix.shardIndex }}
path: ${{ github.workspace }}/packages/sanity/blob-report
retention-days: 30

Expand Down Expand Up @@ -198,9 +198,10 @@ jobs:
run: pnpm install

- name: Download blob reports from Github Actions Artifacts
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: playwright-ct-report
pattern: playwright-ct-report-*
merge-multiple: true
path: ${{ github.workspace }}/packages/sanity/playwright-ct/playwright-ct-report

- name: Merge into HTML Report
Expand Down Expand Up @@ -229,10 +230,10 @@ jobs:
comment_tag: "playwright-ct-report"
filePath: ${{ github.workspace }}/packages/sanity/playwright-ct/playwright-ct-report/playwright-report-pr-comment.md

- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
if: always()
with:
name: playwright-ct-report
name: full-playwright-ct-report
path: |
${{ github.workspace }}/packages/sanity/playwright-ct/report
${{ github.workspace }}/packages/sanity/playwright-ct/playwright-ct-report
Expand Down
13 changes: 7 additions & 6 deletions .github/workflows/e2e-ui.yml
Original file line number Diff line number Diff line change
Expand Up @@ -293,10 +293,10 @@ jobs:
SANITY_E2E_DATASET: pr-${{ matrix.project }}-${{ github.event.number }}
run: pnpm test:e2e --project ${{ matrix.project }} --shard ${{ matrix.shardIndex }}/${{ matrix.shardTotal }}

- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
if: always()
with:
name: playwright-report
name: playwright-report-${{ matrix.project }}-${{ matrix.shardIndex }}
path: blob-report
retention-days: 30
merge-reports:
Expand Down Expand Up @@ -340,18 +340,19 @@ jobs:
run: pnpm install

- name: Download blob reports from Github Actions Artifacts
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: playwright-report
pattern: playwright-report-*
merge-multiple: true
path: playwright-report

- name: Merge into HTML Report
run: npx playwright merge-reports --reporter html ./playwright-report

- name: Upload HTML report
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: html-report--attempt-${{ github.run_attempt }}
name: full-html-report--attempt-${{ github.run_attempt }}
path: playwright-report
retention-days: 30

Expand Down
13 changes: 7 additions & 6 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -215,10 +215,10 @@ jobs:
SANITY_E2E_DATASET: pr-${{ matrix.project }}-${{ github.event.number }}
run: pnpm test:e2e --project ${{ matrix.project }} --shard ${{ matrix.shardIndex }}/${{ matrix.shardTotal }}

- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
if: always()
with:
name: playwright-report
name: playwright-report-${{ matrix.project }}-${{ matrix.shardIndex }}
path: blob-report
retention-days: 30
merge-reports:
Expand Down Expand Up @@ -260,18 +260,19 @@ jobs:
run: pnpm install

- name: Download blob reports from Github Actions Artifacts
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: playwright-report
pattern: playwright-report-*
merge-multiple: true
path: playwright-report

- name: Merge into HTML Report
run: npx playwright merge-reports --reporter html ./playwright-report

- name: Upload HTML report
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: html-report--attempt-${{ github.run_attempt }}
name: full-html-report--attempt-${{ github.run_attempt }}
path: playwright-report
retention-days: 30

Expand Down
9 changes: 5 additions & 4 deletions .github/workflows/efps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,10 @@ jobs:
RECORD_VIDEO: ${{ github.event.inputs.record_video || false }}
run: pnpm efps:test -- -- --shard ${{ matrix.shardIndex }}/${{ matrix.shardTotal }}

- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
if: always()
with:
name: efps-report
name: efps-report-${{ matrix.shardIndex }}
path: ${{ github.workspace }}/perf/efps/results/
retention-days: 30

Expand Down Expand Up @@ -138,9 +138,10 @@ jobs:
run: pnpm install

- name: Download blob reports from Github Actions Artifacts
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: efps-report
pattern: efps-report-*
merge-multiple: true
path: perf/efps/results

- name: Write report
Expand Down
2 changes: 1 addition & 1 deletion dev/embedded-studio/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"styled-components": "^6.1.0"
},
"devDependencies": {
"@types/react": "^19.0.6",
"@types/react": "^19.0.7",
"@types/react-dom": "^19.0.3",
"@vitejs/plugin-react": "^4.3.4",
"typescript": "5.7.3",
Expand Down
2 changes: 1 addition & 1 deletion dev/test-studio/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
"@sanity/util": "workspace:*",
"@sanity/uuid": "^3.0.1",
"@sanity/vision": "workspace:*",
"@sanity/visual-editing": "2.12.1",
"@sanity/visual-editing": "2.12.2",
"@turf/helpers": "^6.0.1",
"@turf/points-within-polygon": "^5.1.5",
"@vercel/stega": "0.1.2",
Expand Down
8 changes: 8 additions & 0 deletions dev/test-studio/schema/debug/simpleReferences.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,13 @@ export const simpleReferences = {
type: 'reference',
to: [{type: 'simpleReferences'}],
},
{
name: 'referenceFieldWeak',
title: 'Reference field',
description: 'A simple reference field where weak is set to true',
type: 'reference',
weak: true,
to: [{type: 'simpleReferences'}],
},
],
}
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,25 @@ test.describe('Portable Text Input', () => {
// Expect the editor to have focus after closing the popover
await expect($pte).toBeFocused()

const $toolbarPopover = page.getByTestId('annotation-toolbar-popover')

// Assertion: the annotation toolbar popover should be visible
await expect(page.getByTestId('annotation-toolbar-popover')).toBeVisible()
await expect($toolbarPopover).toBeVisible()

// Assertion: tab works to get to the toolbar popover buttons
await page.keyboard.press('Tab')
await expect(page.getByTestId('edit-annotation-button')).toBeFocused()
await page.keyboard.press('Tab')
await expect(page.getByTestId('remove-annotation-button')).toBeFocused()
await page.keyboard.press('Escape')
await expect($pte).toBeFocused()
await expect($toolbarPopover).toBeVisible()
await page.waitForTimeout(100)
await page.keyboard.press('Escape')
await page.waitForTimeout(100)
// Assertion: escape closes the toolbar popover
await expect($toolbarPopover).not.toBeVisible()
})

test('Can create, and then open the existing annotation again for editing', async ({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ test.describe('Portable Text Input', () => {
const $portableTextInput = component.getByTestId('field-body')
const $pteTextbox = $portableTextInput.getByRole('textbox')
await expect($pteTextbox).not.toBeFocused()
await page.keyboard.press('Tab+Tab')
const blockObjectInput = page.getByTestId('objectBlockInputField').getByRole('textbox')
await expect(blockObjectInput).toBeFocused()
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,32 @@ test.describe('Portable Text Input', () => {
await expect($pte.getByText('Custom preview block:')).toBeVisible()
})

test('Inline object toolbars works as expected', async ({mount, page}) => {
const {getFocusedPortableTextEditor} = testHelpers({page})
await mount(<ObjectBlockStory />)
const $pte = await getFocusedPortableTextEditor('field-body')
await page.getByRole('button', {name: 'Insert Inline Object (inline)'}).click()
// Assertion: the annotation toolbar popover should not be visible
await expect(page.getByTestId('inline-object-toolbar-popover')).not.toBeVisible()
const $locatorDialog = page.getByTestId('popover-edit-dialog')
// Assertion: Object edit dialog should be visible
await expect($locatorDialog).toBeVisible()
await page.keyboard.press('Escape')
// Assertion: the annotation toolbar popover should be visible
await expect(page.getByTestId('inline-object-toolbar-popover')).toBeVisible()
// Assertion: tab works to get to the toolbar popover buttons
await page.keyboard.press('Tab')
await expect(page.getByTestId('edit-inline-object-button')).toBeFocused()
await page.keyboard.press('Tab')
await expect(page.getByTestId('remove-inline-object-button')).toBeFocused()
await page.keyboard.press('Escape')
await expect(page.getByTestId('edit-inline-object-button')).toBeVisible()
await expect($pte).toBeFocused()
await page.keyboard.press('Escape')
// Assertion: escape closes the toolbar popover
await expect(page.getByTestId('inline-object-toolbar-popover')).not.toBeVisible()
})

test('Double-clicking opens a block', async ({mount, page}) => {
const {getFocusedPortableTextEditor} = testHelpers({page})
await mount(<ObjectBlockStory />)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {PortableTextEditor, usePortableTextEditor} from '@portabletext/editor'
import {type ObjectSchemaType, type Path, type PortableTextObject} from '@sanity/types'
import {isEqual} from '@sanity/util/paths'
import {type ComponentType, type ReactNode, useCallback, useMemo, useState} from 'react'
import {type ComponentType, useCallback, useMemo, useState} from 'react'

import {Tooltip} from '../../../../../ui-components'
import {pathToString} from '../../../../field'
Expand Down Expand Up @@ -54,7 +54,7 @@ interface AnnotationProps {
value: PortableTextObject
}

export function Annotation(props: AnnotationProps): ReactNode {
export function Annotation(props: AnnotationProps): React.JSX.Element {
const {
children,
editorNodeFocused,
Expand Down Expand Up @@ -241,7 +241,7 @@ export function Annotation(props: AnnotationProps): ReactNode {
)
}

export const DefaultAnnotationComponent = (props: BlockAnnotationProps) => {
export const DefaultAnnotationComponent = (props: BlockAnnotationProps): React.JSX.Element => {
const {
__unstable_floatingBoundary: floatingBoundary,
__unstable_referenceBoundary: referenceBoundary,
Expand All @@ -252,8 +252,8 @@ export const DefaultAnnotationComponent = (props: BlockAnnotationProps) => {
onRemove,
open,
readOnly,
selected,
schemaType,
selected,
textElement,
validation,
} = props
Expand All @@ -264,6 +264,7 @@ export const DefaultAnnotationComponent = (props: BlockAnnotationProps) => {
const isReady = Boolean(children)

const {t} = useTranslation()

const toneKey = useMemo(() => {
if (hasError) {
return 'critical'
Expand Down Expand Up @@ -294,11 +295,11 @@ export const DefaultAnnotationComponent = (props: BlockAnnotationProps) => {
<AnnotationToolbarPopover
annotationOpen={open}
floatingBoundary={floatingBoundary}
onOpen={onOpen}
onRemove={onRemove}
onOpenAnnotation={onOpen}
onRemoveAnnotation={onRemove}
referenceBoundary={referenceBoundary}
referenceElement={referenceElement}
selected={selected}
annotationTextSelected={selected}
title={
schemaType.i18nTitleKey
? t(schemaType.i18nTitleKey)
Expand Down
Loading

0 comments on commit a179930

Please sign in to comment.