🎥 Make videos programmatically with React
test(studio): verify copied folder agent context
Sung Joo Kim828d24c56ac4
diff --git a/packages/studio/src/test/folder-menu-items.test.ts b/packages/studio/src/test/folder-menu-items.test.tsindex 0fb7b08d75..a66a7013fd 100644--- a/packages/studio/src/test/folder-menu-items.test.ts+++ b/packages/studio/src/test/folder-menu-items.test.ts@@ -6,6 +6,10 @@ const originalWindowDescriptor = Object.getOwnPropertyDescriptor(globalThis,'window',);+const originalNavigatorDescriptor = Object.getOwnPropertyDescriptor(+ globalThis,+ 'navigator',+);afterEach(() => {if (originalWindowDescriptor) {@@ -13,6 +17,12 @@ afterEach(() => {} else {Reflect.deleteProperty(globalThis, 'window');}++ if (originalNavigatorDescriptor) {+ Object.defineProperty(globalThis, 'navigator', originalNavigatorDescriptor);+ } else {+ Reflect.deleteProperty(globalThis, 'navigator');+ }});test('read-only folder menus keep navigation and copy actions enabled', () => {@@ -23,9 +33,21 @@ test('read-only folder menus keep navigation and copy actions enabled', () => {remotion_editorName: 'Code',},});+ const copiedTexts: string[] = [];+ Object.defineProperty(globalThis, 'navigator', {+ configurable: true,+ value: {+ clipboard: {+ writeText: (text: string) => {+ copiedTexts.push(text);+ return Promise.resolve();+ },+ },+ },+ });const folder = {name: 'Nested',- parent: null,+ parent: 'Parent',stack: 'stack',} as _InternalTypes['TFolder'];const resolvedLocation: ResolvedStackLocation = {@@ -53,7 +75,10 @@ test('read-only folder menus keep navigation and copy actions enabled', () => {};expect(itemById('show-folder-in-editor').disabled).toBe(false);- expect(itemById('copy-context-for-agents').disabled).toBe(false);+ const copyContextItem = itemById('copy-context-for-agents');+ expect(copyContextItem.disabled).toBe(false);+ copyContextItem.onClick('copy-context-for-agents', null);+ expect(copiedTexts).toEqual(['Parent/Nested in src/Root.tsx:10']);expect(itemById('copy-folder-file-location').disabled).toBe(false);expect(itemById('copy-folder-id').disabled).toBe(false);expect(itemById('new-composition-in-folder').disabled).toBe(true);