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

naver / egjs-flicking-plugins / 5530884421

pending completion
5530884421

push

github

daybrush
chore(release): Release 4.7.1

197 of 320 branches covered (61.56%)

Branch coverage included in aggregate %.

621 of 819 relevant lines covered (75.82%)

3.29 hits per line

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

19.57
/src/pagination/renderer/FractionRenderer.ts
1
import { PAGINATION } from "../../const";
1✔
2
import { addClass } from "../../utils";
1✔
3

4
import Renderer from "./Renderer";
1✔
5

6
class FractionRenderer extends Renderer {
2!
7
  private _prevIndex: number = -1;
×
8
  private _prevTotal: number = -1;
×
9

10
  public destroy(): void {
1✔
11
    this._prevIndex = -1;
×
12
    this._prevTotal = -1;
×
13
  }
14

15
  public render() {
1✔
16
    const flicking = this._flicking;
×
17
    const wrapper = this._wrapper;
×
18
    const pagination = this._pagination;
×
19
    const fractionWrapperClass = `${pagination.classPrefix}-${PAGINATION.FRACTION_WRAPPER_SUFFIX}`;
×
20
    const fractionCurrentClass = `${pagination.classPrefix}-${PAGINATION.FRACTION_CURRENT_SUFFIX}`;
×
21
    const fractionTotalClass = `${pagination.classPrefix}-${PAGINATION.FRACTION_TOTAL_SUFFIX}`;
×
22

23
    addClass(wrapper, fractionWrapperClass);
×
24

25
    wrapper.innerHTML = pagination.renderFraction(fractionCurrentClass, fractionTotalClass);
×
26

27
    this.update(flicking.index);
×
28
  }
29

30
  public update(index: number) {
1✔
31
    const flicking = this._flicking;
×
32
    const wrapper = this._wrapper;
×
33
    const pagination = this._pagination;
×
34

35
    const anchorPoints = flicking.camera.anchorPoints;
×
36
    const currentIndex = anchorPoints.length > 0
×
37
      ? index - anchorPoints[0].panel.index + 1
×
38
      : 0;
39
    const anchorCount = anchorPoints.length;
×
40

41
    if (currentIndex === this._prevIndex && anchorCount === this._prevTotal) return;
×
42

43
    const fractionCurrentSelector = `.${pagination.classPrefix}-${PAGINATION.FRACTION_CURRENT_SUFFIX}`;
×
44
    const fractionTotalSelector = `.${pagination.classPrefix}-${PAGINATION.FRACTION_TOTAL_SUFFIX}`;
×
45

46
    const currentWrapper = wrapper.querySelector(fractionCurrentSelector) as HTMLElement;
×
47
    const totalWrapper = wrapper.querySelector(fractionTotalSelector) as HTMLElement;
×
48

49
    currentWrapper.innerHTML = pagination.fractionCurrentFormat(currentIndex);
×
50
    totalWrapper.innerHTML = pagination.fractionTotalFormat(anchorCount);
×
51

52
    this._prevIndex = currentIndex;
×
53
    this._prevTotal = anchorCount;
×
54
  }
55
}
1✔
56

57
export default FractionRenderer;
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