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

caleb531 / flip-book / 10498848679

21 Aug 2024 11:10PM UTC coverage: 26.831% (+2.8%) from 24.055%
10498848679

push

github

caleb531
Rename components to have *.jsx extension

This is a preliminary step to the actual conversion to JSX.

72 of 102 branches covered (70.59%)

Branch coverage included in aggregate %.

0 of 65 new or added lines in 17 files covered. (0.0%)

386 of 1605 relevant lines covered (24.05%)

7.23 hits per line

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

0.0
/scripts/components/settings.jsx
1
import m from 'mithril';
×
NEW
2
import ControlComponent from './control.jsx';
×
3

4
class SettingsComponent {
×
5

6
  async setFrameDuration(story, framesPerSecond) {
×
7
    story.setFramesPerSecond(Number(framesPerSecond));
×
8
    await story.save();
×
9
  }
×
10

11
  async incrementNumPreviousFramesToShow(story) {
×
12
    story.numPreviousFramesToShow = Math.min(story.numPreviousFramesToShow + 1, 4);
×
13
    await story.save();
×
14
  }
×
15

16
  async decrementNumPreviousFramesToShow(story) {
×
17
    story.numPreviousFramesToShow = Math.max(0, story.numPreviousFramesToShow - 1);
×
18
    await story.save();
×
19
  }
×
20

21
  async setLineWidth(story, lineWidth) {
×
22
    story.frameStyles.lineWidth = Number(lineWidth);
×
23
    await story.save();
×
24
  }
×
25

26
  view({attrs: {story}}) {
×
27
    return m('div.settings', [
×
28
      m('h2', 'Settings'),
×
29
      m('div.setting', [
×
30
        m('label[for="setting-fps"]', 'FPS'),
×
31
        m('input[type=range][min=2][max=30][step=2]#setting-fps', {
×
32
          value: story.getFramesPerSecond(),
×
33
          oninput: ({target}) => this.setFrameDuration(story, target.value)
×
34
        }),
×
35
        m('span.setting-value', story.getFramesPerSecond())
×
36
      ]),
×
37
      m('div.setting', [
×
38
        m('label', 'Previous Frames to Show'),
×
39
        m(ControlComponent, {
×
40
          id: 'decrement-previous-frames',
×
41
          title: 'Show One Less Previous Frame',
×
42
          icon: 'decrement',
×
43
          action: () => this.decrementNumPreviousFramesToShow(story)
×
44
        }),
×
45
        m('span.setting-value.setting-value-previous-frames', story.numPreviousFramesToShow),
×
46
        m(ControlComponent, {
×
47
          id: 'increment-previous-frames',
×
48
          title: 'Show One More Previous Frame',
×
49
          icon: 'increment',
×
50
          action: () => this.incrementNumPreviousFramesToShow(story)
×
51
        })
×
52
      ]),
×
53
      m('div.setting', [
×
54
        m('label[for="setting-stroke-width"]', 'Stroke Width'),
×
55
        m('input[type=range][min=4][max=20][step=4]#setting-stroke-width', {
×
56
          value: story.frameStyles.lineWidth,
×
57
          oninput: ({target}) => this.setLineWidth(story, target.value)
×
58
        }),
×
59
        m('span.setting-value', story.frameStyles.lineWidth)
×
60
      ])
×
61
    ]);
×
62
  }
×
63

64
}
×
65

66
export default SettingsComponent;
×
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