mirror of
https://github.com/enso-org/enso.git
synced 2024-12-23 19:21:54 +03:00
057245ea5e
Part of #8518 Closes #8822 The drop downs were missing, because WidgetFunction had a higher score than them and took precedence. The fix was to adjust scores, so drop down is before both argument name and function. Generally, any widget expecting to "overlap" existing code (and possibly further widgets) should go before WidgetFunction. # Important Notes * Extended mockExpressionUpdate to accept a subexpression of a node. Also, I removed it from GraphDb - I want this function to have as little impact on app code as possible.
42 lines
1.2 KiB
TypeScript
42 lines
1.2 KiB
TypeScript
import type { Page } from '@playwright/test'
|
|
import type { ExpressionUpdate, MethodCall } from 'shared/languageServerTypes'
|
|
|
|
export type ExpressionLocator = string | { binding: string; expr: string }
|
|
|
|
/** Provide method call info for collapsed function call. */
|
|
export async function mockCollapsedFunctionInfo(
|
|
page: Page,
|
|
expression: ExpressionLocator,
|
|
functionName: string,
|
|
) {
|
|
await mockMethodCallInfo(page, expression, {
|
|
methodPointer: {
|
|
module: 'local.Mock.Main',
|
|
definedOnType: 'local.Mock.Main',
|
|
name: functionName,
|
|
},
|
|
notAppliedArguments: [],
|
|
})
|
|
}
|
|
|
|
/** Provide custom method call info for the specific node. */
|
|
export async function mockMethodCallInfo(
|
|
page: Page,
|
|
expression: ExpressionLocator,
|
|
methodCallInfo: MethodCall,
|
|
) {
|
|
await mockExpressionUpdate(page, expression, { methodCall: methodCallInfo })
|
|
}
|
|
|
|
/** Provide custom expression update for the specific node. */
|
|
export async function mockExpressionUpdate(
|
|
page: Page,
|
|
expression: ExpressionLocator,
|
|
update: Partial<ExpressionUpdate>,
|
|
) {
|
|
await page.evaluate(
|
|
({ expression, update }) => (window as any).mockExpressionUpdate(expression, update),
|
|
{ expression, update },
|
|
)
|
|
}
|