Sha256: 21c6150ce2c40a3b8d4aaa7d33f58e51075de6b8b700426e5cca801f9230687e

Contents?: true

Size: 1.53 KB

Versions: 31

Compression:

Stored size: 1.53 KB

Contents

describe "Mercury.Select", ->

  template 'mercury/select.html'

  beforeEach ->
    $.fx.off = true

  afterEach ->
    @select = null
    delete(@select)

  describe "#build", ->

    it "builds an element", ->
      @select = new Mercury.Select('/blank.html', 'foo', {appendTo: '#test', for: $('#button')})
      html = $('<div>').html(@select.element).html()
      expect(html).toContain('class="mercury-select mercury-foo-select loading"')
      expect(html).toContain('style="display:none"')

    it "appends to any element", ->
      @select = new Mercury.Select('/blank.html', 'foo', {appendTo: '#select_container', for: $('#button')})
      expect($('#select_container .mercury-select').length).toEqual(1)


  describe "observed events", ->

    beforeEach ->
      @select = new Mercury.Select('/blank.html', 'foo', {appendTo: '#test', for: $('#button')})

    it "hides", ->
      @select.element.css({display: 'block'})
      Mercury.trigger('hide:dialogs')
      expect(@select.element.css('display')).toEqual('none')

    it "doesn't hide if it's the same dialog", ->
      @select.element.css({display: 'block'})
      Mercury.trigger('hide:dialogs', @select)
      expect(@select.element.css('display')).toEqual('block')


  describe "#position", ->

    beforeEach ->
      @select = new Mercury.Select('/blank.html', 'foo', {appendTo: '#test', for: $('#button')})

    it "positions based on it's button", ->
      @select.element.css({display: 'block'})
      @select.position(true)
      expect(@select.element.offset()).toEqual({top: 20, left: 42})

Version data entries

31 entries across 31 versions & 3 rubygems

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