var expect = require('expect');
var assert = require('assert');
var sinon = require('sinon');

var ContentState = require('../../../lib/state/ContentState');
var SelectionState = require('../../../lib/state/SelectionState');
var ContentManager = require('../../../lib/modules/ContentManager');

var BoldButton = require('../../../lib/actions/buttons/BoldButton');

describe('BoldButton', () => {

  beforeEach(() => {
  })

  describe('#press', () => {

    it('adds bold to a single block', () => {
      var manager = new ContentManager({});
      var callback = sinon.spy();

      var selection = {
        anchor: {guid: "56ef", blockOffset: 0},
        focus:  {guid: "56ef", blockOffset: 4},
        types:  ['p'],
        text:   "this",
        hasType: () => {},
        addType: () => {},
        removeType: () => {}
      }

      // var button = new BoldButton(manager, selection);
      // var result = button.press();

      // var result = ContentState.get();
      // console.log(JSON.stringify(result.content, null, 4))
    })

    it('removes bold from a single block', () => {
    })

    it('adds bold across multiple blocks', () => {
    })

    it('removes bold across multiple blocks', () => {
    })
  })
})

@@ -92,138 +92,8 @@
 );%0A%0A
-var ContentState = require('../../../lib/state/ContentState');%0Avar SelectionState = require('../../../lib/state/SelectionState');%0A
 var 
@@ -153,25 +153,24 @@
 tManager');%0A
-%0A
 var BoldButt
@@ -265,108 +265,97 @@
 %0A%0A  
-beforeEach(() =%3E %7B%0A  %7D)%0A%0A  describe('#press', ()
+var manager, selection;%0A%0A  beforeEach(() =%3E %7B%0A    manager
  =
-%3E
  %7B%0A
-%0A
     
-it('adds bold to a single block',
+  toggleMarkup:
  () =%3E %7B
 %0A   
@@ -354,97 +354,43 @@
 =%3E %7B
+%7D,
 %0A      
-var manager = new ContentManager(%7B%7D);%0A      var callback = sinon.spy();%0A%0A      var
+flush: () =%3E %7B%7D%0A    %7D%0A%0A   
  sel
@@ -406,18 +406,16 @@
 %7B%0A      
- 
- 
 anchor: 
@@ -446,18 +446,16 @@
 et: 0%7D,%0A
-  
       fo
@@ -498,18 +498,16 @@
 ,%0A      
-  
 types:  
@@ -519,18 +519,16 @@
 ,%0A      
- 
- 
 text:   
@@ -533,24 +533,45 @@
   %22this%22,%0A  
+    guids: () =%3E %7B%7D,%0A
       hasTyp
@@ -576,29 +576,42 @@
 ype: () =%3E %7B
+ return false; 
 %7D,%0A
-  
       addTyp
@@ -629,18 +629,16 @@
 ,%0A      
-  
 removeTy
@@ -658,21 +658,188 @@
     
+%7D%0A
   %7D
+)
 %0A%0A  
+describe('#press while inactive', () =%3E %7B%0A%0A    it('sends toggleMarkup to manager', () =%3E %7B%0A      var callback = sinon.spy();%0A      manager.toggleMarkup = callback;%0A%0A 
     
-//
  var
@@ -885,27 +885,24 @@
 tion);%0A     
- //
  var result 
@@ -930,105 +930,623 @@
     
-// var result = ContentState.get();%0A      // console.log(JSON.stringify(result.content, null, 4))
+assert(callback.called);%0A    %7D)%0A    it('adds type to selection', () =%3E %7B%0A      var callback = sinon.spy();%0A      selection.addType = callback;%0A%0A      var button = new BoldButton(manager, selection);%0A      var result = button.press();%0A%0A      assert(callback.called);%0A    %7D)%0A  %7D)%0A%0A  describe('#press while active', () =%3E %7B%0A%0A    it('sends toggleMarkup to manager', () =%3E %7B%0A      selection.hasType = () =%3E %7B return true; %7D%0A%0A      var callback = sinon.spy();%0A      manager.toggleMarkup = callback;%0A%0A      var button = new BoldButton(manager, selection);%0A      var result = button.press();%0A%0A      assert(callback.called);
 %0A   
@@ -1570,32 +1570,27 @@
 ves 
-bold
+type
  from 
-a single block
+selection
 ', (
@@ -1604,124 +1604,249 @@
     
-%7D)%0A%0A    it('adds bold across multiple blocks', () =%3E %7B%0A    %7D)%0A%0A    it('removes bold across multiple blocks', () =%3E %7B
+  selection.hasType = () =%3E %7B return true; %7D%0A%0A      var callback = sinon.spy();%0A      selection.removeType = callback;%0A%0A      var button = new BoldButton(manager, selection);%0A      var result = button.press();%0A%0A      assert(callback.called);
 %0A   

add specs for bold button