Skip to content

Commit

Permalink
Merge branch 'next' into corel
Browse files Browse the repository at this point in the history
  • Loading branch information
jordanl17 committed Jan 16, 2025
2 parents 4d7ea9e + c0d26c0 commit 0b96e34
Show file tree
Hide file tree
Showing 25 changed files with 1,357 additions and 1,132 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
4 changes: 2 additions & 2 deletions dev/embedded-studio/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@
"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",
"vite": "^5.4.11"
"vite": "^6.0.7"
}
}
4 changes: 2 additions & 2 deletions 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 All @@ -67,6 +67,6 @@
"@million/lint": "1.0.14",
"babel-plugin-react-compiler": "19.0.0-beta-e552027-20250112",
"chokidar": "^3.6.0",
"vite": "^5.4.11"
"vite": "^6.0.7"
}
}
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'}],
},
],
}
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@
"semver": "^7.3.5",
"turbo": "^2.3.3",
"typescript": "5.7.3",
"vite": "^5.4.11",
"vite": "^6.0.7",
"vite-tsconfig-paths": "^4.3.2",
"vitest": "^2.1.8",
"yargs": "^17.3.0"
Expand All @@ -190,7 +190,8 @@
"@npmcli/arborist": "^7.5.4",
"@sanity/ui@2": "$@sanity/ui",
"@typescript-eslint/eslint-plugin": "$@typescript-eslint/eslint-plugin",
"@typescript-eslint/parser": "$@typescript-eslint/parser"
"@typescript-eslint/parser": "$@typescript-eslint/parser",
"vite": "$vite"
}
},
"isSanityMonorepo": true
Expand Down
2 changes: 1 addition & 1 deletion packages/@sanity/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@
"semver": "^7.3.5",
"semver-compare": "^1.0.0",
"tar": "^6.1.11",
"vite": "^5.4.11",
"vite": "^6.0.7",
"vitest": "^2.1.8",
"which": "^2.0.2",
"xdg-basedir": "^4.0.0"
Expand Down
2 changes: 1 addition & 1 deletion packages/@sanity/types/src/schema/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,7 @@ export interface ObjectSchemaType extends BaseSchemaType {
// string/number array in the schema normalization/compilation step
// a path segment is a number when specified like array.0.prop in preview config.
/** @deprecated Unused. Use the new field-level search config. */
__experimental_search: {path: (string | number)[]; weight: number; mapWith?: string}[]
__experimental_search?: {path: (string | number)[]; weight: number; mapWith?: string}[]
/** @alpha */
__experimental_omnisearch_visibility?: boolean
/** @alpha */
Expand Down
2 changes: 1 addition & 1 deletion packages/sanity/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@
"use-effect-event": "^1.0.2",
"use-hot-module-reload": "^2.0.0",
"use-sync-external-store": "^1.2.0",
"vite": "^5.4.11",
"vite": "^6.0.7",
"yargs": "^17.3.0"
},
"devDependencies": {
Expand Down
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 0b96e34

Please sign in to comment.