Sha256: 48d5e32c862759f679a008303b0602f5192feca62a118276e47509406245fcea

Contents?: true

Size: 1.44 KB

Versions: 4

Compression:

Stored size: 1.44 KB

Contents

describe 'Offcanvas', ->

  it 'Streusel.Offcanvas exist', ->
    expect(Streusel.Offcanvas).toBeDefined()

  describe 'Readmore object', ->

    beforeEach ->
      @el = affix('.offcanvas[data-streusel-offcanvas] .js-offcanvas__toggler+.offcanvas__overlay')
      @subject = Partystreusel.Offcanvas.init()[0]
      spyOnEvent('.offcanvas', 'offcanvas-open')
      spyOnEvent('.offcanvas', 'offcanvas-close')

    it 'toggles correcty with togger', ->
      expect(@el).not.toHaveClass('offcanvas--open')
      $('.js-offcanvas__toggler').trigger('click')
      expect(@el).toHaveClass('offcanvas--open')
      $('.js-offcanvas__toggler').trigger('click')
      expect(@el).not.toHaveClass('offcanvas--open')

    it 'closes correctly with overlay', ->
      expect(@el).not.toHaveClass('offcanvas--open')
      $('.js-offcanvas__toggler').trigger('click')
      expect(@el).toHaveClass('offcanvas--open')
      $('.offcanvas__overlay').trigger('click')
      expect(@el).not.toHaveClass('offcanvas--open')

    it 'triggers events', ->
      $('.js-offcanvas__toggler').trigger('click')
      expect('offcanvas-open').toHaveBeenTriggeredOnAndWith('.offcanvas', @el[0])
      expect('offcanvas-close').not.toHaveBeenTriggeredOnAndWith('.offcanvas', @el[0])
      $('.js-offcanvas__toggler').trigger('click')
      expect('offcanvas-open').toHaveBeenTriggeredOnAndWith('.offcanvas', @el[0])
      expect('offcanvas-close').toHaveBeenTriggeredOnAndWith('.offcanvas', @el[0])

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
partystreusel-2.0.0 spec/javascripts/partystreusel/offcanvas_spec.js.coffee
partystreusel-1.2.0 spec/javascripts/partystreusel/offcanvas_spec.js.coffee
partystreusel-1.1.1 spec/javascripts/partystreusel/offcanvas_spec.js.coffee
partystreusel-1.1.0 spec/javascripts/partystreusel/offcanvas_spec.js.coffee