Sha256: 7da22f7983ae208a9504c72c1bc19edbc453375e37bdf2ef317c4618280f3a16

Contents?: true

Size: 1.6 KB

Versions: 15

Compression:

Stored size: 1.6 KB

Contents

describe 'up.util', ->
  
  describe 'Javascript functions', ->

    describe '.isBlank', ->
  
      it 'returns false for false', ->
        expect(up.util.isBlank(false)).toBe(false)
        
      it 'returns false for true', ->
        expect(up.util.isBlank(true)).toBe(false)
  
      it 'returns true for null', ->
        expect(up.util.isBlank(null)).toBe(true)
        
      it 'returns true for undefined', ->
        expect(up.util.isBlank(undefined)).toBe(true)
        
      it 'returns true for an empty String', ->
        expect(up.util.isBlank('')).toBe(true)
        
      it 'returns false for a String with at least one character', ->
        expect(up.util.isBlank('string')).toBe(false)
        
      it 'returns true for an empty array', ->
        expect(up.util.isBlank([])).toBe(true)
        
      it 'returns false for an array with at least one element', ->
        expect(up.util.isBlank(['element'])).toBe(false)

      it 'returns true for an empty object', ->
        expect(up.util.isBlank({})).toBe(true)

      it 'returns true for an object with at least one key', ->
        expect(up.util.isBlank({key: 'value'})).toBe(false)

    describe '.normalizeUrl', ->

      it 'normalizes a relative path', ->
        expect(up.util.normalizeUrl('foo')).toBe("http://#{location.hostname}:#{location.port}/foo")

      it 'normalizes an absolute path', ->
        expect(up.util.normalizeUrl('/foo')).toBe("http://#{location.hostname}:#{location.port}/foo")

      it 'normalizes a full URL', ->
        expect(up.util.normalizeUrl('http://example.com/foo/bar')).toBe('http://example.com/foo/bar')


Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
upjs-rails-0.7.5 spec_app/spec/javascripts/up/util_spec.js.coffee
upjs-rails-0.7.4 spec_app/spec/javascripts/up/util_spec.js.coffee
upjs-rails-0.7.3 spec_app/spec/javascripts/up/util_spec.js.coffee
upjs-rails-0.7.2 spec_app/spec/javascripts/up/util_spec.js.coffee
upjs-rails-0.7.1 spec_app/spec/javascripts/up/util_spec.js.coffee
upjs-rails-0.7.0 spec_app/spec/javascripts/up/util_spec.js.coffee
upjs-rails-0.6.5 spec_app/spec/javascripts/up/util_spec.js.coffee
upjs-rails-0.6.4 spec_app/spec/javascripts/up/util_spec.js.coffee
upjs-rails-0.6.3 spec_app/spec/javascripts/up/util_spec.js.coffee
upjs-rails-0.6.2 spec_app/spec/javascripts/up/util_spec.js.coffee
upjs-rails-0.6.1 spec_app/spec/javascripts/up/util_spec.js.coffee
upjs-rails-0.6.0 spec_app/spec/javascripts/up/util_spec.js.coffee
upjs-rails-0.5.0 spec_app/spec/javascripts/up/util_spec.js.coffee
upjs-rails-0.4.4 spec_app/spec/javascripts/up/util_spec.js.coffee
upjs-rails-0.4.3 spec_app/spec/javascripts/up/util_spec.js.coffee