Code coverage report for src/stores/MarkdownEditorStore.js

Statements: 57.14% (16 / 28)      Branches: 100% (0 / 0)      Functions: 9.09% (1 / 11)      Lines: 57.14% (16 / 28)      Ignored: none     

All files » src/stores/ » MarkdownEditorStore.js
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 641 1 1   1   1 1 1 1 1 1 1 1 1 1 1                                                                                           1  
var Reflux = require('reflux');
var MarkdownEditorActions = require('../actions/MarkdownEditorActions');
var MarkdownSelectionActions = require('../actions/MarkdownSelectionActions');
 
var MarkdownEditorStore = Reflux.createStore({
  init: function() {
    this.currentSelection = null;
    this.listenTo(MarkdownEditorActions.makeBold, this.handleMakeBold);
    this.listenTo(MarkdownEditorActions.makeItalic, this.handleMakeItalic);
    this.listenTo(MarkdownEditorActions.makeHeader, this.handleMakeHeader);
    this.listenTo(MarkdownEditorActions.makeSubHeader, this.handleMakeSubHeader);
    this.listenTo(MarkdownEditorActions.makeImage, this.handleMakeImage);
    this.listenTo(MarkdownEditorActions.makeLink, this.handleMakeLink);
    this.listenTo(MarkdownEditorActions.makeList, this.handleMakeList);
    this.listenTo(MarkdownEditorActions.makeUnderline, this.handleMakeUnderline);
    this.listenTo(MarkdownEditorActions.clearSelection, this.handleClearSelection);
    this.listenTo(MarkdownEditorActions.setSelection, this.handleSetSelection);
  },
 
  handleMakeBold: function() {
    this.trigger({action: 'bold', currentSelection: this.currentSelection});
  },
 
  handleMakeItalic: function() {
    this.trigger({action: 'italic', currentSelection: this.currentSelection});
  },
 
  handleMakeLink: function() {
    this.trigger({action: 'link', currentSelection: this.currentSelection});
  },
 
  handleMakeUnderline: function() {
    this.trigger({action: 'underline', currentSelection: this.currentSelection});
  },
 
  handleMakeHeader: function() {
    this.trigger({action: 'header', currentSelection: this.currentSelection});
  },
 
  handleMakeSubHeader: function() {
    this.trigger({action: 'subheader', currentSelection: this.currentSelection});
  },
 
  handleMakeList: function() {
    this.trigger({action: 'list', currentSelection: this.currentSelection});
  },
 
  handleMakeImage: function() {
    this.trigger({action: 'image', currentSelection: this.currentSelection});
  },
 
  handleClearSelection: function() {
    this.currentSelection = null;
    MarkdownSelectionActions.selectionCleared();
  },
 
  handleSetSelection: function(_selection) {
    this.currentSelection = _selection;
    MarkdownSelectionActions.selectionSet();
  }
});
 
module.exports = MarkdownEditorStore;