mirror of
https://github.com/enso-org/enso.git
synced 2024-11-27 16:02:00 +03:00
Fix vector widget in non-argument literal (#8972)
Fix vector widget not appearing in non-argument list literals. Added tests for showing widgets for various literals.
This commit is contained in:
parent
427f5b0410
commit
e88d8d8756
@ -86,13 +86,13 @@ test('Collapsing nodes', async ({ page }) => {
|
||||
const secondCollapsedNode = locate.graphNodeByBinding(page, 'ten')
|
||||
await expect(secondCollapsedNode.locator('.WidgetToken')).toHaveText(['Main', '.', 'collapsed1'])
|
||||
await mockCollapsedFunctionInfo(page, 'ten', 'collapsed1')
|
||||
secondCollapsedNode.dblclick()
|
||||
await secondCollapsedNode.dblclick()
|
||||
await expect(locate.graphNode(page)).toHaveCount(2)
|
||||
await customExpect.toExist(locate.graphNodeByBinding(page, 'ten'))
|
||||
})
|
||||
|
||||
async function expectInsideMain(page: Page) {
|
||||
await expect(locate.graphNode(page)).toHaveCount(9)
|
||||
await expect(locate.graphNode(page)).toHaveCount(10)
|
||||
await customExpect.toExist(locate.graphNodeByBinding(page, 'five'))
|
||||
await customExpect.toExist(locate.graphNodeByBinding(page, 'ten'))
|
||||
await customExpect.toExist(locate.graphNodeByBinding(page, 'sum'))
|
||||
|
@ -27,6 +27,23 @@ class DropDownLocator {
|
||||
}
|
||||
}
|
||||
|
||||
test('Widget in plain AST', async ({ page }) => {
|
||||
await actions.goToGraph(page)
|
||||
const numberNode = locate.graphNodeByBinding(page, 'five')
|
||||
const numberWidget = numberNode.locator('.WidgetNumber')
|
||||
await expect(numberWidget).toBeVisible()
|
||||
await expect(numberWidget.locator('.value')).toHaveValue('5')
|
||||
|
||||
const listNode = locate.graphNodeByBinding(page, 'list')
|
||||
const listWidget = listNode.locator('.WidgetVector')
|
||||
await expect(listWidget).toBeVisible()
|
||||
|
||||
const textNode = locate.graphNodeByBinding(page, 'text')
|
||||
const textWidget = textNode.locator('.WidgetText')
|
||||
await expect(textWidget).toBeVisible()
|
||||
await expect(textWidget.locator('.value')).toHaveValue("'test'")
|
||||
})
|
||||
|
||||
test('Selection widgets in Data.read node', async ({ page }) => {
|
||||
await actions.goToGraph(page)
|
||||
await mockMethodCallInfo(page, 'data', {
|
||||
|
@ -58,6 +58,7 @@ main =
|
||||
prod = sum * 3
|
||||
final = Main.func1 prod
|
||||
list = []
|
||||
text = 'test'
|
||||
|
||||
# Widget tests
|
||||
data = Data.read
|
||||
|
@ -46,7 +46,7 @@ export default defineConfig({
|
||||
use: {
|
||||
headless: !DEBUG,
|
||||
trace: 'on-first-retry',
|
||||
viewport: { width: 1920, height: 1200 },
|
||||
viewport: { width: 1920, height: 1600 },
|
||||
...(DEBUG
|
||||
? {}
|
||||
: {
|
||||
|
@ -54,9 +54,11 @@ export const widgetDefinition = defineWidget(WidgetInput.isAstOrPlaceholder, {
|
||||
if (props.input.dynamicConfig?.kind === 'Vector_Editor') return Score.Perfect
|
||||
else if (props.input.expectedType?.startsWith('Standard.Base.Data.Vector.Vector'))
|
||||
return Score.Good
|
||||
else if (props.input.value instanceof Ast.Ast)
|
||||
return props.input.value.children().next().value.code === '[' ? Score.Perfect : Score.Mismatch
|
||||
else return Score.Mismatch
|
||||
else if (props.input.value instanceof Ast.Ast) {
|
||||
return props.input.value.children().next().value.code() === '['
|
||||
? Score.Perfect
|
||||
: Score.Mismatch
|
||||
} else return Score.Mismatch
|
||||
},
|
||||
})
|
||||
</script>
|
||||
|
Loading…
Reference in New Issue
Block a user