Sha256: 52cf06a7330c8824770a246c335ecfd7ceebd94839f101273e1970d607b00094

Contents?: true

Size: 975 Bytes

Versions: 4

Compression:

Stored size: 975 Bytes

Contents

{assert, test, testGroup} = Trix.TestHelpers

testGroup "Trix.Attachment", ->
  previewableTypes = "image image/gif image/png image/jpg".split(" ")
  nonPreviewableTypes = "image/tiff application/foo".split(" ")

  createAttachment = (attributes) ->
    new Trix.Attachment attributes

  for contentType in previewableTypes then do (contentType) ->
    test "#{contentType} content type is previewable", ->
      assert.ok createAttachment({contentType}).isPreviewable()

  for contentType in nonPreviewableTypes then do (contentType) ->
    test "#{contentType} content type is NOT previewable", ->
      assert.notOk createAttachment({contentType}).isPreviewable()

  test "'previewable' attribute determines previewability", ->
    attrs = previewable: true, contentType: nonPreviewableTypes[0]
    assert.ok createAttachment(attrs).isPreviewable()

    attrs = previewable: false, contentType: previewableTypes[0]
    assert.notOk createAttachment(attrs).isPreviewable()

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
vapid-0.1.3 lib/vapid/vendor/trix/test/src/unit/attachment_test.coffee
vapid-0.1.2 lib/vapid/vendor/trix/test/src/unit/attachment_test.coffee
vapid-0.1.1 lib/vapid/vendor/trix/test/src/unit/attachment_test.coffee
vapid-0.1.0 lib/vapid/vendor/trix/test/src/unit/attachment_test.coffee