forked from instructure/canvas-lms
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmediaCommentThumbnailSpec.coffee
More file actions
40 lines (35 loc) · 1.54 KB
/
Copy pathmediaCommentThumbnailSpec.coffee
File metadata and controls
40 lines (35 loc) · 1.54 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
define [
'jquery'
'underscore'
'compiled/jquery/mediaCommentThumbnail'
], ($, _)->
# fragile spec
QUnit.module 'mediaCommentThumbnail',
setup: ->
# flop out the _.defer function to just call directly down to the passed
# function reference. this helps the tests run in a synchronous order
# internally so asserts can work like we expect.
@stub _, 'defer', (func, args...) ->
func(args...)
@$fixtures = $('#fixtures')
teardown: ->
window.INST.kalturaSettings = null
$("#fixtures").empty()
test "creates a thumbnail span with a background image URL generated from kaltura settings and media id", ->
resourceDomain = 'resources.example.com'
mediaId = 'someExternalId'
partnerId = '12345'
mediaComment = $("""
<a id="media_comment_#{mediaId}" class="instructure_inline_media_comment video_comment" href="/media_objects/#{mediaId}">
this is a media comment
</a>
""")
window.INST.kalturaSettings = {
resource_domain: resourceDomain
partner_id: partnerId
}
@$fixtures.append mediaComment
# emulating the call from enhanceUserContent() in instructure.js
$('.instructure_inline_media_comment', @$fixtures).mediaCommentThumbnail('normal')
equal $('.media_comment_thumbnail', @$fixtures).length, 1
ok $('.media_comment_thumbnail', @$fixtures).first().css('background-image').indexOf("https://#{resourceDomain}/p/#{partnerId}/thumbnail/entry_id/#{mediaId}/width/140/height/100/bgcolor/000000/type/2/vid_sec/5") > 0