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

glorious-codes / glorious-demo / 971b12eb-089e-42e4-89d6-04e2d7329d1c

pending completion
971b12eb-089e-42e4-89d6-04e2d7329d1c

Pull #107

circleci

GitHub
build(deps): bump minimist from 1.2.5 to 1.2.6
Pull Request #107: build(deps): bump minimist from 1.2.5 to 1.2.6

62 of 62 branches covered (100.0%)

Branch coverage included in aggregate %.

273 of 273 relevant lines covered (100.0%)

10.96 hits per line

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

100.0
/src/scripts/components/editor-application/editor-application.js
1
import '@styles/editor-application.styl';
2
import { Application } from '../application/application';
3
import { EditorLine } from '../editor-line/editor-line';
4
import textService from '../../services/text/text';
5

6
export class EditorApplication extends Application {
7
  constructor(container, options = {}){
9✔
8
    super('editor', options);
11✔
9
    this.container = container;
11✔
10
    this.container.appendChild(this.element);
11✔
11
    this.setupInitialContent(options.initialContent);
11✔
12
    this.setWindowTitle(buildWindowTitle(options));
11✔
13
  }
14
  setupInitialContent(initialContent = ''){
10✔
15
    const linesToAppend = parseContent(initialContent);
11✔
16
    this.setLines([]);
11✔
17
    this.appendLines(linesToAppend);
11✔
18
  }
19
  setLines(lines){
20
    this.lines = [];
11✔
21
  }
22
  appendLines(textLines){
23
    textLines.forEach(textLine => {
11✔
24
      const line = buildEditorLine(this.lines, textLine);
2✔
25
      appendContentToApplication(this, line);
2✔
26
    });
27
  }
28
  write({ codeSample }, onComplete){
29
    const textLines = parseContent(codeSample);
7✔
30
    writeMultipleLines(this, textLines, onComplete);
7✔
31
  }
32
}
33

34
function parseContent(content){
35
  return textService.removeBlankFirstLine(content);
18✔
36
}
37

38
function buildWindowTitle(options){
39
  return options.windowTitle || '~/demo/demo.js';
11✔
40
}
41

42
function writeMultipleLines(application, textLines, onComplete){
43
  const textLine = textLines.shift();
17✔
44
  if(textLine !== undefined){
17✔
45
    inactivateLastLineWritten(application.lines);
10✔
46
    writeSingleLine(application, textLine, () => {
10✔
47
      writeMultipleLines(application, textLines, onComplete);
10✔
48
    });
49
  } else {
50
    onComplete();
7✔
51
  }
52
}
53

54
function inactivateLastLineWritten(lines){
55
  if(lines.length)
10✔
56
    lines[lines.length-1].setInactive();
3✔
57
}
58

59
function writeSingleLine(application, text, onComplete){
60
  const line = buildEditorLine(application.lines);
10✔
61
  appendContentToApplication(application, line);
10✔
62
  line.setActive();
10✔
63
  line.write(text, onComplete);
10✔
64
}
65

66
function buildEditorLine(applicationLines, text){
67
  return new EditorLine(applicationLines.length + 1, text);
12✔
68
}
69

70
function appendContentToApplication(application, line){
71
  application.addContent(line.element);
12✔
72
  application.lines.push(line);
12✔
73
}
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