-
Notifications
You must be signed in to change notification settings - Fork 204
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(es2017): support trailing comma
- Loading branch information
1 parent
df2d6c7
commit dc9ba0f
Showing
3 changed files
with
59 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
/** | ||
* this is TestTrailingCommaDefinition. | ||
*/ | ||
export default class TestTrailingCommaDefinition { | ||
/** | ||
* this is method1. | ||
* @param {number} p1 - this is p1. | ||
* @param {string} p2 - this is p2. | ||
*/ | ||
method1(p1, p2,) {} | ||
|
||
/** | ||
* this is method2. | ||
*/ | ||
method2(){ | ||
this.method1(1, 'abc',); | ||
} | ||
} |
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
37 changes: 37 additions & 0 deletions
37
test/src/HTMLTest/DocumentTest/TrailingCommaTest/DefinitionTest.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 | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import {readDoc, assert, findParent} from './../../../util.js'; | ||
|
||
/** @test {ESParser} */ | ||
describe('TestTrailingCommaDefinition', ()=> { | ||
const doc = readDoc('class/src/TrailingComma/Definition.js~TestTrailingCommaDefinition.html'); | ||
|
||
describe('in self detail', ()=> { | ||
it('has desc.', ()=> { | ||
assert.includes(doc, '.self-detail [data-ice="description"]', 'this is TestTrailingCommaDefinition.'); | ||
}); | ||
}); | ||
|
||
describe('in summary', ()=> { | ||
it('has desc', ()=> { | ||
findParent(doc, '[data-ice="summary"] [href$="#instance-method-method1"]', '[data-ice="target"]', (doc)=> { | ||
assert.includes(doc, null, 'public method1(p1: number, p2: string)'); | ||
}); | ||
|
||
findParent(doc, '[data-ice="summary"] [href$="#instance-method-method2"]', '[data-ice="target"]', (doc)=> { | ||
assert.includes(doc, null, 'public method2()'); | ||
}); | ||
}); | ||
}); | ||
|
||
describe('in details', ()=>{ | ||
it('has desc.', ()=>{ | ||
findParent(doc, '[id="instance-method-method1"]', '[data-ice="detail"]', (doc)=>{ | ||
assert.includes(doc, '.params [data-ice="property"]:nth-of-type(1)', 'p1 number this is p1.'); | ||
assert.includes(doc, '.params [data-ice="property"]:nth-of-type(2)', 'p2 string this is p2.'); | ||
}); | ||
|
||
findParent(doc, '[id="instance-method-method2"]', '[data-ice="detail"]', (doc)=>{ | ||
assert.includes(doc, '[data-ice="description"]', 'this is method2.'); | ||
}); | ||
}); | ||
}); | ||
}); |