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

kommitters / editorjs-toggle-block / 10892547259

16 Sep 2024 09:48PM UTC coverage: 30.939% (-1.2%) from 32.139%
10892547259

push

github

web-flow
General decoupling in functions (#243)

* undocking elements toggle

* undocking elements render

* undocking elements movement

* undocking elements block

* undocking elements nest

* undocking elements actions

* Fix, linter errors

* Bundle production

73 of 367 branches covered (19.89%)

Branch coverage included in aggregate %.

77 of 456 new or added lines in 24 files covered. (16.89%)

4 existing lines in 1 file now uncovered.

250 of 677 relevant lines covered (36.93%)

29.21 hits per line

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

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

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

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

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