forked from esdoc/esdoc
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(arrow): support exporting arrow function
- Loading branch information
1 parent
8f01190
commit 964eda3
Showing
5 changed files
with
86 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,23 @@ | |||
/** | |||
* this is ArrowFunction. | |||
*/ | |||
export default ()=>{} | |||
|
|||
/** | |||
* this is testExportArrowFunction2. | |||
*/ | |||
export const testExportArrowFunction2 = ()=>{}; | |||
|
|||
/** | |||
* this is testExportArrowFunction3. | |||
*/ | |||
const testExportArrowFunction3 = ()=>{}; | |||
|
|||
// this is undocument | |||
export const testExportArrowFunction4 = ()=>{}; | |||
|
|||
/** | |||
* this is testExportArrowFunction5. | |||
*/ | |||
const testExportArrowFunction5 = ()=>{}; | |||
export {testExportArrowFunction5}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
test/src/HTMLTest/DocumentTest/ExportTest/ArrowFunctionTest.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,39 @@ | |||
import {readDoc, assert, findParent} from './../../../util.js'; | |||
|
|||
/** @test {FunctionDoc#@_name} */ | |||
describe('test export arrow function', ()=> { | |||
const doc = readDoc('function/index.html'); | |||
|
|||
it('has default import path with direct arrow function definition.', ()=> { | |||
findParent(doc, '[id="static-function-ArrowFunction"]', '[data-ice="detail"]', (doc)=>{ | |||
assert.includes(doc, '[data-ice="importPath"]', `import ArrowFunction from 'esdoc-test-fixture/src/Export/ArrowFunction.js'`); | |||
}); | |||
}); | |||
|
|||
it('has named import path with direct arrow function definition.', ()=>{ | |||
findParent(doc, '[id="static-function-testExportArrowFunction2"]', '[data-ice="detail"]', (doc)=>{ | |||
assert.includes(doc, '[data-ice="importPath"]', `import {testExportArrowFunction2} from 'esdoc-test-fixture/src/Export/ArrowFunction.js'`); | |||
}); | |||
}); | |||
|
|||
it('is not documented with direct arrow function expression', ()=> { | |||
try { | |||
findParent(doc, '[id="static-function-testExportArrowFunction3"]', '[data-ice="detail"]', ()=>{}); | |||
} catch (e) { | |||
return; | |||
} | |||
assert(false); | |||
}); | |||
|
|||
it('has named import path with undocument', ()=>{ | |||
findParent(doc, '[id="static-function-testExportArrowFunction4"]', '[data-ice="detail"]', (doc)=>{ | |||
assert.includes(doc, '[data-ice="importPath"]', `import {testExportArrowFunction4} from 'esdoc-test-fixture/src/Export/ArrowFunction.js'`); | |||
}); | |||
}); | |||
|
|||
it('has named import path with indirect function definition.', ()=> { | |||
findParent(doc, '[id="static-function-testExportArrowFunction5"]', '[data-ice="detail"]', (doc)=>{ | |||
assert.includes(doc, '[data-ice="importPath"]', `import {testExportArrowFunction5} from 'esdoc-test-fixture/src/Export/ArrowFunction.js'`); | |||
}); | |||
}); | |||
}); |