• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

juice-shop / juice-shop / 23046702925

13 Mar 2026 10:14AM UTC coverage: 85.989% (-0.03%) from 86.014%
23046702925

push

github

bkimminich
Add icon to make dependency tags more visually distinct

1308 of 1733 branches covered (75.48%)

Branch coverage included in aggregate %.

5498 of 6182 relevant lines covered (88.94%)

42.64 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

70.37
/frontend/src/app/code-fixes/code-fixes.component.ts
1
import { Component, Input, type OnInit, ViewChild, type DoCheck, KeyValueDiffers, type KeyValueDiffer, inject } from '@angular/core'
2
import { NgxTextDiffComponent, NgxTextDiffModule, type DiffTableFormat } from '@winarg/ngx-text-diff'
3

4
import { CookieService } from 'ngy-cookie'
5
import { type RandomFixes } from '../code-snippet/code-snippet.component'
6

7
@Component({
8
  selector: 'app-code-fixes',
9
  templateUrl: './code-fixes.component.html',
10
  styleUrls: ['./code-fixes.component.scss'],
11
  imports: [NgxTextDiffModule]
12
})
13
export class CodeFixesComponent implements OnInit, DoCheck {
1✔
14
  private readonly cookieService = inject(CookieService)
22✔
15
  private readonly differs = inject(KeyValueDiffers)
22✔
16

17
  differ: KeyValueDiffer<string, DiffTableFormat>
18

19
  constructor () {
20
    const cookieService = this.cookieService
22✔
21

22
    this.cookieService = cookieService
22✔
23
    this.differ = this.differs.find({}).create()
22✔
24
  }
25

26
  @Input()
27
  public snippet = ''
22✔
28

29
  @Input()
30
  public fixes: string[] = []
22✔
31

32
  @Input()
33
  public selectedFix = 0
22✔
34

35
  @Input()
36
  public randomFixes: RandomFixes[] = []
22✔
37

38
  @Input()
39
  public format = 'SideBySide'
22✔
40

41
  @ViewChild('codeComponent', { static: false }) codeComponent: NgxTextDiffComponent
42

43
  ngOnInit (): void {
44
    if (this.cookieService.hasKey('code-fixes-component-format')) {
24✔
45
      this.format = this.cookieService.get('code-fixes-component-format')
1✔
46
    } else {
47
      this.format = 'LineByLine'
23✔
48
      this.cookieService.put('code-fixes-component-format', 'LineByLine')
23✔
49
    }
50
  }
51

52
  ngDoCheck() {
53
    if (!this.codeComponent) return
41✔
54
    try {
×
55
      const change = this.differ.diff({ 'diff-format': this.codeComponent.format })
×
56
      if (change) {
×
57
        change.forEachChangedItem(item => {
×
58
          this.format = item.currentValue
×
59
          this.cookieService.put('code-fixes-component-format', this.format)
×
60
        }
61
        )
62
      }
63
    } catch {
64
      console.warn('Error during diffing')
×
65
    }
66
  }
67
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc