Sha256: 21a8be30a26956dcb4c06373739f738ac77504eeec53d204870de646510c65c2

Contents?: true

Size: 1.28 KB

Versions: 5

Compression:

Stored size: 1.28 KB

Contents

describe('modules.Custom', function () {
  var Custom = webfont.modules.Custom,
      FontFamily = webfont.FontFamily;

  describe('insert links correctly', function () {
    var fakeDomHelper = null,
        load = null;

    beforeEach(function () {
      fakeDomHelper = {
        createCssLink: jasmine.createSpy('createCssLink'),
        insertInto: jasmine.createSpy('insertInto')
      };

      load = jasmine.createSpy('load');

      var defaultModule = new Custom(fakeDomHelper, {
        families: ['Font1', 'Font2', 'Font3'],
        urls: ['http://moo', 'http://meuh']
      });

      defaultModule.load(load);
    });

    it('should have inserted the links correctly', function () {
      expect(fakeDomHelper.createCssLink.callCount).toEqual(2);
      expect(fakeDomHelper.createCssLink).toHaveBeenCalledWith('http://moo');
      expect(fakeDomHelper.createCssLink).toHaveBeenCalledWith('http://meuh');
    });

    it('should have loaded the families correctly', function () {
      expect(load.callCount).toEqual(1);
      expect(load.calls[0].args[0].length).toEqual(3);
      expect(load.calls[0].args[0][0].getName()).toEqual('Font1');
      expect(load.calls[0].args[0][1].getName()).toEqual('Font2');
      expect(load.calls[0].args[0][2].getName()).toEqual('Font3');
    });
  });
});

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
webfontloader-1.4.9 spec/modules/custom_spec.js
webfontloader-1.4.8 spec/modules/custom_spec.js
webfontloader-1.4.7 spec/modules/custom_spec.js
webfontloader-1.4.6 spec/modules/custom_spec.js
webfontloader-1.4.5 spec/modules/custom_spec.js