Sha256: e9004a3f960c13a7ee0e9bace641036430a10ee34492e34b1c48263bf04a83da

Contents?: true

Size: 1.15 KB

Versions: 11

Compression:

Stored size: 1.15 KB

Contents

u = up.util
$ = jQuery

describe 'up.toast', ->

  describe 'JavaScript functions', ->

    describe 'up.toast.open()', ->

      it 'opens a toast box with the given message', ->
        up.toast.open('This is a message')
        expect('.up-toast').toBeAttached()
        expect($('.up-toast-message').text()).toContain('This is a message')

      it 'opens a toast box with a close link', ->
        up.toast.open('This is a message')
        expect('.up-toast').toBeAttached()
        $closeButton = $('.up-toast-action:contains("Close")')
        expect($closeButton).toBeAttached()

        Trigger.clickSequence($closeButton)

        expect('.up-toast').not.toBeAttached()

      it 'opens a toast box with the given custom action', ->
        action =
          label: 'Custom action'
          callback: jasmine.createSpy('action callback')
        up.toast.open('This is a message', { action })
        $actionButton = $('.up-toast-action:contains("Custom action")')
        expect($actionButton).toBeAttached()
        expect(action.callback).not.toHaveBeenCalled()

        Trigger.clickSequence($actionButton)

        expect(action.callback).toHaveBeenCalled()

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
unpoly-rails-1.0.3 spec_app/spec/javascripts/up/toast_spec.js.coffee
unpoly-rails-1.0.1 spec_app/spec/javascripts/up/toast_spec.js.coffee
unpoly-rails-1.0.0 spec_app/spec/javascripts/up/toast_spec.js.coffee
unpoly-rails-0.62.1 spec_app/spec/javascripts/up/toast_spec.js.coffee
unpoly-rails-0.62.0 spec_app/spec/javascripts/up/toast_spec.js.coffee
unpoly-rails-0.61.1 spec_app/spec/javascripts/up/toast_spec.js.coffee
unpoly-rails-0.61.0 spec_app/spec/javascripts/up/toast_spec.js.coffee
unpoly-rails-0.60.3 spec_app/spec/javascripts/up/toast_spec.js.coffee
unpoly-rails-0.60.2 spec_app/spec/javascripts/up/toast_spec.js.coffee
unpoly-rails-0.60.1 spec_app/spec/javascripts/up/toast_spec.js.coffee
unpoly-rails-0.60.0 spec_app/spec/javascripts/up/toast_spec.js.coffee