Skip to content

Commit dc9ba0f

Browse files
committed
feat(es2017): support trailing comma
1 parent df2d6c7 commit dc9ba0f

File tree

3 files changed

+59
-3
lines changed

3 files changed

+59
-3
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
/**
2+
* this is TestTrailingCommaDefinition.
3+
*/
4+
export default class TestTrailingCommaDefinition {
5+
/**
6+
* this is method1.
7+
* @param {number} p1 - this is p1.
8+
* @param {string} p2 - this is p2.
9+
*/
10+
method1(p1, p2,) {}
11+
12+
/**
13+
* this is method2.
14+
*/
15+
method2(){
16+
this.method1(1, 'abc',);
17+
}
18+
}

test/src/HTMLTest/CoverageTest/CoverageTest.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ describe('test coverage', ()=> {
99
it('has coverage summary', ()=> {
1010
assert(badge.includes('79%'));
1111
assert.includes(doc, '[data-ice="coverageBadge"]', './badge.svg', 'src');
12-
assert.includes(doc, '[data-ice="totalCoverageCount"]', '260/327');
13-
assert.equal(doc.find('[data-ice="file"] [data-ice="coverage"]').length, 115);
12+
assert.includes(doc, '[data-ice="totalCoverageCount"]', '263/330');
13+
assert.equal(doc.find('[data-ice="file"] [data-ice="coverage"]').length, 116);
1414
});
1515

1616
/* eslint-disable max-statements */
@@ -114,6 +114,7 @@ describe('test coverage', ()=> {
114114
test('file/src/Todo/Class.js.html', '100 %4/4');
115115
test('file/src/Todo/Function.js.html', '100 %1/1');
116116
test('file/src/Todo/Variable.js.html', '100 %1/1');
117+
test('file/src/TrailingComma/Definition.js.html', '100 %3/3');
117118
test('file/src/Type/Array.js.html', '100 %2/2');
118119
test('file/src/Type/Class.js.html#errorLines=1,9', '33 %1/3');
119120
test('file/src/Type/Complex.js.html#errorLines=1', '80 %4/5');
@@ -139,6 +140,6 @@ describe('test coverage', ()=> {
139140
test('file/src/Version/Function.js.html', '100 %1/1');
140141
test('file/src/Version/Variable.js.html', '100 %1/1');
141142

142-
assert.equal(count, 115);
143+
assert.equal(count, 116);
143144
});
144145
});
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
import {readDoc, assert, findParent} from './../../../util.js';
2+
3+
/** @test {ESParser} */
4+
describe('TestTrailingCommaDefinition', ()=> {
5+
const doc = readDoc('class/src/TrailingComma/Definition.js~TestTrailingCommaDefinition.html');
6+
7+
describe('in self detail', ()=> {
8+
it('has desc.', ()=> {
9+
assert.includes(doc, '.self-detail [data-ice="description"]', 'this is TestTrailingCommaDefinition.');
10+
});
11+
});
12+
13+
describe('in summary', ()=> {
14+
it('has desc', ()=> {
15+
findParent(doc, '[data-ice="summary"] [href$="#instance-method-method1"]', '[data-ice="target"]', (doc)=> {
16+
assert.includes(doc, null, 'public method1(p1: number, p2: string)');
17+
});
18+
19+
findParent(doc, '[data-ice="summary"] [href$="#instance-method-method2"]', '[data-ice="target"]', (doc)=> {
20+
assert.includes(doc, null, 'public method2()');
21+
});
22+
});
23+
});
24+
25+
describe('in details', ()=>{
26+
it('has desc.', ()=>{
27+
findParent(doc, '[id="instance-method-method1"]', '[data-ice="detail"]', (doc)=>{
28+
assert.includes(doc, '.params [data-ice="property"]:nth-of-type(1)', 'p1 number this is p1.');
29+
assert.includes(doc, '.params [data-ice="property"]:nth-of-type(2)', 'p2 string this is p2.');
30+
});
31+
32+
findParent(doc, '[id="instance-method-method2"]', '[data-ice="detail"]', (doc)=>{
33+
assert.includes(doc, '[data-ice="description"]', 'this is method2.');
34+
});
35+
});
36+
});
37+
});

0 commit comments

Comments
 (0)