Sha256: b44c92b8e91818caf08bbdb2a6258efcd9856c69c71c8d6fdf8cc119c4984eef

Contents?: true

Size: 1.47 KB

Versions: 29

Compression:

Stored size: 1.47 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 = {
        loadStylesheet: jasmine.createSpy('createCssLink')
      };

      load = jasmine.createSpy('load');

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

      defaultModule.load(load);
    });

    it('should have inserted the links correctly', function () {
      expect(fakeDomHelper.loadStylesheet.callCount).toEqual(2);
      expect(fakeDomHelper.loadStylesheet).toHaveBeenCalledWith('http://moo');
      expect(fakeDomHelper.loadStylesheet).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');
    });

    it('should have set a custom test string', function () {
      expect(load.callCount).toEqual(1);
      expect(load.calls[0].args[1]).toEqual({ Font3: 'hello world' });
    });
  });
});

Version data entries

29 entries across 29 versions & 1 rubygems

Version Path
webfontloader-1.6.7 spec/modules/custom_spec.js
webfontloader-1.6.6 spec/modules/custom_spec.js
webfontloader-1.6.5 spec/modules/custom_spec.js
webfontloader-1.6.4 spec/modules/custom_spec.js
webfontloader-1.6.3 spec/modules/custom_spec.js
webfontloader-1.6.2 spec/modules/custom_spec.js
webfontloader-1.6.0 spec/modules/custom_spec.js
webfontloader-1.5.21 spec/modules/custom_spec.js
webfontloader-1.5.20 spec/modules/custom_spec.js
webfontloader-1.5.19 spec/modules/custom_spec.js
webfontloader-1.5.18 spec/modules/custom_spec.js
webfontloader-1.5.17 spec/modules/custom_spec.js
webfontloader-1.5.16 spec/modules/custom_spec.js
webfontloader-1.5.15 spec/modules/custom_spec.js
webfontloader-1.5.14 spec/modules/custom_spec.js
webfontloader-1.5.13 spec/modules/custom_spec.js
webfontloader-1.5.12 spec/modules/custom_spec.js
webfontloader-1.5.11 spec/modules/custom_spec.js
webfontloader-1.5.10 spec/modules/custom_spec.js
webfontloader-1.5.9 spec/modules/custom_spec.js