Sha256: 3c559261483d252de2c9ba6a2281d8d78acddff0f1f67654094b4dfa39008861

Contents?: true

Size: 1.58 KB

Versions: 56

Compression:

Stored size: 1.58 KB

Contents

describe('modules.google.FontApiUrlBuilder', function () {
  var FontApiUrlBuilder = webfont.modules.google.FontApiUrlBuilder;

  it('should throw an exception if there are no font families', function () {
    var builder = new FontApiUrlBuilder('http://moo', 'http:');
    expect(builder.build).toThrow();
  });

  it('should build a proper url', function () {
    var builder = new FontApiUrlBuilder('http://moo', 'http:');
    builder.setFontFamilies(['Font1', 'Font2']);
    expect(builder.build()).toEqual('http://moo?family=Font1%7CFont2');
  });

  it('should build a proper url', function () {
    var builder = new FontApiUrlBuilder(undefined, 'http:');
    builder.setFontFamilies(['Font1', 'Font2']);
    expect(builder.build()).toEqual('http:' +
      FontApiUrlBuilder.DEFAULT_API_URL +
      '?family=Font1%7CFont2');
  });

  it('should build a proper url', function () {
    var builder = new FontApiUrlBuilder(undefined, 'http:');
    builder.setFontFamilies(['Font1:bold:greek,cyrillic', 'Font2:italic', 'Font3']);
    expect(builder.build()).toEqual('http:' +
      FontApiUrlBuilder.DEFAULT_API_URL +
      '?family=Font1:bold%7CFont2:italic%7CFont3' +
      '&subset=greek,cyrillic');
  });

  it('should build a proper url', function () {
    var builder = new FontApiUrlBuilder(undefined, 'http:');
    builder.setFontFamilies(['Font1:bold,italic:greek,cyrillic', 'Font2:italic', 'Font3::latin']);
    expect(builder.build()).toEqual('http:' +
      FontApiUrlBuilder.DEFAULT_API_URL +
      '?family=Font1:bold,italic%7CFont2:italic%7CFont3' +
      '&subset=greek,cyrillic,latin');
  });
});

Version data entries

56 entries across 56 versions & 1 rubygems

Version Path
webfontloader-1.6.27 spec/modules/google/fontapiurlbuilder_spec.js
webfontloader-1.6.26 spec/modules/google/fontapiurlbuilder_spec.js
webfontloader-1.6.25 spec/modules/google/fontapiurlbuilder_spec.js
webfontloader-1.6.24 spec/modules/google/fontapiurlbuilder_spec.js
webfontloader-1.6.23 spec/modules/google/fontapiurlbuilder_spec.js
webfontloader-1.6.22 spec/modules/google/fontapiurlbuilder_spec.js
webfontloader-1.6.21 spec/modules/google/fontapiurlbuilder_spec.js
webfontloader-1.6.20 spec/modules/google/fontapiurlbuilder_spec.js
webfontloader-1.6.19 spec/modules/google/fontapiurlbuilder_spec.js
webfontloader-1.6.18 spec/modules/google/fontapiurlbuilder_spec.js
webfontloader-1.6.16 spec/modules/google/fontapiurlbuilder_spec.js
webfontloader-1.6.15 spec/modules/google/fontapiurlbuilder_spec.js
webfontloader-1.6.14 spec/modules/google/fontapiurlbuilder_spec.js
webfontloader-1.6.13 spec/modules/google/fontapiurlbuilder_spec.js
webfontloader-1.6.12 spec/modules/google/fontapiurlbuilder_spec.js
webfontloader-1.6.11 spec/modules/google/fontapiurlbuilder_spec.js
webfontloader-1.6.10 spec/modules/google/fontapiurlbuilder_spec.js
webfontloader-1.6.9 spec/modules/google/fontapiurlbuilder_spec.js
webfontloader-1.6.8 spec/modules/google/fontapiurlbuilder_spec.js
webfontloader-1.6.7 spec/modules/google/fontapiurlbuilder_spec.js