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

naver / egjs-grid / 5086275713

pending completion
5086275713

push

github

Daybrush
chore(release): Release 1.14.1

599 of 689 branches covered (86.94%)

Branch coverage included in aggregate %.

1330 of 1362 relevant lines covered (97.65%)

1076.12 hits per line

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

87.5
/src/grids/lib/BoxModel.ts
1
export interface BoxModelStatus {
2
  orgInlineSize: number;
3
  orgContentSize: number;
4
  inlineSize: number;
5
  contentSize: number;
6
  inlinePos: number;
7
  contentPos: number;
8
  items: BoxModel[];
9
}
10

11
export default class BoxModel implements BoxModelStatus {
1✔
12
  public orgInlineSize: number;
13
  public orgContentSize: number;
14
  public inlineSize: number;
15
  public contentSize: number;
16
  public inlinePos: number;
17
  public contentPos: number;
18
  public items: BoxModel[];
19
  constructor(status: Partial<BoxModelStatus>) {
1✔
20
    const boxStatus = {
42✔
21
      orgInlineSize: 0,
22
      orgContentSize: 0,
23
      inlineSize: 0,
24
      contentSize: 0,
25
      inlinePos: 0,
26
      contentPos: 0,
27
      items: [],
28
      ...status,
29
    };
30
    for (const name in boxStatus) {
42✔
31
      this[name] = boxStatus[name];
294✔
32
    }
33
  }
34
  public scaleTo(inlineSize: number, contentSize: number) {
1✔
35
    const scaleX = this.inlineSize ? inlineSize / this.inlineSize : 0;
36!
36
    const scaleY = this.contentSize ? contentSize / this.contentSize : 0;
36!
37

38
    this.items.forEach((item) => {
36✔
39
      if (scaleX !== 0) {
150!
40
        item.inlinePos *= scaleX;
150✔
41
        item.inlineSize *= scaleX;
150✔
42
      }
43
      if (scaleY !== 0) {
150!
44
        item.contentPos *= scaleY;
150✔
45
        item.contentSize *= scaleY;
150✔
46
      }
47
    });
48

49
    this.inlineSize = inlineSize;
36✔
50
    this.contentSize = contentSize;
36✔
51
  }
52
  public push(item: BoxModel) {
1✔
53
    this.items.push(item);
36✔
54
  }
55
  public getOrgSizeWeight() {
1✔
56
    return this.orgInlineSize * this.orgContentSize;
342✔
57
  }
58
  public getSize() {
1✔
59
    return this.inlineSize * this.contentSize;
342✔
60
  }
61
  public getOrgRatio() {
1✔
62
    return (this.orgContentSize === 0) ? 0 : this.orgInlineSize / this.orgContentSize;
342!
63
  }
64
  public getRatio() {
1✔
65
    return (this.contentSize === 0) ? 0 : this.inlineSize / this.contentSize;
378✔
66
  }
67
}
1✔
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

© 2025 Coveralls, Inc