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

kommitters / editorjs-toggle-block / 10856842690

13 Sep 2024 10:17PM UTC coverage: 31.442% (-0.7%) from 32.139%
10856842690

Pull #242

github

web-flow
Merge c2da1ab21 into 152a5cd00
Pull Request #242: General decoupling in functions

77 of 370 branches covered (20.81%)

Branch coverage included in aggregate %.

95 of 477 new or added lines in 22 files covered. (19.92%)

3 existing lines in 1 file now uncovered.

250 of 670 relevant lines covered (37.31%)

29.51 hits per line

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

0.0
/src/blocks/resetIdToCopiedBlock.js
1
/**
2
   * Reset the toggle ids to ensure toggles with unique id.
3
   */
4
export function resetIdToCopiedBlock() {
NEW
5
    if (this.wrapper !== undefined) {
×
NEW
6
      const index = this.api.blocks.getCurrentBlockIndex();
×
NEW
7
      const { holder } = this.api.blocks.getBlockByIndex(index);
×
8

NEW
9
      if (this.isPartOfAToggle(holder)) {
×
NEW
10
        const foreignKey = holder.getAttribute("foreignKey");
×
NEW
11
        const toggleRoot = document.querySelectorAll(`#${foreignKey}`);
×
12

NEW
13
        if (toggleRoot.length > 1) {
×
NEW
14
          const parentBlock = this.findToggleRootIndex(index, foreignKey);
×
NEW
15
          const id = uuidv4();
×
16

NEW
17
          for (let i = parentBlock; i <= index; i += 1) {
×
NEW
18
            const currentBlock = this.api.blocks.getBlockByIndex(i);
×
NEW
19
            const { holder: currentBlockHolder } = currentBlock;
×
NEW
20
            if (i === parentBlock) {
×
NEW
21
              const externalCover = currentBlockHolder.firstChild;
×
NEW
22
              const toggleCover = externalCover.firstChild;
×
NEW
23
              toggleCover.setAttribute("id", `fk-${id}`);
×
24
            } else {
NEW
25
              currentBlockHolder.setAttribute("foreignKey", `fk-${id}`);
×
26
            }
27
          }
28
        }
29
      }
30
    }
31
  }
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