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

antvis / T8 / 15991462017

01 Jul 2025 06:18AM UTC coverage: 49.32% (-1.7%) from 51.008%
15991462017

push

github

web-flow
refactor: use arrow as ratio suffix (#114)

* refactor: use arrow as ratio suffix

* fix: entity table format of table

* chore: update snapshot

76 of 186 branches covered (40.86%)

Branch coverage included in aggregate %.

1 of 20 new or added lines in 2 files covered. (5.0%)

178 of 329 relevant lines covered (54.1%)

7.34 hits per line

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

4.35
/src/plugin/utils/createDocumentFragment.ts
1
/**
2
 * add element to original element, this function is used to add element to Phrase element,
3
 * @param element - element to add, type: HTMLElement, string or number.
4
 * @param value - original string from spec, type: string, make sure it only contains text node.
5
 * @param position - position to add element, type: 'suffix' | 'prefix', default: 'suffix'.
6
 * @returns - new container element, type: HTMLSpanElement.
7
 * use function `addElement` to add element to original element.
8
 */
9
export const createDocumentFragment = (
2✔
10
  element: string | number | Element,
11
  value: string,
12
  position: 'suffix' | 'prefix' = 'suffix',
×
13
): DocumentFragment => {
14
  const fragment = document.createDocumentFragment();
×
15

16
  const originalElementSpan = value;
×
17
  fragment.textContent = originalElementSpan;
×
18

NEW
19
  let newElement: Element | undefined = undefined;
×
20

21
  if (typeof element === 'string' || typeof element === 'number') {
×
22
    newElement = document.createElement('span');
×
23
    newElement.textContent = element.toString();
×
24
  } else {
25
    newElement = element;
×
26
  }
27

28
  if (newElement) {
×
29
    if (position === 'suffix') {
×
30
      fragment.appendChild(newElement);
×
31
    } else {
32
      fragment.insertBefore(newElement, fragment.firstChild);
×
33
    }
34
  }
35

36
  return fragment;
×
37
};
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