• 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

75.0
/src/pagination/renderer/Renderer.ts
1
import Flicking, { FlickingError } from "@egjs/flicking";
1✔
2

3
import { BROWSER } from "../../event";
1✔
4
import Pagination from "../Pagination";
5

6
export interface RendererOptions {
7
  flicking: Flicking;
8
  pagination: Pagination;
9
  wrapper: HTMLElement;
10
}
11

12
abstract class Renderer {
1✔
13
  protected _flicking: Flicking;
14
  protected _pagination: Pagination;
15
  protected _wrapper: HTMLElement;
16

17
  public constructor({
1✔
18
    flicking,
19
    pagination,
20
    wrapper
21
  }: RendererOptions) {
22
    this._flicking = flicking;
6✔
23
    this._pagination = pagination;
6✔
24
    this._wrapper = wrapper;
6✔
25
  }
26

27
  public abstract destroy(): void;
28
  public abstract render(): void;
29
  public abstract update(index: number): void;
30

31
  protected _createBulletFromString(html: string, index: number) {
1✔
32
    const range = document.createRange();
1✔
33
    const frag = range.createContextualFragment(html);
1✔
34
    const bullet = frag.firstChild as HTMLElement;
1✔
35

36
    this._addBulletEvents(bullet, index);
1✔
37

38
    return bullet;
1✔
39
  }
40

41
  protected _addBulletEvents(bullet: HTMLElement, index: number) {
20✔
42
    const anchorPoints = this._flicking.camera.anchorPoints;
20✔
43
    const panelIndex = anchorPoints[index].panel.index;
20✔
44

45
    bullet.addEventListener(BROWSER.MOUSE_DOWN, e => {
20✔
46
      e.stopPropagation();
×
47
    });
48

49
    bullet.addEventListener(BROWSER.TOUCH_START, e => {
20✔
50
      e.stopPropagation();
×
51
    }, { passive: true });
52

53
    bullet.addEventListener(BROWSER.CLICK, () => {
20✔
54
      this._flicking.moveTo(panelIndex)
×
55
        .catch(err => {
56
          if (err instanceof FlickingError) return;
×
57
          throw err;
×
58
        });
59
    });
60
  }
61
}
1✔
62

63
export default Renderer;
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