Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 6bf9345

Browse files
committed
JS: Add test for class with locally-unused field
1 parent cc952bd commit 6bf9345

5 files changed

Lines changed: 19 additions & 4 deletions

File tree

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<sink-component [sink6]="field"></sink-component>
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import { Input, Component } from '@angular/core';
2+
3+
@Component({
4+
selector: 'mid-component',
5+
templateUrl: './mid.component.html'
6+
})
7+
export class MidComponent {
8+
@Input() field: string;
9+
}

javascript/ql/test/library-tests/frameworks/Angular2/sink.component.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ export class SinkComponent {
1111
sink3: string;
1212
sink4: string;
1313
sink5: string;
14+
sink6: string;
1415

1516
constructor(private sanitizer: DomSanitizer) {}
1617

@@ -20,5 +21,6 @@ export class SinkComponent {
2021
this.sanitizer.bypassSecurityTrustHtml(this.sink3);
2122
this.sanitizer.bypassSecurityTrustHtml(this.sink4);
2223
this.sanitizer.bypassSecurityTrustHtml(this.sink5);
24+
this.sanitizer.bypassSecurityTrustHtml(this.sink6);
2325
}
2426
}

javascript/ql/test/library-tests/frameworks/Angular2/source.component.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,5 @@
1313
<div *ngFor="let element of safeArray">
1414
<sink-component [sink2]="element"></sink-component>
1515
</div>
16+
17+
<mid-component [field]="taint"></mid-component>

javascript/ql/test/library-tests/frameworks/Angular2/test.expected

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ pipeClassRef
2222
| TestPipe.ts:4:8:9:1 | class T ... ;\\n }\\n} | source.component.html:5:22:5:29 | testPipe |
2323
| TestPipe.ts:4:8:9:1 | class T ... ;\\n }\\n} | source.component.html:6:19:6:26 | testPipe |
2424
taintFlow
25-
| source.component.ts:13:22:13:29 | source() | sink.component.ts:18:48:18:57 | this.sink1 |
26-
| source.component.ts:13:22:13:29 | source() | sink.component.ts:21:48:21:57 | this.sink4 |
27-
| source.component.ts:13:22:13:29 | source() | sink.component.ts:22:48:22:57 | this.sink5 |
28-
| source.component.ts:14:33:14:40 | source() | sink.component.ts:18:48:18:57 | this.sink1 |
25+
| source.component.ts:13:22:13:29 | source() | sink.component.ts:19:48:19:57 | this.sink1 |
26+
| source.component.ts:13:22:13:29 | source() | sink.component.ts:22:48:22:57 | this.sink4 |
27+
| source.component.ts:13:22:13:29 | source() | sink.component.ts:23:48:23:57 | this.sink5 |
28+
| source.component.ts:13:22:13:29 | source() | sink.component.ts:24:48:24:57 | this.sink6 |
29+
| source.component.ts:14:33:14:40 | source() | sink.component.ts:19:48:19:57 | this.sink1 |

0 commit comments

Comments
 (0)