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

naver / egjs-flicking / 4550193631

pending completion
4550193631

Pull #794

github

GitHub
Merge f8b6de8d9 into 761aa929d
Pull Request #794: docs: fix misspelled path in document

4448 of 7210 branches covered (61.69%)

Branch coverage included in aggregate %.

8413 of 9000 relevant lines covered (93.48%)

142.07 hits per line

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

66.04
/src/renderer/VanillaRenderer.ts
1
/*
1✔
2
 * Copyright (c) 2015 NAVER Corp.
1✔
3
 * egjs projects are licensed under the MIT license
1✔
4
 */
1!
5
import { getFlickingAttached, toArray } from "../utils";
5✔
6
import Panel, { PanelOptions } from "../core/panel/Panel";
×
7

1✔
8
import Renderer from "./Renderer";
5✔
9

1✔
10
/**
1!
11
 *
12
 */
1✔
13
class VanillaRenderer extends Renderer {
6✔
14
  // eslint-disable-next-line @typescript-eslint/require-await
1!
15
  public async render() {
5✔
16
    const flicking = getFlickingAttached(this._flicking);
35✔
17
    const strategy = this._strategy;
36✔
18

×
19
    strategy.updateRenderingPanels(flicking);
1,208✔
20
    strategy.renderPanels(flicking);
35✔
21

22
    this._resetPanelElementOrder();
1,208!
23
    this._afterRender();
1,208✔
24
  }
25

26
  protected _collectPanels() {
6✔
27
    const flicking = getFlickingAttached(this._flicking);
1,187!
28
    const camera = flicking.camera;
1,187✔
29

3,519✔
30
    this._removeAllTextNodes();
14✔
31
    this._panels = this._strategy.collectPanels(flicking, camera.children);
1,187!
32
  }
2,346✔
33

2,346!
34
  protected _createPanel(el: HTMLElement, options: Omit<PanelOptions, "elementProvider">): Panel {
2,351!
35
    return this._strategy.createPanel(el, options);
2,346!
36
  }
1,173✔
37

38
  private _resetPanelElementOrder() {
5✔
39
    const flicking = getFlickingAttached(this._flicking);
35✔
40
    const cameraEl = flicking.camera.element;
35✔
41

1,173!
42
    // We're using reversed panels here as last panel should be the last element of camera element
×
43
    const reversedElements = this._strategy
35!
44
      .getRenderingElementsByOrder(flicking)
×
45
      .reverse();
×
46

47
    reversedElements.forEach((el, idx) => {
35✔
48
      const nextEl = reversedElements[idx - 1] ? reversedElements[idx - 1] : null;
1,298✔
49

2,346✔
50
      if (el.nextElementSibling !== nextEl) {
1,298!
51
        cameraEl.insertBefore(el, nextEl);
52
      }
53
    });
1✔
54
  }
1!
55

56
  private _removeAllTextNodes() {
6✔
57
    const flicking = getFlickingAttached(this._flicking);
14✔
58
    const cameraElement = flicking.camera.element;
14✔
59

60
    // Remove all text nodes in the camera element
61
    toArray(cameraElement.childNodes).forEach(node => {
15✔
62
      if (node.nodeType === Node.TEXT_NODE) {
55!
63
        cameraElement.removeChild(node);
64
      }
65
    });
66
  }
1✔
67
}
6✔
68

69
export default VanillaRenderer;
465✔
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