Welcome to mirror list, hosted at ThFree Co, Russian Federation.

candy.js « unit « candy « tests - github.com/candy-chat/candy.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: bd3ea46f189e3b42a6309f1e03569d6fbb9130b8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
/*global define, Candy */

define([
    'intern!bdd'
  , 'intern/chai!expect'
  , 'intern/order!jquery'
  , 'intern/order!candy/libs.bundle.js'
  , 'intern/order!candy/src/candy.js'
], function (bdd, expect, $) {
  bdd.describe('Candy', function () {
    bdd.describe('event triggering', function () {
      bdd.it('should bubble up exceptions from event handlers', function () {
        $(Candy).on('candy:core.message', function(ev, obj) {
          throw new ReferenceError(obj.msg);
        });
        expect(function () {
          $(Candy).triggerHandler('candy:core.message', { msg: 'foo bar' });
        }).to.throw(ReferenceError, /foo bar/);
      });
    });
  });
});