carousel.js 48.5 KB
Newer Older
1
$(function () {
2
  'use strict'
3

4
5
  window.Carousel = typeof bootstrap !== 'undefined' ? bootstrap.Carousel : Carousel

Johann-S's avatar
Johann-S committed
6
  var originWinPointerEvent = window.PointerEvent
Johann-S's avatar
Johann-S committed
7
  window.MSPointerEvent = null
Johann-S's avatar
Johann-S committed
8
9
10
11
12
13
14
15
16
17
18
19
  var supportPointerEvent = Boolean(window.PointerEvent || window.MSPointerEvent)

  function clearPointerEvents() {
    window.PointerEvent = null
  }

  function restorePointerEvents() {
    window.PointerEvent = originWinPointerEvent
  }

  var stylesCarousel = [
    '<style>',
patrickhlauke's avatar
patrickhlauke committed
20
    '  .carousel.pointer-event { -ms-touch-action: none; touch-action: none; }',
Johann-S's avatar
Johann-S committed
21
22
23
    '</style>'
  ].join('')

fat's avatar
fat committed
24
  QUnit.module('carousel plugin')
25

fat's avatar
fat committed
26
27
28
  QUnit.test('should be defined on jQuery object', function (assert) {
    assert.expect(1)
    assert.ok($(document.body).carousel, 'carousel method is defined')
XhmikosR's avatar
XhmikosR committed
29
  })
30

fat's avatar
fat committed
31
32
  QUnit.module('carousel', {
    beforeEach: function () {
33
34
35
      // Run all tests in noConflict mode -- it's the only way to ensure that the plugin works in noConflict mode
      $.fn.bootstrapCarousel = $.fn.carousel.noConflict()
    },
fat's avatar
fat committed
36
    afterEach: function () {
Johann-S's avatar
Johann-S committed
37
      $('.carousel').bootstrapCarousel('dispose')
38
39
      $.fn.carousel = $.fn.bootstrapCarousel
      delete $.fn.bootstrapCarousel
40
      $('#qunit-fixture').html('')
41
42
43
    }
  })

fat's avatar
fat committed
44
45
  QUnit.test('should provide no conflict', function (assert) {
    assert.expect(1)
XhmikosR's avatar
XhmikosR committed
46
    assert.strictEqual(typeof $.fn.carousel, 'undefined', 'carousel was set back to undefined (orig value)')
47
48
  })

49
50
51
52
53
54
55
56
57
58
59
60
61
62
  QUnit.test('should return version', function (assert) {
    assert.expect(1)

    assert.strictEqual(typeof Carousel.VERSION, 'string')
  })

  QUnit.test('should return default parameters', function (assert) {
    assert.expect(1)

    var defaultConfig = Carousel.Default

    assert.strictEqual(defaultConfig.touch, true)
  })

63
64
65
66
67
68
  QUnit.test('should throw explicit error on undefined method', function (assert) {
    assert.expect(1)
    var $el = $('<div/>')
    $el.bootstrapCarousel()
    try {
      $el.bootstrapCarousel('noMethod')
XhmikosR's avatar
XhmikosR committed
69
    } catch (err) {
70
71
72
73
      assert.strictEqual(err.message, 'No method named "noMethod"')
    }
  })

fat's avatar
fat committed
74
75
  QUnit.test('should return jquery collection containing the element', function (assert) {
    assert.expect(2)
76
77
    var $el = $('<div/>')
    var $carousel = $el.bootstrapCarousel()
fat's avatar
fat committed
78
79
    assert.ok($carousel instanceof $, 'returns jquery collection')
    assert.strictEqual($carousel[0], $el[0], 'collection contains element')
XhmikosR's avatar
XhmikosR committed
80
  })
81

fat's avatar
fat committed
82
  QUnit.test('should type check config options', function (assert) {
83
84
    assert.expect(2)

fat's avatar
fat committed
85
86
87
88
89
90
91
92
    var message
    var expectedMessage = 'CAROUSEL: Option "interval" provided type "string" but expected type "(number|boolean)".'
    var config = {
      interval: 'fat sux'
    }

    try {
      $('<div/>').bootstrapCarousel(config)
XhmikosR's avatar
XhmikosR committed
93
94
    } catch (err) {
      message = err.message
fat's avatar
fat committed
95
96
97
98
99
    }

    assert.ok(message === expectedMessage, 'correct error message')

    config = {
100
      keyboard: document.createElement('div')
fat's avatar
fat committed
101
102
103
104
105
    }
    expectedMessage = 'CAROUSEL: Option "keyboard" provided type "element" but expected type "boolean".'

    try {
      $('<div/>').bootstrapCarousel(config)
XhmikosR's avatar
XhmikosR committed
106
107
    } catch (err) {
      message = err.message
fat's avatar
fat committed
108
109
110
111
112
    }

    assert.ok(message === expectedMessage, 'correct error message')
  })

fat's avatar
fat committed
113
114
  QUnit.test('should not fire slid when slide is prevented', function (assert) {
    assert.expect(1)
115
    var done = assert.async()
Johann-S's avatar
Johann-S committed
116
117
118
119
120
121
122
123
124
125
126
127
    var $carousel = $('<div class="carousel"/>')
    $carousel.appendTo('#qunit-fixture')

    EventHandler.on($carousel[0], 'slide.bs.carousel', function (e) {
      e.preventDefault()
      assert.ok(true, 'slide event fired')
      done()
    })
    EventHandler.on($carousel[0], 'slid.bs.carousel', function () {
      assert.ok(false, 'slid event fired')
    })
    $carousel.bootstrapCarousel('next')
XhmikosR's avatar
XhmikosR committed
128
  })
129

fat's avatar
fat committed
130
131
  QUnit.test('should reset when slide is prevented', function (assert) {
    assert.expect(6)
XhmikosR's avatar
XhmikosR committed
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
    var carouselHTML = '<div id="carousel-example-generic" class="carousel slide">' +
        '<ol class="carousel-indicators">' +
        '<li data-target="#carousel-example-generic" data-slide-to="0" class="active"/>' +
        '<li data-target="#carousel-example-generic" data-slide-to="1"/>' +
        '<li data-target="#carousel-example-generic" data-slide-to="2"/>' +
        '</ol>' +
        '<div class="carousel-inner">' +
        '<div class="carousel-item active">' +
        '<div class="carousel-caption"/>' +
        '</div>' +
        '<div class="carousel-item">' +
        '<div class="carousel-caption"/>' +
        '</div>' +
        '<div class="carousel-item">' +
        '<div class="carousel-caption"/>' +
        '</div>' +
        '</div>' +
        '<a class="left carousel-control" href="#carousel-example-generic" data-slide="prev"/>' +
        '<a class="right carousel-control" href="#carousel-example-generic" data-slide="next"/>' +
        '</div>'
152
    var $carousel = $(carouselHTML)
Johann-S's avatar
Johann-S committed
153
    $carousel.appendTo('#qunit-fixture')
154

155
    var done = assert.async()
Johann-S's avatar
Johann-S committed
156
157
    EventHandler
      .one($carousel[0], 'slide.bs.carousel', function (e) {
158
159
        e.preventDefault()
        setTimeout(function () {
160
161
          assert.ok($carousel.find('.carousel-item:nth-child(1)').is('.active'), 'first item still active')
          assert.ok($carousel.find('.carousel-indicators li:nth-child(1)').is('.active'), 'first indicator still active')
162
163
164
          $carousel.bootstrapCarousel('next')
        }, 0)
      })
Johann-S's avatar
Johann-S committed
165
166
167

    EventHandler
      .one($carousel[0], 'slid.bs.carousel', function () {
168
        setTimeout(function () {
169
170
171
172
          assert.ok(!$carousel.find('.carousel-item:nth-child(1)').is('.active'), 'first item still active')
          assert.ok(!$carousel.find('.carousel-indicators li:nth-child(1)').is('.active'), 'first indicator still active')
          assert.ok($carousel.find('.carousel-item:nth-child(2)').is('.active'), 'second item active')
          assert.ok($carousel.find('.carousel-indicators li:nth-child(2)').is('.active'), 'second indicator active')
173
          done()
174
175
        }, 0)
      })
Johann-S's avatar
Johann-S committed
176
177

    $carousel.bootstrapCarousel('next')
XhmikosR's avatar
XhmikosR committed
178
  })
179

fat's avatar
fat committed
180
181
  QUnit.test('should fire slide event with direction', function (assert) {
    assert.expect(4)
XhmikosR's avatar
XhmikosR committed
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
    var carouselHTML = '<div id="myCarousel" class="carousel slide">' +
        '<div class="carousel-inner">' +
        '<div class="carousel-item active">' +
        '<img alt="">' +
        '<div class="carousel-caption">' +
        '<h4>First Thumbnail label</h4>' +
        '<p>Cras justo odio, dapibus ac facilisis in, egestas eget quam. Donec ' +
        'id elit non mi porta gravida at eget metus. Nullam id dolor id nibh ' +
        'ultricies vehicula ut id elit.</p>' +
        '</div>' +
        '</div>' +
        '<div class="carousel-item">' +
        '<img alt="">' +
        '<div class="carousel-caption">' +
        '<h4>Second Thumbnail label</h4>' +
        '<p>Cras justo odio, dapibus ac facilisis in, egestas eget quam. Donec ' +
        'id elit non mi porta gravida at eget metus. Nullam id dolor id nibh ' +
        'ultricies vehicula ut id elit.</p>' +
        '</div>' +
        '</div>' +
        '<div class="carousel-item">' +
        '<img alt="">' +
        '<div class="carousel-caption">' +
        '<h4>Third Thumbnail label</h4>' +
        '<p>Cras justo odio, dapibus ac facilisis in, egestas eget quam. Donec ' +
        'id elit non mi porta gravida at eget metus. Nullam id dolor id nibh ' +
        'ultricies vehicula ut id elit.</p>' +
        '</div>' +
        '</div>' +
        '</div>' +
        '<a class="left carousel-control" href="#myCarousel" data-slide="prev">&lsaquo;</a>' +
        '<a class="right carousel-control" href="#myCarousel" data-slide="next">&rsaquo;</a>' +
        '</div>'
215
    var $carousel = $(carouselHTML)
Johann-S's avatar
Johann-S committed
216
    $carousel.appendTo('#qunit-fixture')
217

218
    var done = assert.async()
219

Johann-S's avatar
Johann-S committed
220
221
    EventHandler
      .one($carousel[0], 'slide.bs.carousel', function (e) {
fat's avatar
fat committed
222
223
        assert.ok(e.direction, 'direction present on next')
        assert.strictEqual(e.direction, 'left', 'direction is left on next')
224

Johann-S's avatar
Johann-S committed
225
226
        EventHandler
          .one($carousel[0], 'slide.bs.carousel', function (e) {
fat's avatar
fat committed
227
228
            assert.ok(e.direction, 'direction present on prev')
            assert.strictEqual(e.direction, 'right', 'direction is right on prev')
229
            done()
230
          })
Johann-S's avatar
Johann-S committed
231
        $carousel.bootstrapCarousel('prev')
232
      })
Johann-S's avatar
Johann-S committed
233
    $carousel.bootstrapCarousel('next')
XhmikosR's avatar
XhmikosR committed
234
  })
235

fat's avatar
fat committed
236
237
  QUnit.test('should fire slid event with direction', function (assert) {
    assert.expect(4)
XhmikosR's avatar
XhmikosR committed
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
    var carouselHTML = '<div id="myCarousel" class="carousel slide">' +
        '<div class="carousel-inner">' +
        '<div class="carousel-item active">' +
        '<img alt="">' +
        '<div class="carousel-caption">' +
        '<h4>First Thumbnail label</h4>' +
        '<p>Cras justo odio, dapibus ac facilisis in, egestas eget quam. Donec ' +
        'id elit non mi porta gravida at eget metus. Nullam id dolor id nibh ' +
        'ultricies vehicula ut id elit.</p>' +
        '</div>' +
        '</div>' +
        '<div class="carousel-item">' +
        '<img alt="">' +
        '<div class="carousel-caption">' +
        '<h4>Second Thumbnail label</h4>' +
        '<p>Cras justo odio, dapibus ac facilisis in, egestas eget quam. Donec ' +
        'id elit non mi porta gravida at eget metus. Nullam id dolor id nibh ' +
        'ultricies vehicula ut id elit.</p>' +
        '</div>' +
        '</div>' +
        '<div class="carousel-item">' +
        '<img alt="">' +
        '<div class="carousel-caption">' +
        '<h4>Third Thumbnail label</h4>' +
        '<p>Cras justo odio, dapibus ac facilisis in, egestas eget quam. Donec ' +
        'id elit non mi porta gravida at eget metus. Nullam id dolor id nibh ' +
        'ultricies vehicula ut id elit.</p>' +
        '</div>' +
        '</div>' +
        '</div>' +
        '<a class="left carousel-control" href="#myCarousel" data-slide="prev">&lsaquo;</a>' +
        '<a class="right carousel-control" href="#myCarousel" data-slide="next">&rsaquo;</a>' +
        '</div>'
271
    var $carousel = $(carouselHTML)
Johann-S's avatar
Johann-S committed
272
    $carousel.appendTo('#qunit-fixture')
273

274
    var done = assert.async()
275

Johann-S's avatar
Johann-S committed
276
277
    EventHandler
      .one($carousel[0], 'slid.bs.carousel', function (e) {
fat's avatar
fat committed
278
279
        assert.ok(e.direction, 'direction present on next')
        assert.strictEqual(e.direction, 'left', 'direction is left on next')
280

Johann-S's avatar
Johann-S committed
281
282
        EventHandler
          .one($carousel[0], 'slid.bs.carousel', function (e) {
fat's avatar
fat committed
283
284
            assert.ok(e.direction, 'direction present on prev')
            assert.strictEqual(e.direction, 'right', 'direction is right on prev')
285
            done()
286
          })
Johann-S's avatar
Johann-S committed
287
        $carousel.bootstrapCarousel('prev')
288
      })
Johann-S's avatar
Johann-S committed
289
    $carousel.bootstrapCarousel('next')
290
291
  })

fat's avatar
fat committed
292
293
  QUnit.test('should fire slide event with relatedTarget', function (assert) {
    assert.expect(2)
XhmikosR's avatar
XhmikosR committed
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
    var template = '<div id="myCarousel" class="carousel slide">' +
        '<div class="carousel-inner">' +
        '<div class="carousel-item active">' +
        '<img alt="">' +
        '<div class="carousel-caption">' +
        '<h4>First Thumbnail label</h4>' +
        '<p>Cras justo odio, dapibus ac facilisis in, egestas eget quam. Donec ' +
        'id elit non mi porta gravida at eget metus. Nullam id dolor id nibh ' +
        'ultricies vehicula ut id elit.</p>' +
        '</div>' +
        '</div>' +
        '<div class="carousel-item">' +
        '<img alt="">' +
        '<div class="carousel-caption">' +
        '<h4>Second Thumbnail label</h4>' +
        '<p>Cras justo odio, dapibus ac facilisis in, egestas eget quam. Donec ' +
        'id elit non mi porta gravida at eget metus. Nullam id dolor id nibh ' +
        'ultricies vehicula ut id elit.</p>' +
        '</div>' +
        '</div>' +
        '<div class="carousel-item">' +
        '<img alt="">' +
        '<div class="carousel-caption">' +
        '<h4>Third Thumbnail label</h4>' +
        '<p>Cras justo odio, dapibus ac facilisis in, egestas eget quam. Donec ' +
        'id elit non mi porta gravida at eget metus. Nullam id dolor id nibh ' +
        'ultricies vehicula ut id elit.</p>' +
        '</div>' +
        '</div>' +
        '</div>' +
        '<a class="left carousel-control" href="#myCarousel" data-slide="prev">&lsaquo;</a>' +
        '<a class="right carousel-control" href="#myCarousel" data-slide="next">&rsaquo;</a>' +
        '</div>'
327

328
    var done = assert.async()
Johann-S's avatar
Johann-S committed
329
330
    var $carousel = $(template)
    $carousel.appendTo('#qunit-fixture')
331

Johann-S's avatar
Johann-S committed
332
333
    EventHandler
      .one($carousel[0], 'slide.bs.carousel', function (e) {
fat's avatar
fat committed
334
        assert.ok(e.relatedTarget, 'relatedTarget present')
fat's avatar
fat committed
335
        assert.ok($(e.relatedTarget).hasClass('carousel-item'), 'relatedTarget has class "item"')
336
        done()
Dmitriy Budnik's avatar
Dmitriy Budnik committed
337
      })
Johann-S's avatar
Johann-S committed
338
339

    $carousel.bootstrapCarousel('next')
XhmikosR's avatar
XhmikosR committed
340
  })
341

fat's avatar
fat committed
342
343
  QUnit.test('should fire slid event with relatedTarget', function (assert) {
    assert.expect(2)
XhmikosR's avatar
XhmikosR committed
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
    var template = '<div id="myCarousel" class="carousel slide">' +
        '<div class="carousel-inner">' +
        '<div class="carousel-item active">' +
        '<img alt="">' +
        '<div class="carousel-caption">' +
        '<h4>First Thumbnail label</h4>' +
        '<p>Cras justo odio, dapibus ac facilisis in, egestas eget quam. Donec ' +
        'id elit non mi porta gravida at eget metus. Nullam id dolor id nibh ' +
        'ultricies vehicula ut id elit.</p>' +
        '</div>' +
        '</div>' +
        '<div class="carousel-item">' +
        '<img alt="">' +
        '<div class="carousel-caption">' +
        '<h4>Second Thumbnail label</h4>' +
        '<p>Cras justo odio, dapibus ac facilisis in, egestas eget quam. Donec ' +
        'id elit non mi porta gravida at eget metus. Nullam id dolor id nibh ' +
        'ultricies vehicula ut id elit.</p>' +
        '</div>' +
        '</div>' +
        '<div class="carousel-item">' +
        '<img alt="">' +
        '<div class="carousel-caption">' +
        '<h4>Third Thumbnail label</h4>' +
        '<p>Cras justo odio, dapibus ac facilisis in, egestas eget quam. Donec ' +
        'id elit non mi porta gravida at eget metus. Nullam id dolor id nibh ' +
        'ultricies vehicula ut id elit.</p>' +
        '</div>' +
        '</div>' +
        '</div>' +
        '<a class="left carousel-control" href="#myCarousel" data-slide="prev">&lsaquo;</a>' +
        '<a class="right carousel-control" href="#myCarousel" data-slide="next">&rsaquo;</a>' +
        '</div>'
377

378
    var done = assert.async()
Johann-S's avatar
Johann-S committed
379
380
    var $carousel = $(template)
    $carousel.appendTo('#qunit-fixture')
381

Johann-S's avatar
Johann-S committed
382
383
    EventHandler
      .one($carousel[0], 'slid.bs.carousel', function (e) {
fat's avatar
fat committed
384
        assert.ok(e.relatedTarget, 'relatedTarget present')
fat's avatar
fat committed
385
        assert.ok($(e.relatedTarget).hasClass('carousel-item'), 'relatedTarget has class "item"')
386
        done()
387
      })
Johann-S's avatar
Johann-S committed
388
389

    $carousel.bootstrapCarousel('next')
390
  })
391

392
393
  QUnit.test('should fire slid and slide events with from and to', function (assert) {
    assert.expect(4)
XhmikosR's avatar
XhmikosR committed
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
    var template = '<div id="myCarousel" class="carousel slide">' +
        '<div class="carousel-inner">' +
        '<div class="carousel-item active">' +
        '<img alt="">' +
        '<div class="carousel-caption">' +
        '<h4>First Thumbnail label</h4>' +
        '</div>' +
        '</div>' +
        '<div class="carousel-item">' +
        '<img alt="">' +
        '<div class="carousel-caption">' +
        '<h4>Second Thumbnail label</h4>' +
        '</div>' +
        '</div>' +
        '<div class="carousel-item">' +
        '<img alt="">' +
        '<div class="carousel-caption">' +
        '<h4>Third Thumbnail label</h4>' +
        '</div>' +
        '</div>' +
        '</div>' +
        '<a class="left carousel-control" href="#myCarousel" data-slide="prev">&lsaquo;</a>' +
        '<a class="right carousel-control" href="#myCarousel" data-slide="next">&rsaquo;</a>' +
        '</div>'
418
419

    var done = assert.async()
Johann-S's avatar
Johann-S committed
420
421
422
423
    var $carousel = $(template)

    EventHandler
      .one($carousel[0], 'slid.bs.carousel', function (e) {
XhmikosR's avatar
XhmikosR committed
424
425
        assert.ok(typeof e.from !== 'undefined', 'from present')
        assert.ok(typeof e.to !== 'undefined', 'to present')
426
427
        done()
      })
Johann-S's avatar
Johann-S committed
428
429
430

    EventHandler
      .one($carousel[0], 'slide.bs.carousel', function (e) {
XhmikosR's avatar
XhmikosR committed
431
432
        assert.ok(typeof e.from !== 'undefined', 'from present')
        assert.ok(typeof e.to !== 'undefined', 'to present')
433
      })
Johann-S's avatar
Johann-S committed
434
435

    $carousel.bootstrapCarousel('next')
436
437
  })

fat's avatar
fat committed
438
439
  QUnit.test('should set interval from data attribute', function (assert) {
    assert.expect(4)
XhmikosR's avatar
XhmikosR committed
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
    var templateHTML = '<div id="myCarousel" class="carousel slide">' +
        '<div class="carousel-inner">' +
        '<div class="carousel-item active">' +
        '<img alt="">' +
        '<div class="carousel-caption">' +
        '<h4>First Thumbnail label</h4>' +
        '<p>Cras justo odio, dapibus ac facilisis in, egestas eget quam. Donec ' +
        'id elit non mi porta gravida at eget metus. Nullam id dolor id nibh ' +
        'ultricies vehicula ut id elit.</p>' +
        '</div>' +
        '</div>' +
        '<div class="carousel-item">' +
        '<img alt="">' +
        '<div class="carousel-caption">' +
        '<h4>Second Thumbnail label</h4>' +
        '<p>Cras justo odio, dapibus ac facilisis in, egestas eget quam. Donec ' +
        'id elit non mi porta gravida at eget metus. Nullam id dolor id nibh ' +
        'ultricies vehicula ut id elit.</p>' +
        '</div>' +
        '</div>' +
        '<div class="carousel-item">' +
        '<img alt="">' +
        '<div class="carousel-caption">' +
        '<h4>Third Thumbnail label</h4>' +
        '<p>Cras justo odio, dapibus ac facilisis in, egestas eget quam. Donec ' +
        'id elit non mi porta gravida at eget metus. Nullam id dolor id nibh ' +
        'ultricies vehicula ut id elit.</p>' +
        '</div>' +
        '</div>' +
        '</div>' +
        '<a class="left carousel-control" href="#myCarousel" data-slide="prev">&lsaquo;</a>' +
        '<a class="right carousel-control" href="#myCarousel" data-slide="next">&rsaquo;</a>' +
        '</div>'
473
474
    var $carousel = $(templateHTML)
    $carousel.attr('data-interval', 1814)
Dmitriy Budnik's avatar
Dmitriy Budnik committed
475

476
    $carousel.appendTo('body')
Johann-S's avatar
Johann-S committed
477
478
    EventHandler.trigger($('[data-slide]').first()[0], 'click')
    assert.strictEqual(Data.getData($carousel[0], 'bs.carousel')._config.interval, 1814)
479
    $carousel.remove()
dmitriybudnik's avatar
dmitriybudnik committed
480

481
    $carousel.appendTo('body').attr('data-modal', 'foobar')
Johann-S's avatar
Johann-S committed
482
483
    EventHandler.trigger($('[data-slide]').first()[0], 'click')
    assert.strictEqual(Data.getData($carousel[0], 'bs.carousel')._config.interval, 1814, 'even if there is an data-modal attribute set')
484
    $carousel.remove()
Dmitriy Budnik's avatar
Dmitriy Budnik committed
485

486
    $carousel.appendTo('body')
Johann-S's avatar
Johann-S committed
487
    EventHandler.trigger($('[data-slide]').first()[0], 'click')
488
    $carousel.attr('data-interval', 1860)
Johann-S's avatar
Johann-S committed
489
490
491
    EventHandler.trigger($('[data-slide]').first()[0], 'click')
    assert.strictEqual(Data.getData($carousel[0], 'bs.carousel')._config.interval, 1814, 'attributes should be read only on initialization')
    $carousel.bootstrapCarousel('dispose')
492
493
494
495
496
    $carousel.remove()

    $carousel.attr('data-interval', false)
    $carousel.appendTo('body')
    $carousel.bootstrapCarousel(1)
Johann-S's avatar
Johann-S committed
497
    assert.strictEqual(Data.getData($carousel[0], 'bs.carousel')._config.interval, false, 'data attribute has higher priority than default options')
498
    $carousel.remove()
XhmikosR's avatar
XhmikosR committed
499
  })
500

501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
  QUnit.test('should set interval from data attribute on individual carousel-item', function (assert) {
    assert.expect(2)
    var templateHTML = '<div id="myCarousel" class="carousel slide" data-interval="1814">' +
        '<div class="carousel-inner">' +
        '<div class="carousel-item active" data-interval="2814">' +
        '<img alt="">' +
        '<div class="carousel-caption">' +
        '<h4>First Thumbnail label</h4>' +
        '<p>Cras justo odio, dapibus ac facilisis in, egestas eget quam. Donec ' +
        'id elit non mi porta gravida at eget metus. Nullam id dolor id nibh ' +
        'ultricies vehicula ut id elit.</p>' +
        '</div>' +
        '</div>' +
        '<div class="carousel-item" data-interval="3814">' +
        '<img alt="">' +
        '<div class="carousel-caption">' +
        '<h4>Second Thumbnail label</h4>' +
        '<p>Cras justo odio, dapibus ac facilisis in, egestas eget quam. Donec ' +
        'id elit non mi porta gravida at eget metus. Nullam id dolor id nibh ' +
        'ultricies vehicula ut id elit.</p>' +
        '</div>' +
        '</div>' +
        '<div class="carousel-item">' +
        '<img alt="">' +
        '<div class="carousel-caption">' +
        '<h4>Third Thumbnail label</h4>' +
        '<p>Cras justo odio, dapibus ac facilisis in, egestas eget quam. Donec ' +
        'id elit non mi porta gravida at eget metus. Nullam id dolor id nibh ' +
        'ultricies vehicula ut id elit.</p>' +
        '</div>' +
        '</div>' +
        '</div>' +
        '<a class="left carousel-control" href="#myCarousel" data-slide="prev">&lsaquo;</a>' +
        '<a class="right carousel-control" href="#myCarousel" data-slide="next">&rsaquo;</a>' +
        '</div>'
    var $carousel = $(templateHTML)

    $carousel.appendTo('body')
    $carousel.bootstrapCarousel(1)
    assert.strictEqual($carousel.data('bs.carousel')._config.interval, 3814)
    $carousel.remove()

    $carousel.appendTo('body')
    $carousel.bootstrapCarousel(2)
    assert.strictEqual($carousel.data('bs.carousel')._config.interval, 1814, 'reverts to default interval if no data-interval is set')
    $carousel.remove()
  })

fat's avatar
fat committed
549
550
  QUnit.test('should skip over non-items when using item indices', function (assert) {
    assert.expect(2)
XhmikosR's avatar
XhmikosR committed
551
552
553
554
555
556
557
558
559
560
561
562
563
    var templateHTML = '<div id="myCarousel" class="carousel" data-interval="1814">' +
        '<div class="carousel-inner">' +
        '<div class="carousel-item active">' +
        '<img alt="">' +
        '</div>' +
        '<script type="text/x-metamorph" id="thingy"/>' +
        '<div class="carousel-item">' +
        '<img alt="">' +
        '</div>' +
        '<div class="carousel-item">' +
        '</div>' +
        '</div>' +
        '</div>'
564
    var $template = $(templateHTML)
565

566
    $template.bootstrapCarousel()
567

fat's avatar
fat committed
568
    assert.strictEqual($template.find('.carousel-item')[0], $template.find('.active')[0], 'first item active')
569

570
    $template.bootstrapCarousel(1)
571

fat's avatar
fat committed
572
    assert.strictEqual($template.find('.carousel-item')[1], $template.find('.active')[0], 'second item active')
573
  })
574

fat's avatar
fat committed
575
576
  QUnit.test('should skip over non-items when using next/prev methods', function (assert) {
    assert.expect(2)
XhmikosR's avatar
XhmikosR committed
577
578
579
580
581
582
583
584
585
586
587
588
589
    var templateHTML = '<div id="myCarousel" class="carousel" data-interval="1814">' +
        '<div class="carousel-inner">' +
        '<div class="carousel-item active">' +
        '<img alt="">' +
        '</div>' +
        '<script type="text/x-metamorph" id="thingy"/>' +
        '<div class="carousel-item">' +
        '<img alt="">' +
        '</div>' +
        '<div class="carousel-item">' +
        '</div>' +
        '</div>' +
        '</div>'
590
591
592
593
    var $template = $(templateHTML)

    $template.bootstrapCarousel()

fat's avatar
fat committed
594
    assert.strictEqual($template.find('.carousel-item')[0], $template.find('.active')[0], 'first item active')
595
596
597

    $template.bootstrapCarousel('next')

fat's avatar
fat committed
598
    assert.strictEqual($template.find('.carousel-item')[1], $template.find('.active')[0], 'second item active')
599
  })
600

fat's avatar
fat committed
601
602
  QUnit.test('should go to previous item if left arrow key is pressed', function (assert) {
    assert.expect(2)
XhmikosR's avatar
XhmikosR committed
603
604
605
606
607
608
609
610
611
612
613
614
615
    var templateHTML = '<div id="myCarousel" class="carousel" data-interval="false">' +
        '<div class="carousel-inner">' +
        '<div id="first" class="carousel-item">' +
        '<img alt="">' +
        '</div>' +
        '<div id="second" class="carousel-item active">' +
        '<img alt="">' +
        '</div>' +
        '<div id="third" class="carousel-item">' +
        '<img alt="">' +
        '</div>' +
        '</div>' +
        '</div>'
616
617
618
619
    var $template = $(templateHTML)

    $template.bootstrapCarousel()

fat's avatar
fat committed
620
    assert.strictEqual($template.find('.carousel-item')[1], $template.find('.active')[0], 'second item active')
621

Johann-S's avatar
Johann-S committed
622
<<<<<<< HEAD
XhmikosR's avatar
XhmikosR committed
623
624
625
    $template.trigger($.Event('keydown', {
      which: 37
    }))
Johann-S's avatar
Johann-S committed
626
627
628
=======
    EventHandler.trigger($template[0], 'keydown', { which: 37 })
>>>>>>> fix unit test for carousel
629

fat's avatar
fat committed
630
    assert.strictEqual($template.find('.carousel-item')[0], $template.find('.active')[0], 'first item active')
631
632
  })

fat's avatar
fat committed
633
634
  QUnit.test('should go to next item if right arrow key is pressed', function (assert) {
    assert.expect(2)
XhmikosR's avatar
XhmikosR committed
635
636
637
638
639
640
641
642
643
644
645
646
647
    var templateHTML = '<div id="myCarousel" class="carousel" data-interval="false">' +
        '<div class="carousel-inner">' +
        '<div id="first" class="carousel-item active">' +
        '<img alt="">' +
        '</div>' +
        '<div id="second" class="carousel-item">' +
        '<img alt="">' +
        '</div>' +
        '<div id="third" class="carousel-item">' +
        '<img alt="">' +
        '</div>' +
        '</div>' +
        '</div>'
648
649
650
651
    var $template = $(templateHTML)

    $template.bootstrapCarousel()

fat's avatar
fat committed
652
    assert.strictEqual($template.find('.carousel-item')[0], $template.find('.active')[0], 'first item active')
653

Johann-S's avatar
Johann-S committed
654
<<<<<<< HEAD
XhmikosR's avatar
XhmikosR committed
655
656
657
    $template.trigger($.Event('keydown', {
      which: 39
    }))
Johann-S's avatar
Johann-S committed
658
659
660
=======
    EventHandler.trigger($template[0], 'keydown', { which: 39 })
>>>>>>> fix unit test for carousel
661

fat's avatar
fat committed
662
    assert.strictEqual($template.find('.carousel-item')[1], $template.find('.active')[0], 'second item active')
663
664
  })

665
666
  QUnit.test('should not prevent keydown if key is not ARROW_LEFT or ARROW_RIGHT', function (assert) {
    assert.expect(2)
XhmikosR's avatar
XhmikosR committed
667
668
669
670
671
672
673
    var templateHTML = '<div id="myCarousel" class="carousel" data-interval="false">' +
        '<div class="carousel-inner">' +
        '<div id="first" class="carousel-item active">' +
        '<img alt="">' +
        '</div>' +
        '</div>' +
        '</div>'
674
675
676
677
678
    var $template = $(templateHTML)

    $template.bootstrapCarousel()
    var done = assert.async()

Johann-S's avatar
Johann-S committed
679
<<<<<<< HEAD
XhmikosR's avatar
XhmikosR committed
680
681
682
683
684
685
    var eventArrowDown = $.Event('keydown', {
      which: 40
    })
    var eventArrowUp   = $.Event('keydown', {
      which: 38
    })
686
687
688

    $template.one('keydown', function (event) {
      assert.strictEqual(event.isDefaultPrevented(), false)
Johann-S's avatar
Johann-S committed
689
690
691
692
=======
    EventHandler.one($template[0], 'keydown', function (event) {
      assert.strictEqual(event.defaultPrevented, false)
>>>>>>> fix unit test for carousel
693
694
    })

Johann-S's avatar
Johann-S committed
695
696
    // arrow down
    EventHandler.trigger($template[0], 'keydown', { which: 40 })
697

Johann-S's avatar
Johann-S committed
698
699
    EventHandler.one($template[0], 'keydown', function (event) {
      assert.strictEqual(event.defaultPrevented, false)
700
701
702
      done()
    })

Johann-S's avatar
Johann-S committed
703
704
    // arrow up
    EventHandler.trigger($template[0], 'keydown', { which: 38 })
705
706
  })

fat's avatar
fat committed
707
708
  QUnit.test('should support disabling the keyboard navigation', function (assert) {
    assert.expect(3)
XhmikosR's avatar
XhmikosR committed
709
710
711
712
713
714
715
716
717
718
719
720
721
    var templateHTML = '<div id="myCarousel" class="carousel" data-interval="false" data-keyboard="false">' +
        '<div class="carousel-inner">' +
        '<div id="first" class="carousel-item active">' +
        '<img alt="">' +
        '</div>' +
        '<div id="second" class="carousel-item">' +
        '<img alt="">' +
        '</div>' +
        '<div id="third" class="carousel-item">' +
        '<img alt="">' +
        '</div>' +
        '</div>' +
        '</div>'
722
723
724
725
    var $template = $(templateHTML)

    $template.bootstrapCarousel()

fat's avatar
fat committed
726
    assert.strictEqual($template.find('.carousel-item')[0], $template.find('.active')[0], 'first item active')
727

XhmikosR's avatar
XhmikosR committed
728
729
730
    $template.trigger($.Event('keydown', {
      which: 39
    }))
731

fat's avatar
fat committed
732
    assert.strictEqual($template.find('.carousel-item')[0], $template.find('.active')[0], 'first item still active after right arrow press')
733

XhmikosR's avatar
XhmikosR committed
734
735
736
    $template.trigger($.Event('keydown', {
      which: 37
    }))
737

fat's avatar
fat committed
738
    assert.strictEqual($template.find('.carousel-item')[0], $template.find('.active')[0], 'first item still active after left arrow press')
739
740
  })

fat's avatar
fat committed
741
742
  QUnit.test('should ignore keyboard events within <input>s and <textarea>s', function (assert) {
    assert.expect(7)
XhmikosR's avatar
XhmikosR committed
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
    var templateHTML = '<div id="myCarousel" class="carousel" data-interval="false">' +
        '<div class="carousel-inner">' +
        '<div id="first" class="carousel-item active">' +
        '<img alt="">' +
        '<input type="text" id="in-put">' +
        '<textarea id="text-area"></textarea>' +
        '</div>' +
        '<div id="second" class="carousel-item">' +
        '<img alt="">' +
        '</div>' +
        '<div id="third" class="carousel-item">' +
        '<img alt="">' +
        '</div>' +
        '</div>' +
        '</div>'
758
759
760
761
    var $template = $(templateHTML)
    var $input = $template.find('#in-put')
    var $textarea = $template.find('#text-area')

fat's avatar
fat committed
762
763
    assert.strictEqual($input.length, 1, 'found <input>')
    assert.strictEqual($textarea.length, 1, 'found <textarea>')
764
765
766

    $template.bootstrapCarousel()

fat's avatar
fat committed
767
    assert.strictEqual($template.find('.carousel-item')[0], $template.find('.active')[0], 'first item active')
768

XhmikosR's avatar
XhmikosR committed
769
770
771
    $input.trigger($.Event('keydown', {
      which: 39
    }))
fat's avatar
fat committed
772
    assert.strictEqual($template.find('.carousel-item')[0], $template.find('.active')[0], 'first item still active after right arrow press in <input>')
773

XhmikosR's avatar
XhmikosR committed
774
775
776
    $input.trigger($.Event('keydown', {
      which: 37
    }))
fat's avatar
fat committed
777
    assert.strictEqual($template.find('.carousel-item')[0], $template.find('.active')[0], 'first item still active after left arrow press in <input>')
778

XhmikosR's avatar
XhmikosR committed
779
780
781
    $textarea.trigger($.Event('keydown', {
      which: 39
    }))
fat's avatar
fat committed
782
    assert.strictEqual($template.find('.carousel-item')[0], $template.find('.active')[0], 'first item still active after right arrow press in <textarea>')
783

XhmikosR's avatar
XhmikosR committed
784
785
786
    $textarea.trigger($.Event('keydown', {
      which: 37
    }))
fat's avatar
fat committed
787
    assert.strictEqual($template.find('.carousel-item')[0], $template.find('.active')[0], 'first item still active after left arrow press in <textarea>')
788
789
  })

fat's avatar
fat committed
790
791
  QUnit.test('should wrap around from end to start when wrap option is true', function (assert) {
    assert.expect(3)
XhmikosR's avatar
XhmikosR committed
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
    var carouselHTML = '<div id="carousel-example-generic" class="carousel slide" data-wrap="true">' +
        '<ol class="carousel-indicators">' +
        '<li data-target="#carousel-example-generic" data-slide-to="0" class="active"/>' +
        '<li data-target="#carousel-example-generic" data-slide-to="1"/>' +
        '<li data-target="#carousel-example-generic" data-slide-to="2"/>' +
        '</ol>' +
        '<div class="carousel-inner">' +
        '<div class="carousel-item active" id="one">' +
        '<div class="carousel-caption"/>' +
        '</div>' +
        '<div class="carousel-item" id="two">' +
        '<div class="carousel-caption"/>' +
        '</div>' +
        '<div class="carousel-item" id="three">' +
        '<div class="carousel-caption"/>' +
        '</div>' +
        '</div>' +
        '<a class="left carousel-control" href="#carousel-example-generic" data-slide="prev"/>' +
        '<a class="right carousel-control" href="#carousel-example-generic" data-slide="next"/>' +
        '</div>'
812
    var $carousel = $(carouselHTML)
XhmikosR's avatar
XhmikosR committed
813
814
815
    var getActiveId = function () {
      return $carousel.find('.carousel-item.active').attr('id')
    }
816

817
    var done = assert.async()
818

Johann-S's avatar
Johann-S committed
819
820
821
822
823
824
825
826
827
828
829
    EventHandler.one($carousel[0], 'slid.bs.carousel', function () {
      assert.strictEqual(getActiveId(), 'two', 'carousel slid from 1st to 2nd slide')

      EventHandler.one($carousel[0], 'slid.bs.carousel', function () {
        assert.strictEqual(getActiveId(), 'three', 'carousel slid from 2nd to 3rd slide')

        EventHandler.one($carousel[0], 'slid.bs.carousel', function () {
          assert.strictEqual(getActiveId(), 'one', 'carousel wrapped around and slid from 3rd to 1st slide')
          done()
        })
        $carousel.bootstrapCarousel('next')
830
      })
Johann-S's avatar
Johann-S committed
831
832
833
      $carousel.bootstrapCarousel('next')
    })
    $carousel.bootstrapCarousel('next')
834
835
  })

fat's avatar
fat committed
836
837
  QUnit.test('should wrap around from start to end when wrap option is true', function (assert) {
    assert.expect(1)
XhmikosR's avatar
XhmikosR committed
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
    var carouselHTML = '<div id="carousel-example-generic" class="carousel slide" data-wrap="true">' +
        '<ol class="carousel-indicators">' +
        '<li data-target="#carousel-example-generic" data-slide-to="0" class="active"/>' +
        '<li data-target="#carousel-example-generic" data-slide-to="1"/>' +
        '<li data-target="#carousel-example-generic" data-slide-to="2"/>' +
        '</ol>' +
        '<div class="carousel-inner">' +
        '<div class="carousel-item active" id="one">' +
        '<div class="carousel-caption"/>' +
        '</div>' +
        '<div class="carousel-item" id="two">' +
        '<div class="carousel-caption"/>' +
        '</div>' +
        '<div class="carousel-item" id="three">' +
        '<div class="carousel-caption"/>' +
        '</div>' +
        '</div>' +
        '<a class="left carousel-control" href="#carousel-example-generic" data-slide="prev"/>' +
        '<a class="right carousel-control" href="#carousel-example-generic" data-slide="next"/>' +
        '</div>'
858
859
    var $carousel = $(carouselHTML)

860
    var done = assert.async()
861

Johann-S's avatar
Johann-S committed
862
863
864
865
866
    EventHandler.one($carousel[0], 'slid.bs.carousel', function () {
      assert.strictEqual($carousel.find('.carousel-item.active').attr('id'), 'three', 'carousel wrapped around and slid from 1st to 3rd slide')
      done()
    })
    $carousel.bootstrapCarousel('prev')
867
868
  })

fat's avatar
fat committed
869
870
  QUnit.test('should stay at the end when the next method is called and wrap is false', function (assert) {
    assert.expect(3)
XhmikosR's avatar
XhmikosR committed
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
    var carouselHTML = '<div id="carousel-example-generic" class="carousel slide" data-wrap="false">' +
        '<ol class="carousel-indicators">' +
        '<li data-target="#carousel-example-generic" data-slide-to="0" class="active"/>' +
        '<li data-target="#carousel-example-generic" data-slide-to="1"/>' +
        '<li data-target="#carousel-example-generic" data-slide-to="2"/>' +
        '</ol>' +
        '<div class="carousel-inner">' +
        '<div class="carousel-item active" id="one">' +
        '<div class="carousel-caption"/>' +
        '</div>' +
        '<div class="carousel-item" id="two">' +
        '<div class="carousel-caption"/>' +
        '</div>' +
        '<div class="carousel-item" id="three">' +
        '<div class="carousel-caption"/>' +
        '</div>' +
        '</div>' +
        '<a class="left carousel-control" href="#carousel-example-generic" data-slide="prev"/>' +
        '<a class="right carousel-control" href="#carousel-example-generic" data-slide="next"/>' +
        '</div>'
891
    var $carousel = $(carouselHTML)
XhmikosR's avatar
XhmikosR committed
892
893
894
    var getActiveId = function () {
      return $carousel.find('.carousel-item.active').attr('id')
    }
895

896
    var done = assert.async()
897

Johann-S's avatar
Johann-S committed
898
899
900
901
902
903
904
905
906
907
908
909
    EventHandler.one($carousel[0], 'slid.bs.carousel', function () {
      assert.strictEqual(getActiveId(), 'two', 'carousel slid from 1st to 2nd slide')

      EventHandler.one($carousel[0], 'slid.bs.carousel', function () {
        assert.strictEqual(getActiveId(), 'three', 'carousel slid from 2nd to 3rd slide')

        EventHandler.one($carousel[0], 'slid.bs.carousel', function () {
          assert.ok(false, 'carousel slid when it should not have slid')
        })
        $carousel.bootstrapCarousel('next')
        assert.strictEqual(getActiveId(), 'three', 'carousel did not wrap around and stayed on 3rd slide')
        done()
910
      })
Johann-S's avatar
Johann-S committed
911
912
913
      $carousel.bootstrapCarousel('next')
    })
    $carousel.bootstrapCarousel('next')
914
915
  })

fat's avatar
fat committed
916
917
  QUnit.test('should stay at the start when the prev method is called and wrap is false', function (assert) {
    assert.expect(1)
XhmikosR's avatar
XhmikosR committed
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
    var carouselHTML = '<div id="carousel-example-generic" class="carousel slide" data-wrap="false">' +
        '<ol class="carousel-indicators">' +
        '<li data-target="#carousel-example-generic" data-slide-to="0" class="active"/>' +
        '<li data-target="#carousel-example-generic" data-slide-to="1"/>' +
        '<li data-target="#carousel-example-generic" data-slide-to="2"/>' +
        '</ol>' +
        '<div class="carousel-inner">' +
        '<div class="carousel-item active" id="one">' +
        '<div class="carousel-caption"/>' +
        '</div>' +
        '<div class="carousel-item" id="two">' +
        '<div class="carousel-caption"/>' +
        '</div>' +
        '<div class="carousel-item" id="three">' +
        '<div class="carousel-caption"/>' +
        '</div>' +
        '</div>' +
        '<a class="left carousel-control" href="#carousel-example-generic" data-slide="prev"/>' +
        '<a class="right carousel-control" href="#carousel-example-generic" data-slide="next"/>' +
        '</div>'
938
939
    var $carousel = $(carouselHTML)

Johann-S's avatar
Johann-S committed
940
941
942
943
    EventHandler.one($carousel[0], 'slid.bs.carousel', function () {
      assert.ok(false, 'carousel slid when it should not have slid')
    })
    $carousel.bootstrapCarousel('prev')
fat's avatar
fat committed
944
    assert.strictEqual($carousel.find('.carousel-item.active').attr('id'), 'one', 'carousel did not wrap around and stayed on 1st slide')
945
  })
946
947
948

  QUnit.test('should not prevent keydown for inputs and textareas', function (assert) {
    assert.expect(2)
XhmikosR's avatar
XhmikosR committed
949
950
951
952
953
954
955
956
957
958
    var templateHTML = '<div id="myCarousel" class="carousel" data-interval="false">' +
        '<div class="carousel-inner">' +
          '<div id="first" class="carousel-item">' +
            '<input type="text" id="inputText" />' +
          '</div>' +
          '<div id="second" class="carousel-item active">' +
            '<textarea id="txtArea"></textarea>' +
          '</div>' +
        '</div>' +
        '</div>'
959
960
961
962
963
964
965
    var $template = $(templateHTML)
    var done = assert.async()
    $template.appendTo('#qunit-fixture')
    var $inputText = $template.find('#inputText')
    var $textArea = $template.find('#txtArea')
    $template.bootstrapCarousel()

XhmikosR's avatar
XhmikosR committed
966
967
968
    var eventKeyDown = $.Event('keydown', {
      which: 65
    }) // 65 for "a"
969
970
971
972
973
974
975
976
977
978
979
    $inputText.on('keydown', function (event) {
      assert.strictEqual(event.isDefaultPrevented(), false)
    })
    $inputText.trigger(eventKeyDown)

    $textArea.on('keydown', function (event) {
      assert.strictEqual(event.isDefaultPrevented(), false)
      done()
    })
    $textArea.trigger(eventKeyDown)
  })
980

981
  QUnit.test('should not go to the next item when the carousel is not visible', function (assert) {
982
983
    assert.expect(2)
    var done = assert.async()
XhmikosR's avatar
XhmikosR committed
984
985
986
987
988
989
990
991
992
993
994
995
996
997
    var html = '<div id="myCarousel" class="carousel slide" data-interval="50" style="display: none;">' +
             '  <div class="carousel-inner">' +
             '    <div id="firstItem" class="carousel-item active">' +
             '      <img alt="">' +
             '    </div>' +
             '    <div class="carousel-item">' +
             '      <img alt="">' +
             '    </div>' +
             '    <div class="carousel-item">' +
             '      <img alt="">' +
             '    </div>' +
             '  <a class="left carousel-control" href="#myCarousel" data-slide="prev">&lsaquo;</a>' +
             '  <a class="right carousel-control" href="#myCarousel" data-slide="next">&rsaquo;</a>' +
             '</div>'
998
999
1000
    var $html = $(html)
    $html
      .appendTo('#qunit-fixture')
For faster browsing, not all history is shown. View entire blame