Sha256: 97452b5bf17542d5ec13d1225116dd9391d3262102f981c8c23e42e29cc1182d

Contents?: true

Size: 1.49 KB

Versions: 29

Compression:

Stored size: 1.49 KB

Contents

describe "Mercury.dialogHandlers.foreColor", ->

  template 'mercury/dialogs/forecolor.html'

  beforeEach ->
    @dialog = {element: $('#test'), button: $('#button')}
    Mercury.dialogHandlers.foreColor.call(@dialog)

  describe "when a .picker or .last-picked element is clicked", ->

    it "sets the last picked color to whatever was selected", ->
      $('.last-picked').css({background: '#0000FF'})
      jasmine.simulate.click($('#white').get(0))
      expect($('.last-picked').css('backgroundColor')).toEqual('rgb(255, 255, 255)')
      jasmine.simulate.click($('#red').get(0))
      expect($('.last-picked').css('backgroundColor')).toEqual('rgb(255, 0, 0)')

    it "sets the background color of the button", ->
      $('#button').css({background: '#0000FF'})
      jasmine.simulate.click($('#white').get(0))
      expect($('#button').css('backgroundColor')).toEqual('rgb(255, 255, 255)')
      jasmine.simulate.click($('#red').get(0))
      expect($('#button').css('backgroundColor')).toEqual('rgb(255, 0, 0)')

    it "triggers an action", ->
      spy = spyOn(Mercury, 'trigger').andCallFake(=>)
      jasmine.simulate.click($('#white').get(0))
      expect(spy.callCount).toEqual(1)
      expect(spy.argsForCall[0]).toEqual(['action', {action: 'foreColor', value: 'rgb(255, 255, 255)'}])


  describe "when any other element is clicked", ->

    it "does nothing", ->
      spy = spyOn(Mercury, 'trigger').andCallFake(=>)
      jasmine.simulate.click($('#green').get(0))
      expect(spy.callCount).toEqual(0)

Version data entries

29 entries across 29 versions & 3 rubygems

Version Path
kiteditor-1.0.25 spec/javascripts/mercury/dialogs/forecolor_spec.js.coffee
kiteditor-1.0.24 spec/javascripts/mercury/dialogs/forecolor_spec.js.coffee
kiteditor-1.0.23 spec/javascripts/mercury/dialogs/forecolor_spec.js.coffee
kiteditor-1.0.22 spec/javascripts/mercury/dialogs/forecolor_spec.js.coffee
kiteditor-1.0.21 spec/javascripts/mercury/dialogs/forecolor_spec.js.coffee
kiteditor-1.0.20 spec/javascripts/mercury/dialogs/forecolor_spec.js.coffee
kiteditor-1.0.19 spec/javascripts/mercury/dialogs/forecolor_spec.js.coffee
kiteditor-1.0.18 spec/javascripts/mercury/dialogs/forecolor_spec.js.coffee
kiteditor-1.0.17 spec/javascripts/mercury/dialogs/forecolor_spec.js.coffee
kiteditor-1.0.16 spec/javascripts/mercury/dialogs/forecolor_spec.js.coffee
kiteditor-1.0.14 spec/javascripts/mercury/dialogs/forecolor_spec.js.coffee
kiteditor-1.0.13 spec/javascripts/mercury/dialogs/forecolor_spec.js.coffee
kiteditor-1.0.11 spec/javascripts/mercury/dialogs/forecolor_spec.js.coffee
kiteditor-1.0.10 spec/javascripts/mercury/dialogs/forecolor_spec.js.coffee
kiteditor-1.0.9 spec/javascripts/mercury/dialogs/forecolor_spec.js.coffee
kiteditor-1.0.8 spec/javascripts/mercury/dialogs/forecolor_spec.js.coffee
kiteditor-1.0.7 spec/javascripts/mercury/dialogs/forecolor_spec.js.coffee
kiteditor-1.0.6 spec/javascripts/mercury/dialogs/forecolor_spec.js.coffee
kiteditor-1.0.5 spec/javascripts/mercury/dialogs/forecolor_spec.js.coffee
kiteditor-1.0.4 spec/javascripts/mercury/dialogs/forecolor_spec.js.coffee