diff --git a/tests/cases/fourslash/ambientShorthandFindAllRefs.ts b/tests/cases/fourslash/ambientShorthandFindAllRefs.ts new file mode 100644 index 00000000000..16fddd1869d --- /dev/null +++ b/tests/cases/fourslash/ambientShorthandFindAllRefs.ts @@ -0,0 +1,21 @@ +/// + +// @Filename: declarations.d.ts +////declare module "jquery"; + +// @Filename: user.ts +////import {[|x|]} from "jquery"; + +// @Filename: user2.ts +////import {[|x|]} from "jquery"; + +let ranges = test.ranges(); +for (let range of ranges) { + goTo.file(range.fileName); + goTo.position(range.start); + + verify.referencesCountIs(ranges.length); + for (let expectedRange of ranges) { + verify.referencesAtPositionContains(expectedRange); + } +} diff --git a/tests/cases/fourslash/ambientShorthandGotoDefinition.ts b/tests/cases/fourslash/ambientShorthandGotoDefinition.ts new file mode 100644 index 00000000000..970b87f8ec2 --- /dev/null +++ b/tests/cases/fourslash/ambientShorthandGotoDefinition.ts @@ -0,0 +1,39 @@ +/// + +// @Filename: declarations.d.ts +/////*module*/declare module "jquery" + +// @Filename: user.ts +/////// +////import /*importFoo*/foo, {bar} from "jquery"; +////import /*importBaz*/* as /*idBaz*/baz from "jquery"; +/////*importBang*/import /*idBang*/bang = require("jquery"); +////foo/*useFoo*/(bar/*useBar*/, baz/*useBaz*/, bang/*useBang*/); + +goTo.marker("useFoo"); +verify.quickInfoIs("import foo"); +goTo.definition(); +verify.caretAtMarker("importFoo"); +goTo.definition(); +verify.caretAtMarker("module"); + +goTo.marker("useBar"); +verify.quickInfoIs("import bar"); +goTo.definition(); +verify.caretAtMarker("module"); + +goTo.marker("useBaz"); +verify.quickInfoIs("import baz"); +goTo.definition(); +verify.caretAtMarker("importBaz"); +goTo.marker("idBaz"); +goTo.definition(); +verify.caretAtMarker("module"); + +goTo.marker("useBang"); +verify.quickInfoIs("import bang = require(\"jquery\")"); +goTo.definition(); +verify.caretAtMarker("importBang"); +goTo.marker("idBang"); +goTo.definition(); +verify.caretAtMarker("module");