mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-03-16 14:40:50 -05:00
Add initial tests
This commit is contained in:
12
tests/cases/conformance/jsdoc/callbackTag1.ts
Normal file
12
tests/cases/conformance/jsdoc/callbackTag1.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
// @noEmit: true
|
||||
// @allowJs: true
|
||||
// @checkJs: true
|
||||
// @Filename: cb.js
|
||||
|
||||
/** @callback Sid
|
||||
* @param {string} s
|
||||
* @returns {string} What were you expecting
|
||||
*/
|
||||
|
||||
/** @type {Sid} smallId */
|
||||
var sid = s => s + "!";
|
||||
31
tests/cases/fourslash/server/jsdocCallbackTag.ts
Normal file
31
tests/cases/fourslash/server/jsdocCallbackTag.ts
Normal file
@@ -0,0 +1,31 @@
|
||||
/// <reference path="../fourslash.ts"/>
|
||||
|
||||
// @allowNonTsExtensions: true
|
||||
// @Filename: jsdocCallbackTag.js
|
||||
|
||||
//// /**
|
||||
//// * @callback FooHandler
|
||||
//// * @param {string} eventName - So many words
|
||||
//// * @param eventName2 {number | string} - Silence is golden
|
||||
//// * @param eventName3 - Osterreich mos def
|
||||
//// */
|
||||
//// /**
|
||||
//// * @type {FooHandler} callback
|
||||
//// */
|
||||
//// var t/*1*/;
|
||||
////
|
||||
//// /**
|
||||
//// * @callback FooHandler2 - What, another one?
|
||||
//// * @param {string=} eventName - it keeps happening
|
||||
//// * @param {string} [eventName2] - i WARNED you dog
|
||||
//// */
|
||||
//// /**
|
||||
//// * @type {FooHandler2} callback
|
||||
//// */
|
||||
//// var t2/*2*/;
|
||||
|
||||
|
||||
goTo.marker("1");
|
||||
verify.quickInfoIs("var t: (eventName: string, eventName2: number | string, eventName3: any) => void");
|
||||
goTo.marker("2");
|
||||
verify.quickInfoIs("var t2: (eventName?: string, eventName2?: string) => void");
|
||||
33
tests/cases/fourslash/server/jsdocCallbackTagNavigateTo.ts
Normal file
33
tests/cases/fourslash/server/jsdocCallbackTagNavigateTo.ts
Normal file
@@ -0,0 +1,33 @@
|
||||
/// <reference path="../fourslash.ts"/>
|
||||
|
||||
// @allowNonTsExtensions: true
|
||||
// @Filename: jsDocCallback.js
|
||||
|
||||
//// /**
|
||||
//// * @callback FooCallback
|
||||
//// * @param {string} eventName - What even is the navigation bar?
|
||||
//// */
|
||||
//// /** @type {FooCallback} */
|
||||
//// var t;
|
||||
|
||||
verify.navigationBar([
|
||||
{
|
||||
"text": "<global>",
|
||||
"kind": "module",
|
||||
"childItems": [
|
||||
{
|
||||
"text": "FooCallback",
|
||||
"kind": "type"
|
||||
},
|
||||
{
|
||||
"text": "t",
|
||||
"kind": "var"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"text": "FooCallback",
|
||||
"kind": "type",
|
||||
"indent": 1
|
||||
}
|
||||
])
|
||||
15
tests/cases/fourslash/server/jsdocCallbackTagRename01.ts
Normal file
15
tests/cases/fourslash/server/jsdocCallbackTagRename01.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
/// <reference path="../fourslash.ts"/>
|
||||
|
||||
// @allowNonTsExtensions: true
|
||||
// @Filename: jsDocCallback.js
|
||||
////
|
||||
//// /**
|
||||
//// * @callback [|FooCallback|]
|
||||
//// * @param {string} eventName - Rename should work
|
||||
//// */
|
||||
////
|
||||
//// /** @type {/*1*/[|FooCallback|]} */
|
||||
//// var t;
|
||||
|
||||
const ranges = test.ranges();
|
||||
verify.renameLocations(ranges[0], { findInStrings: false, findInComments: true, ranges });
|
||||
Reference in New Issue
Block a user