define(function(require,exports,module){const SpecRunnerUtils=brackets.getModule("spec/SpecRunnerUtils"),CASES=[{file:"a.js",line:0,ch:3,content:"/**\nfunction add(a, b) {\n}\n",expect:["@param {*} a","@param {*} b","@returns {*}"]},{file:"b.ts",line:0,ch:3,content:"/**\nfunction add(a: number, b: number): number {\n}\n",expect:["@param a","@param b","@returns"],absent:["@param {","{number}"]},{file:"c.ts",line:0,ch:3,content:"/**\nfunction run(items: T[], cb: (x: T) => void): Promise {\n}\n",expect:["@param items","@param cb","@returns"],absent:["@param {","{T[]}","{*}"]},{file:"a.php",line:1,ch:3,content:"0})}beforeAll(async function(){testWindow=await SpecRunnerUtils.createTestWindowAndRun(),$=testWindow.$,CommandManager=testWindow.brackets.test.CommandManager,Commands=testWindow.brackets.test.Commands,EditorManager=testWindow.brackets.test.EditorManager,FileSystem=testWindow.brackets.test.FileSystem,tempDir=await SpecRunnerUtils.getTempDirectory(),await SpecRunnerUtils.ensureExistsDirAsync(tempDir);for(const tc of CASES)await jsPromise(SpecRunnerUtils.createTextFile(tempDir+"/"+tc.file,tc.content,FileSystem));await SpecRunnerUtils.loadProjectInTestWindow(tempDir)},3e4),afterAll(async function(){testWindow=$=CommandManager=Commands=EditorManager=FileSystem=null,await SpecRunnerUtils.closeTestWindow()},3e4),CASES.forEach(function(tc){it("shows the popup and inserts the right doc comment for "+tc.file,async function(){await awaitsForDone(SpecRunnerUtils.openProjectFiles([tc.file]),"open "+tc.file);const editor=EditorManager.getActiveEditor();editor.setCursorPos(tc.line,tc.ch),CommandManager.execute(Commands.SHOW_CODE_HINTS,editor),await awaitsFor(function(){return $docHint().length>0},"doc-comment hint popup for "+tc.file,5e3);const $a=$docHint();$a.first().trigger("mousedown"),$a.first().trigger("click"),await awaitsFor(function(){const text=editor.document.getText();return tc.expect.every(function(frag){return-1!==text.indexOf(frag)})},"inserted doc comment for "+tc.file,5e3);const text=editor.document.getText();tc.expect.forEach(function(frag){expect(-1!==text.indexOf(frag)).toBe(!0)}),(tc.absent||[]).forEach(function(frag){expect(text.indexOf(frag)).toBe(-1)})},15e3)})})});