Fix a bunch of auto-complete issues
This commit is contained in:
@@ -37,6 +37,10 @@ describe("expressions", () => {
|
||||
expect(test("${{ github.| == 'test' }}")).toBe(" github.");
|
||||
expect(test("test ${{ github.| == 'test' }}")).toBe(" github.");
|
||||
expect(test("${{ vars }} ${{ gh |}}")).toBe(" gh ");
|
||||
|
||||
expect(test("${{ test.|")).toBe(" test.");
|
||||
expect(test("${{ test.| }}")).toBe(" test.");
|
||||
expect(test("${{ 1 == (test.|)")).toBe(" 1 == (test.");
|
||||
});
|
||||
|
||||
describe("top-level auto-complete", () => {
|
||||
@@ -58,6 +62,16 @@ describe("expressions", () => {
|
||||
]);
|
||||
});
|
||||
|
||||
it("within parentheses", async () => {
|
||||
const result = await complete(
|
||||
...getPositionFromCursor("run-name: ${{ 1 == (github.|) }}"),
|
||||
undefined,
|
||||
contextProviderConfig
|
||||
);
|
||||
|
||||
expect(result.map(x => x.label)).toEqual(["event"]);
|
||||
});
|
||||
|
||||
it("contains description", async () => {
|
||||
const input = "run-name: ${{ github.| }}";
|
||||
const result = await complete(...getPositionFromCursor(input), undefined, undefined);
|
||||
@@ -202,6 +216,25 @@ jobs:
|
||||
});
|
||||
});
|
||||
|
||||
it("nested with parentheses", async () => {
|
||||
const input = `on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
test:
|
||||
type: string
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
foo: '{}'
|
||||
steps:
|
||||
- name: "\${{ fromJSON('test') == (inputs.|) }}"`;
|
||||
const result = await complete(...getPositionFromCursor(input), undefined, contextProviderConfig);
|
||||
|
||||
expect(result.map(x => x.label)).toEqual(["test"]);
|
||||
});
|
||||
|
||||
it("nested auto-complete", async () => {
|
||||
const input = "run-name: ${{ github.| }}";
|
||||
const result = await complete(...getPositionFromCursor(input), undefined, contextProviderConfig);
|
||||
|
||||
Reference in New Issue
Block a user